Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI, JobService can not connect to the MySQL #777

Closed
levchik opened this issue Sep 8, 2016 · 4 comments
Closed

UI, JobService can not connect to the MySQL #777

levchik opened this issue Sep 8, 2016 · 4 comments
Assignees

Comments

@levchik
Copy link

levchik commented Sep 8, 2016

1)Version of docker engine and docker-compose
Docker version 1.11.2, build b9f10c9
docker-compose version 1.6.0, build d99cad6
2)Config files of harbor, you can get them by packaging "Deploy/config" directory

cat config/jobservice/app.conf
appname = jobservice
runmode = dev

[dev]
httpport = 80

cat config/jobservice/env
MYSQL_HOST=mysql
MYSQL_PORT=3306
MYSQL_USR=root
MYSQL_PWD=qwerty
UI_SECRET=qwerty
CONFIG_PATH=/etc/jobservice/app.conf
REGISTRY_URL=http://registry:5000
VERIFY_REMOTE_CERT=on
MAX_JOB_WORKERS=3
LOG_LEVEL=debug
LOG_DIR=/var/log/jobs
GODEBUG=netdns=cgo
EXT_ENDPOINT=https://docker.company.com
TOKEN_URL=http://ui

cat config/ui/app.conf
appname = registry
runmode = dev

[lang]
types = en-US|zh-CN
names = en-US|zh-CN

[dev]
httpport = 80

[mail]
host = smtp.asd.org
port = 25
username = qwerr
password = qwr=erty
from = admin <sample_admin@mydomain.com>
ssl = false

cat config/ui/env
MYSQL_HOST=mysql
MYSQL_PORT=3306
MYSQL_USR=root
MYSQL_PWD=qwerty
REGISTRY_URL=http://registry:5000
UI_URL=http://ui
CONFIG_PATH=/etc/ui/app.conf
HARBOR_REG_URL=docker.company.com
HARBOR_ADMIN_PASSWORD=qwerty
HARBOR_URL=https://docker.company.com
AUTH_MODE=db_auth
LDAP_URL=ldaps://ldap.mydomain.com
LDAP_BASE_DN=uid=%s,ou=people,dc=mydomain,dc=com
UI_SECRET=qwerty
SELF_REGISTRATION=off
USE_COMPRESSED_JS=on
LOG_LEVEL=debug
GODEBUG=netdns=cgo
EXT_ENDPOINT=https://docker.company.com
TOKEN_URL=http://ui
VERIFY_REMOTE_CERT=on
TOKEN_EXPIRATION=30

3)Log files, you can get them by package the /var/log/harbor/
I use just "docker-compose up", so here is the output:

Starting harbor_log_1
Starting harbor_mysql_1
Starting harbor_ui_1
Starting harbor_jobservice_1
Starting harbor_registry_1
Starting harbor_proxy_1
Attaching to harbor_log_1, harbor_mysql_1, harbor_ui_1, harbor_jobservice_1, harbor_registry_1, harbor_proxy_1
log_1        | rsyslogd: pidfile '/var/run/rsyslogd.pid' and pid 7 already exist.
log_1        | If you want to run multiple instances of rsyslog, you need to specify
log_1        | different pid files for them (-i option).
log_1        | rsyslogd: run failed with error -3000 (see rsyslog.h or try http://www.rsyslog.com/e/3000 to learn what that number means)
ui_1         | 2016-09-08T08:27:56Z [INFO] token expiration: 30 minutes
ui_1         | 2016-09-08T08:27:56Z [INFO] Config path: /etc/ui/app.conf
ui_1         | 2016-09-08T08:27:56Z [DEBUG] [base.go:54]: db url: mysql:3306, db user: root
ui_1         | 2016-09-08T08:27:56Z [ERROR] [base.go:66]: failed to connect to db, retry after 2 seconds :dial tcp 172.29.0.3:3306: getsockopt: connection refused
ui_1         | 2016-09-08T08:27:58Z [ERROR] [base.go:66]: failed to connect to db, retry after 2 seconds :dial tcp 172.29.0.3:3306: getsockopt: connection refused
jobservice_1 | 2016-09-08T08:27:57Z [INFO] Config path: /etc/jobservice/app.conf
jobservice_1 | 2016-09-08T08:27:57Z [DEBUG] [config.go:89]: config: maxJobWorkers: 3
jobservice_1 | 2016-09-08T08:27:57Z [DEBUG] [config.go:90]: config: localUIURL: http://ui
jobservice_1 | 2016-09-08T08:27:57Z [DEBUG] [config.go:91]: config: localRegURL: http://registry:5000
jobservice_1 | 2016-09-08T08:27:57Z [DEBUG] [config.go:92]: config: verifyRemoteCert: on
jobservice_1 | 2016-09-08T08:27:57Z [DEBUG] [config.go:93]: config: logDir: /var/log/jobs
jobservice_1 | 2016-09-08T08:27:57Z [DEBUG] [config.go:94]: config: uiSecret: ******
jobservice_1 | 2016-09-08T08:27:57Z [INFO] token expiration: 30 minutes
jobservice_1 | 2016-09-08T08:27:57Z [DEBUG] [base.go:54]: db url: mysql:3306, db user: root
jobservice_1 | 2016-09-08T08:27:57Z [ERROR] [base.go:66]: failed to connect to db, retry after 2 seconds :dial tcp 172.29.0.3:3306: getsockopt: connection refused
registry_1   | time="2016-09-08T08:27:59.361777502Z" level=info msg="configuring endpoint harbor (http://ui/service/notifications), timeout=3s, headers=map[]" go.version=go1.6.3 instance.id=73969480-7eef-45af-b729-1f8785d21c99 service=registry version=v2.5.0
registry_1   | time="2016-09-08T08:27:59.365413007Z" level=info msg="redis not configured" go.version=go1.6.3 instance.id=73969480-7eef-45af-b729-1f8785d21c99 service=registry version=v2.5.0
registry_1   | time="2016-09-08T08:27:59.388763658Z" level=info msg="debug server listening localhost:5001"
registry_1   | time="2016-09-08T08:27:59.398201495Z" level=info msg="Starting upload purge in 33m0s" go.version=go1.6.3 instance.id=73969480-7eef-45af-b729-1f8785d21c99 service=registry version=v2.5.0
registry_1   | time="2016-09-08T08:27:59.570445765Z" level=debug msg="configured \"token\" access controller" go.version=go1.6.3 instance.id=73969480-7eef-45af-b729-1f8785d21c99 service=registry version=v2.5.0
registry_1   | time="2016-09-08T08:27:59.571711574Z" level=info msg="listening on [::]:5000" go.version=go1.6.3 instance.id=73969480-7eef-45af-b729-1f8785d21c99 service=registry version=v2.5.0
jobservice_1 | 2016-09-08T08:27:59Z [ERROR] [base.go:66]: failed to connect to db, retry after 2 seconds :dial tcp 172.29.0.3:3306: getsockopt: connection refused
ui_1         | 2016-09-08T08:28:00Z [ERROR] [base.go:66]: failed to connect to db, retry after 2 seconds :dial tcp 172.29.0.3:3306: getsockopt: connection refused
harbor_log_1 exited with code 0
jobservice_1 | 2016-09-08T08:28:01Z [ERROR] [base.go:66]: failed to connect to db, retry after 2 seconds :dial tcp 172.29.0.3:3306: getsockopt: connection refused
mysql_1      | 2016-09-08 08:28:02 0 [Note] mysqld (mysqld 5.6.29) starting as process 1 ...
mysql_1      | 2016-09-08 08:28:02 1 [Note] Plugin 'FEDERATED' is disabled.
mysql_1      | 2016-09-08 08:28:02 1 [Note] InnoDB: Using atomics to ref count buffer pool pages
mysql_1      | 2016-09-08 08:28:02 1 [Note] InnoDB: The InnoDB memory heap is disabled
mysql_1      | 2016-09-08 08:28:02 1 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
mysql_1      | 2016-09-08 08:28:02 1 [Note] InnoDB: Memory barrier is not used
mysql_1      | 2016-09-08 08:28:02 1 [Note] InnoDB: Compressed tables use zlib 1.2.8
mysql_1      | 2016-09-08 08:28:02 1 [Note] InnoDB: Using Linux native AIO
mysql_1      | 2016-09-08 08:28:02 1 [Note] InnoDB: Not using CPU crc32 instructions
mysql_1      | 2016-09-08 08:28:02 1 [Note] InnoDB: Initializing buffer pool, size = 128.0M
mysql_1      | 2016-09-08 08:28:02 1 [Note] InnoDB: Completed initialization of buffer pool
mysql_1      | 2016-09-08 08:28:02 1 [Note] InnoDB: Highest supported file format is Barracuda.
ui_1         | 2016-09-08T08:28:02Z [ERROR] [base.go:66]: failed to connect to db, retry after 2 seconds :dial tcp 172.29.0.3:3306: getsockopt: connection refused
mysql_1      | 2016-09-08 08:28:03 1 [Note] InnoDB: 128 rollback segment(s) are active.
mysql_1      | 2016-09-08 08:28:03 1 [Note] InnoDB: Waiting for purge to start
mysql_1      | 2016-09-08 08:28:03 1 [Note] InnoDB: 5.6.29 started; log sequence number 1717292
mysql_1      | 2016-09-08 08:28:03 1 [Note] Server hostname (bind-address): '*'; port: 3306
mysql_1      | 2016-09-08 08:28:03 1 [Note] IPv6 is available.
mysql_1      | 2016-09-08 08:28:03 1 [Note]   - '::' resolves to '::';
mysql_1      | 2016-09-08 08:28:03 1 [Note] Server socket created on IP: '::'.
mysql_1      | 2016-09-08 08:28:03 1 [Warning] 'proxies_priv' entry '@ root@bd8f00ba5931' ignored in --skip-name-resolve mode.
mysql_1      | 2016-09-08 08:28:03 1 [Note] Event Scheduler: Loaded 0 events
mysql_1      | 2016-09-08 08:28:03 1 [Note] mysqld: ready for connections.
mysql_1      | Version: '5.6.29'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  MySQL Community Server (GPL)
jobservice_1 | [ORM]register db Ping `default`, Error 1045: Access denied for user 'root'@'172.29.0.5' (using password: YES)
jobservice_1 | panic: register db Ping `default`, Error 1045: Access denied for user 'root'@'172.29.0.5' (using password: YES)
jobservice_1 |
jobservice_1 | goroutine 1 [running]:
jobservice_1 | panic(0xa75d40, 0xc8203187f0)
jobservice_1 |  /usr/local/go/src/runtime/panic.go:481 +0x3e6
jobservice_1 | github.com/vmware/harbor/dao.InitDB()
jobservice_1 |  /go/src/github.com/vmware/harbor/dao/base.go:78 +0x5db
jobservice_1 | main.main()
jobservice_1 |  /go/src/github.com/vmware/harbor/jobservice/main.go:27 +0x18
harbor_jobservice_1 exited with code 0
ui_1         | [ORM]register db Ping `default`, Error 1045: Access denied for user 'root'@'172.29.0.4' (using password: YES)
ui_1         | panic: register db Ping `default`, Error 1045: Access denied for user 'root'@'172.29.0.4' (using password: YES)
ui_1         |
ui_1         | goroutine 1 [running]:
ui_1         | panic(0xafc580, 0xc82031c7e0)
ui_1         |  /usr/local/go/src/runtime/panic.go:481 +0x3e6
ui_1         | github.com/vmware/harbor/dao.InitDB()
ui_1         |  /go/src/github.com/vmware/harbor/dao/base.go:78 +0x5db
ui_1         | main.main()
ui_1         |  /go/src/github.com/vmware/harbor/ui/main.go:70 +0x55
harbor_ui_1 exited with code 0
@ywk253100
Copy link
Contributor

It seems that the connection information is not correct. Could you check whether you can connect it using your password with MySQL client in the container?
If you modified the password of MySQL in harbor.cfg while Harbor was running, you should do the follow steps to make sure it worked:

  1. Run prepare
  2. Run "docker-compose build" to re-build the images
  3. Run "docker-compose down" to stop the running Harbor
  4. Run "docker-compose up -d" to re-start Harbor

@levchik
Copy link
Author

levchik commented Sep 9, 2016

Thanks for the answer. I didn't modify the password while Harbor was running. However, I did follow the steps you suggested and it didn't do much difference.

I tried to connect with mysql client here is the result:

$ docker run --net=harbor_default -it --link harbor_mysql_1:mysql --rm mysql sh -c 'exec mysql -hmysql -P3306 -uroot -pqwerty'
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'root'@'172.29.0.9' (using password: YES)

BTW, I'm using the 0.3.5 version from here:
https://github.com/vmware/harbor/releases/download/0.3.5/harbor-installer.tgz

@ywk253100
Copy link
Contributor

It's not the first time you run Harbor, right? Harbor persists data of DB in directory /data/database by default, and the configuration of DB password works only when the DB initialises for the first time, which means the directory does not exist. So you can configure the DB password as its initial value "root123" if you have not changed it.

@levchik
Copy link
Author

levchik commented Sep 12, 2016

You're right, I've run Harbor before. Removed /data/database folder as it is no longer needed and Harbor started up successfully. Thanks a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants