部署 choerodon platform,从日志来看初始化数据库失败了

  • Choerodon平台版本: 0.6.0

  • 遇到问题的执行步骤:

  • 文档地址:

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

  • 报错日志:
    2021-02-07 11:11:29.448 ERROR 6 — [ main] io.choerodon.liquibase.StartupRunner : 数据库初始化任务失败, message: liquibase.exception.LockException: liquibase.exception.DatabaseException: Table ‘hzero_platform.databasechangeloglock’ doesn’t exist [Failed SQL: CREATE TABLE hzero_platform.DATABASECHANGELOGLOCK (ID INT NOT NULL, LOCKED BIT(1) NOT NULL, LOCKGRANTED datetime NULL, LOCKEDBY VARCHAR(255) NULL, CONSTRAINT PK_DATABASECHANGELOGLOCK PRIMARY KEY (ID))], exception:

java.lang.Exception: liquibase.exception.LockException: liquibase.exception.DatabaseException: Table ‘hzero_platform.databasechangeloglock’ doesn’t exist [Failed SQL: CREATE TABLE hzero_platform.DATABASECHANGELOGLOCK (ID INT NOT NULL, LOCKED BIT(1) NOT NULL, LOCKGRANTED datetime NULL, LOCKEDBY VARCHAR(255) NULL, CONSTRAINT PK_DATABASECHANGELOGLOCK PRIMARY KEY (ID))]
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.updateGroovy(ImportDataServiceImpl.java:269) ~[hzero-installer-0.2.6.RELEASE.jar!/:0.2.6.RELEASE]
at org.hzero.installer.service.impl.ImportDataServiceImpl.selfGroovy(ImportDataServiceImpl.java:277) ~[hzero-installer-0.2.6.RELEASE.jar!/:0.2.6.RELEASE]
at io.choerodon.liquibase.StartupRunner.run(StartupRunner.java:58) ~[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: liquibase.exception.LockException: liquibase.exception.DatabaseException: Table ‘hzero_platform.databasechangeloglock’ doesn’t exist [Failed SQL: CREATE TABLE hzero_platform.DATABASECHANGELOGLOCK (ID INT NOT NULL, LOCKED BIT(1) NOT NULL, LOCKGRANTED datetime NULL, LOCKEDBY VARCHAR(255) NULL, CONSTRAINT PK_DATABASECHANGELOGLOCK PRIMARY KEY (ID))]
at liquibase.lockservice.StandardLockService.acquireLock(StandardLockService.java:242) ~[liquibase-core-3.5.5.jar!/:na]
at liquibase.lockservice.StandardLockService.waitForLock(StandardLockService.java:170) ~[liquibase-core-3.5.5.jar!/:na]
at liquibase.Liquibase.clearCheckSums(Liquibase.java:1335) ~[liquibase-core-3.5.5.jar!/:na]
at org.hzero.installer.liquibase.LiquibaseExecutor.load(LiquibaseExecutor.java:297) ~[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]
… 16 common frames omitted
Caused by: liquibase.exception.DatabaseException: Table ‘hzero_platform.databasechangeloglock’ doesn’t exist [Failed SQL: CREATE TABLE hzero_platform.DATABASECHANGELOGLOCK (ID INT NOT NULL, LOCKED BIT(1) NOT NULL, LOCKGRANTED datetime NULL, LOCKEDBY VARCHAR(255) NULL, CONSTRAINT PK_DATABASECHANGELOGLOCK PRIMARY KEY (ID))]
at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:309) ~[liquibase-core-3.5.5.jar!/:na]
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:55) ~[liquibase-core-3.5.5.jar!/:na]
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:113) ~[liquibase-core-3.5.5.jar!/:na]
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:103) ~[liquibase-core-3.5.5.jar!/:na]
at liquibase.lockservice.StandardLockService.init(StandardLockService.java:94) ~[liquibase-core-3.5.5.jar!/:na]
at liquibase.lockservice.StandardLockService.acquireLock(StandardLockService.java:206) ~[liquibase-core-3.5.5.jar!/:na]
… 21 common frames omitted
Caused by: java.sql.SQLSyntaxErrorException: Table ‘hzero_platform.databasechangeloglock’ doesn’t exist
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120) ~[mysql-connector-java-8.0.15.jar!/:8.0.15]
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97) ~[mysql-connector-java-8.0.15.jar!/:8.0.15]
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122) ~[mysql-connector-java-8.0.15.jar!/:8.0.15]
at com.mysql.cj.jdbc.StatementImpl.executeInternal(StatementImpl.java:782) ~[mysql-connector-java-8.0.15.jar!/:8.0.15]
at com.mysql.cj.jdbc.StatementImpl.execute(StatementImpl.java:666) ~[mysql-connector-java-8.0.15.jar!/:8.0.15]
at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:307) ~[liquibase-core-3.5.5.jar!/:na]
… 26 common frames omitted

2021-02-07 11:11:29.455 INFO 6 — [ Thread-6] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated…
2021-02-07 11:11:29.459 INFO 6 — [ Thread-6] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.

———————————————————————————————————————
NAME COMPLETIONS DURATION AGE
job.batch/choerodon-platform-init-db 0/1 5m14s 5m14s
job.batch/create-c7nfw-db 1/1 7s 20m
job.batch/gitlab-gitlab-core-backup-scheduled-1612458000 1/1 45s 2d10h
job.batch/gitlab-gitlab-core-backup-scheduled-1612544400 1/1 48s 34h
job.batch/gitlab-gitlab-core-backup-scheduled-1612630800 1/1 50s 10h
job.batch/sonatype-nexus-initpwd-job 0/1 2d18h 2d18h

——————————————————————————————————————
配置文件用的文档里的:

preJob:
preInitDB:
datasource:
url: jdbc:mysql://c7n-mysql.c7n-system:3306/?useUnicode=true&characterEncoding=utf-8&useSSL=false&useInformationSchema=true&remarks=true&serverTimezone=Asia/Shanghai
username: choerodon
password: password
driver: com.mysql.jdbc.Driver
env:
open:
HZERO_PLATFORM_HTTP_PROTOCOL: http
EUREKA_CLIENT_SERVICEURL_DEFAULTZONE: http://choerodon-register.c7n-system:8000/eureka/
SPRING_REDIS_HOST: c7n-redis.c7n-system
SPRING_REDIS_PORT: 6379
# 此db不可更改
SPRING_REDIS_DATABASE: 1
SPRING_DATASOURCE_URL: jdbc:mysql://c7n-mysql.c7n-system:3306/hzero_platform?useUnicode=true&characterEncoding=utf-8&useSSL=false&useInformationSchema=true&remarks=true&serverTimezone=Asia/Shanghai
SPRING_DATASOURCE_USERNAME: choerodon
SPRING_DATASOURCE_PASSWORD: password
HZERO_EXPORT_COREPOOLSIZE: 1

  • 原因分析:

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

  • 疑问:

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

查看了网上的资料,我把这个databasechangeloglock 删除了,把create-c7nfw-db这个job生成的pvc里的文件夹。都删除了 重新跑,也没有这个文件了,好奇怪。