从0.23升级到0.24 agile升级初始化数据库失败

  • Choerodon平台版本: 0.23

  • 遇到问题的执行步骤:

  1. helm upgrade agile-service c7n/agile-service \
  2. -f <(helm get values -n c7n-system agile-service) \
  3. --version 0.24.5 \
  4. --namespace c7n-system

升级agile服务时,从日志里看要初始化hzero_message数据库,但是无法连接到此数据库

  • 文档地址:https://open.hand-china.com/document-center/doc/product/10003/10426?doc_id=125749&doc_code=31840#升级%20agile%20service

  • 环境信息(如:节点信息):

  • 报错日志:
    2021-12-24 12:21:49.362 INFO 6 — [ main] o.h.i.liquibase.excel.ExcelDataLoader : ---- total process 234,time:214ms ----
    2021-12-24 12:21:49.362 INFO 6 — [ main] o.h.i.liquibase.excel.ExcelDataLoader : begin update exists datas…
    2021-12-24 12:21:49.625 INFO 6 — [ main] o.h.i.liquibase.excel.ExcelDataLoader : update complete, update row:234 (include tl)
    2021-12-24 12:21:49.625 INFO 6 — [ main] o.h.i.liquibase.excel.ExcelDataLoader : SUCCESS
    2021-12-24 12:21:49.625 INFO 6 — [ main] o.h.i.liquibase.excel.ExcelDataLoader : data process finish, time: 477 ms
    2021-12-24 12:21:49.662 INFO 6 — [ main] o.h.i.liquibase.LiquibaseExecutor : The database initialization task is complete
    2021-12-24 12:21:49.662 INFO 6 — [ main] o.h.i.s.impl.ImportDataServiceImpl : >>>>>>>>>>>>>>>>>>>>>>>>>>>> end : service=agile_service, schema=agile_service <<<<<<<<<<<<<<<<<<<<<<<<<<<<<

2021-12-24 12:21:49.662 INFO 6 — [ main] o.h.i.s.impl.ImportDataServiceImpl : >>>>>>>>>>>>>>>>>>>>>>>>>>> start : service=hzero_message, schema=hzero_message <<<<<<<<<<<<<<<<<<<<<<<<<<<<<
2021-12-24 12:21:49.722 ERROR 6 — [ main] o.h.i.liquibase.LiquibaseExecutor : The database initialization task failed
2021-12-24 12:21:49.790 ERROR 6 — [ main] io.choerodon.liquibase.StartupRunner : 数据库初始化任务失败, message: com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server., exception:

java.lang.Exception: com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
at org.hzero.installer.liquibase.LiquibaseExecutor.execute(LiquibaseExecutor.java:120) ~[hzero-installer-0.2.6.RELEASE.jar!/:0.2.6.RELEASE]
at org.hzero.installer.service.impl.ImportDataServiceImpl.executor(ImportDataServiceImpl.java:297) ~[hzero-installer-0.2.6.RELEASE.jar!/:0.2.6.RELEASE]
at org.hzero.installer.service.impl.ImportDataServiceImpl.executor(ImportDataServiceImpl.java:282) ~[hzero-installer-0.2.6.RELEASE.jar!/:0.2.6.RELEASE]
at org.hzero.installer.service.impl.ImportDataServiceImpl.importData(ImportDataServiceImpl.java:226) ~[hzero-installer-0.2.6.RELEASE.jar!/:0.2.6.RELEASE]
at org.hzero.installer.service.impl.ImportDataServiceImpl.selfData(ImportDataServiceImpl.java:237) ~[hzero-installer-0.2.6.RELEASE.jar!/:0.2.6.RELEASE]
at io.choerodon.liquibase.StartupRunner.run(StartupRunner.java:68) ~[classes!/:0.17.1.RELEASE]
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:792) [spring-boot-2.0.6.RELEASE.jar!/:2.0.6.RELEASE]
at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:776) [spring-boot-2.0.6.RELEASE.jar!/:2.0.6.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-2.0.6.RELEASE.jar!/:2.0.6.RELEASE]
at io.choerodon.liquibase.LiquibaseTools.main(LiquibaseTools.java:20) [classes!/:0.17.1.RELEASE]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_272]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_272]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_272]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_272]
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [choerodon-tool-liquibase.jar:0.17.1.RELEASE]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [choerodon-tool-liquibase.jar:0.17.1.RELEASE]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) [choerodon-tool-liquibase.jar:0.17.1.RELEASE]
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51) [choerodon-tool-liquibase.jar:0.17.1.RELEASE]
Caused by: com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
at com.mysql.cj.jdbc.exceptions.SQLError.createCommunicationsException(SQLError.java:174) ~[mysql-connector-java-8.0.15.jar!/:8.0.15]
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:64) ~[mysql-connector-java-8.0.15.jar!/:8.0.15]
at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:835) ~[mysql-connector-java-8.0.15.jar!/:8.0.15]
at com.mysql.cj.jdbc.ConnectionImpl.(ConnectionImpl.java:455) ~[mysql-connector-java-8.0.15.jar!/:8.0.15]
at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:240) ~[mysql-connector-java-8.0.15.jar!/:8.0.15]
at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:199) ~[mysql-connector-java-8.0.15.jar!/:8.0.15]
at java.sql.DriverManager.getConnection(DriverManager.java:664) ~[na:1.8.0_272]
at java.sql.DriverManager.getConnection(DriverManager.java:208) ~[na:1.8.0_272]
at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager(DriverManagerDataSource.java:154) ~[spring-jdbc-5.0.10.RELEASE.jar!/:5.0.10.RELEASE]
at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriver(DriverManagerDataSource.java:145) ~[spring-jdbc-5.0.10.RELEASE.jar!/:5.0.10.RELEASE]
at org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnectionFromDriver(AbstractDriverBasedDataSource.java:205) ~[spring-jdbc-5.0.10.RELEASE.jar!/:5.0.10.RELEASE]
at org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnection(AbstractDriverBasedDataSource.java:169) ~[spring-jdbc-5.0.10.RELEASE.jar!/:5.0.10.RELEASE]
at org.hzero.installer.liquibase.LiquibaseExecutor.load(LiquibaseExecutor.java:291) ~[hzero-installer-0.2.6.RELEASE.jar!/:0.2.6.RELEASE]
at org.hzero.installer.liquibase.LiquibaseExecutor.runToDb(LiquibaseExecutor.java:200) ~[hzero-installer-0.2.6.RELEASE.jar!/:0.2.6.RELEASE]
at org.hzero.installer.liquibase.LiquibaseExecutor.execute(LiquibaseExecutor.java:116) ~[hzero-installer-0.2.6.RELEASE.jar!/:0.2.6.RELEASE]
… 17 common frames omitted
Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_272]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[na:1.8.0_272]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:1.8.0_272]
at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[na:1.8.0_272]
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61) ~[mysql-connector-java-8.0.15.jar!/:8.0.15]
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105) ~[mysql-connector-java-8.0.15.jar!/:8.0.15]
at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151) ~[mysql-connector-java-8.0.15.jar!/:8.0.15]
at com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:167) ~[mysql-connector-java-8.0.15.jar!/:8.0.15]
at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:91) ~[mysql-connector-java-8.0.15.jar!/:8.0.15]
at com.mysql.cj.NativeSession.connect(NativeSession.java:152) ~[mysql-connector-java-8.0.15.jar!/:8.0.15]
at com.mysql.cj.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:955) ~[mysql-connector-java-8.0.15.jar!/:8.0.15]
at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:825) ~[mysql-connector-java-8.0.15.jar!/:8.0.15]
… 29 common frames omitted
Caused by: java.net.ConnectException: Connection refused (Connection refused)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[na:1.8.0_272]
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[na:1.8.0_272]
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[na:1.8.0_272]
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:1.8.0_272]
at java.net.Socket.connect(Socket.java:607) ~[na:1.8.0_272]
at com.mysql.cj.protocol.StandardSocketFactory.connect(StandardSocketFactory.java:155) ~[mysql-connector-java-8.0.15.jar!/:8.0.15]
at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:65) ~[mysql-connector-java-8.0.15.jar!/:8.0.15]
… 32 common frames omitted

2021-12-24 12:21:49.791 INFO 6 — [ Thread-6] ConfigServletWebServerApplicationContext : Closing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@470c8575: startup date [Fri Dec 24 12:21:30 CST 2021]; root of context hierarchy
2021-12-24 12:21:49.796 INFO 6 — [ Thread-6] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated…
2021-12-24 12:21:49.800 INFO 6 — [ Thread-6] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.

  • 原因分析:

    提出您分析问题的过程,以便我们能更准确的找到问题所在

  • 疑问:

    提出您对于遇到和解决该问题时的疑问

查看当前的agile服务的values:

[root@choerodon01 choup20211222]# helm get values -n c7n-system agile-service
USER-SUPPLIED VALUES:
USER-SUPPLIED VALUES: null
env:
open:
EUREKA_CLIENT_SERVICEURL_DEFAULTZONE: http://choerodon-register.c7n-system:8000/eureka/
SERVICES_ATTACHMENT_URL: http://minio.xxxx.com
SPRING_CLOUD_CONFIG_ENABLED: false
SPRING_CLOUD_CONFIG_URI: http://register-server.c7n-system:8000/
SPRING_DATASOURCE_PASSWORD: password
SPRING_DATASOURCE_URL: jdbc:mysql://c7n-mysql.c7n-system.svc:3306/agile_service?useUnicode=true&characterEncoding=utf-8&useSSL=false&useInformationSchema=true&remarks=true&allowMultiQueries=true&serverTimezone=Asia/Shanghai
SPRING_DATASOURCE_USERNAME: choerodon
SPRING_REDIS_DATABASE: 9
SPRING_REDIS_HOST: c7n-redis.c7n-system.svc
preJob:
preInitDB:
datasource:
password: password
url: jdbc:mysql://c7n-mysql.c7n-system.svc:3306/?useUnicode=true&characterEncoding=utf-8&useSSL=false&useInformationSchema=true&remarks=true&allowMultiQueries=true&serverTimezone=Asia/Shanghai
username: choerodon
datasources:
platform:
driver: com.mysql.jdbc.Driver
password: password
url: jdbc:mysql://c7n-mysql.c7n-system.svc:3306/?useUnicode=true&characterEncoding=utf-8&useSSL=false&useInformationSchema=true&remarks=true&allowMultiQueries=true&serverTimezone=Asia/Shanghai
username: choerodon
timeout: 1800