polardb / polardbx-sql

PolarDB-X is a cloud native distributed SQL Database designed for high concurrency, massive storage, complex querying scenarios.
Apache License 2.0
1.53k stars 325 forks source link

CN不能正常启动 #207

Closed jmbkeyes closed 5 months ago

jmbkeyes commented 5 months ago

根据官方文档 源码编译安装,执行 bin/startup.sh \ -I \ -P asdf1234ghjk5678 \ -d 127.0.0.1:4886:32886 \ -r "" \ -u polardbx_root \ -S "123456" 终端输出: Generate password for user: my_polarx && S9(L4$uD6^Q1(1!K3$9&gB2_fO4K4)I0$A6 Encrypted password: Vme7IGYcWAuesgztEnDf6ApS6OIK7fjNIl/i3srv8CbzEIN0+oSG02mx5W1kDW6E The property file is resident at resource file, skip saving password into it ======== Paste following configurations to conf/server.properties ! ======= metaDbPasswd=Vme7IGYcWAuesgztEnDf6ApS6OIK7fjNIl/i3srv8CbzEIN0+oSG02mx5W1kDW6E ======== Paste above configurations to conf/server.properties ! ======= Mon Apr 29 13:15:21 CST 2024 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification. create metadb database: polardbx_meta_db_polardbx Mon Apr 29 13:15:21 CST 2024 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification. create user (my_polarx) on node (127.0.0.1:4886) Mon Apr 29 13:15:21 CST 2024 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification. create user (my_polarx) on node (127.0.0.1:4886:32886) Root user for polarx with password: polardbx_root && 123456 Encrypted password for polarx: UY1tQsgNvP8GJGGP8vHKKA== Initialize polardbx success

接着命令启动:bin/startup.sh -P asdf1234ghjk5678 结果:CN没有启动 tddl.log错误日志如下: 2024-04-29 13:17:11.428 [main] ERROR c.a.polardbx.gms.metadb.schema.SchemaChangeAccessor - [] [TDDL] Failed to execute the DDL statement: CREATE TABLE LOCALITY_INFO ( id bigint(20) unsigned NOT NULL AUTO_INCREMENT, gmt_created timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, gmt_modified timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, object_type int(11) NOT NULL COMMENT '0:default, 1:database, 2:tablegroup, 3:partitiongroup', object_id bigint(20) NOT NULL COMMENT 'id of the locality object', primary_zone varchar(128) NOT NULL DEFAULT '' COMMENT 'primary zone of the object', locality text NOT NULL COMMENT 'locality of the object', PRIMARY KEY(id), UNIQUE KEY(object_type, object_id) ) CHARSET=utf8;. Caused by: Table 'LOCALITY_INFO' already exists, tddl version: 5.4.18-20240428 java.sql.SQLException: Table 'LOCALITY_INFO' already exists at com.alibaba.polardbx.rpc.result.XResult.internalFetchOneObject(XResult.java:959) at com.alibaba.polardbx.rpc.result.XResult.internalFetchOneObject(XResult.java:579) at com.alibaba.polardbx.rpc.result.XResult.finishBlockMode(XResult.java:166) at com.alibaba.polardbx.rpc.client.XSession.execUpdate(XSession.java:1919) at com.alibaba.polardbx.rpc.pool.XConnection.execUpdate(XConnection.java:381) at com.alibaba.polardbx.rpc.compatible.XStatement.executeUpdateX(XStatement.java:57) at com.alibaba.polardbx.rpc.compatible.XStatement.executeUpdate(XStatement.java:88) at com.alibaba.polardbx.gms.util.MetaDbUtil.executeDDL(MetaDbUtil.java:76) at com.alibaba.polardbx.gms.metadb.schema.SchemaChangeAccessor.execute(SchemaChangeAccessor.java:126) at com.alibaba.polardbx.gms.metadb.schema.SchemaChangeManager.register(SchemaChangeManager.java:159) at com.alibaba.polardbx.gms.metadb.schema.SchemaChangeManager.doSchemaChange(SchemaChangeManager.java:113) at com.alibaba.polardbx.gms.metadb.schema.SchemaChangeManager.handle(SchemaChangeManager.java:82) at com.alibaba.polardbx.config.loader.ServerLoader.initPolarDbXComponents(ServerLoader.java:223) at com.alibaba.polardbx.config.loader.ServerLoader.load(ServerLoader.java:188) at com.alibaba.polardbx.config.loader.ServerLoader.doInit(ServerLoader.java:95) at com.alibaba.polardbx.common.model.lifecycle.AbstractLifecycle.init(AbstractLifecycle.java:43) at com.alibaba.polardbx.CobarConfig.initCobarConfig(CobarConfig.java:68) at com.alibaba.polardbx.CobarConfig.(CobarConfig.java:61) at com.alibaba.polardbx.CobarServer.(CobarServer.java:135) at com.alibaba.polardbx.CobarServer.(CobarServer.java:89) at com.alibaba.polardbx.server.TddlLauncher.main(TddlLauncher.java:126) 2024-04-29 13:17:11.447 [main] ERROR com.alibaba.polardbx.CobarConfig - [] Failed to init cobar server. com.alibaba.polardbx.common.exception.TddlRuntimeException: ERR-CODE: [PXC-9004][ERR_GMS_GET_CONNECTION] Failed to get a MetaDB connection. Caused by: schema change lock: ERR-CODE: [PXC-9001][ERR_GMS_GENERIC] Failed to execute the DDL statement: CREATE TABLE LOCALITY_INFO ( id bigint(20) unsigned NOT NULL AUTO_INCREMENT, gmt_created timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, gmt_modified timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, object_type int(11) NOT NULL COMMENT '0:default, 1:database, 2:tablegroup, 3:partitiongroup', object_id bigint(20) NOT NULL COMMENT 'id of the locality object', primary_zone varchar(128) NOT NULL DEFAULT '' COMMENT 'primary zone of the object', locality text NOT NULL COMMENT 'locality of the object', PRIMARY KEY(id), UNIQUE KEY(object_type, object_id) ) CHARSET=utf8;. Caused by: Table 'LOCALITY_INFO' already exists. . at com.alibaba.polardbx.gms.metadb.schema.SchemaChangeManager.handle(SchemaChangeManager.java:90) at com.alibaba.polardbx.config.loader.ServerLoader.initPolarDbXComponents(ServerLoader.java:223) at com.alibaba.polardbx.config.loader.ServerLoader.load(ServerLoader.java:188) at com.alibaba.polardbx.config.loader.ServerLoader.doInit(ServerLoader.java:95) at com.alibaba.polardbx.common.model.lifecycle.AbstractLifecycle.init(AbstractLifecycle.java:43) at com.alibaba.polardbx.CobarConfig.initCobarConfig(CobarConfig.java:68) at com.alibaba.polardbx.CobarConfig.(CobarConfig.java:61) at com.alibaba.polardbx.CobarServer.(CobarServer.java:135) at com.alibaba.polardbx.CobarServer.(CobarServer.java:89) at com.alibaba.polardbx.server.TddlLauncher.main(TddlLauncher.java:126) Caused by: com.alibaba.polardbx.common.exception.TddlRuntimeException: ERR-CODE: [PXC-9001][ERR_GMS_GENERIC] Failed to execute the DDL statement: CREATE TABLE LOCALITY_INFO ( id bigint(20) unsigned NOT NULL AUTO_INCREMENT, gmt_created timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, gmt_modified timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, object_type int(11) NOT NULL COMMENT '0:default, 1:database, 2:tablegroup, 3:partitiongroup', object_id bigint(20) NOT NULL COMMENT 'id of the locality object', primary_zone varchar(128) NOT NULL DEFAULT '' COMMENT 'primary zone of the object', locality text NOT NULL COMMENT 'locality of the object', PRIMARY KEY(id), UNIQUE KEY(object_type, object_id) ) CHARSET=utf8;. Caused by: Table 'LOCALITY_INFO' already exists. at com.alibaba.polardbx.gms.metadb.schema.SchemaChangeAccessor.execute(SchemaChangeAccessor.java:130) at com.alibaba.polardbx.gms.metadb.schema.SchemaChangeManager.register(SchemaChangeManager.java:159) at com.alibaba.polardbx.gms.metadb.schema.SchemaChangeManager.doSchemaChange(SchemaChangeManager.java:113) at com.alibaba.polardbx.gms.metadb.schema.SchemaChangeManager.handle(SchemaChangeManager.java:82) ... 9 common frames omitted Caused by: java.sql.SQLException: Table 'LOCALITY_INFO' already exists at com.alibaba.polardbx.rpc.result.XResult.internalFetchOneObject(XResult.java:959) at com.alibaba.polardbx.rpc.result.XResult.internalFetchOneObject(XResult.java:579) at com.alibaba.polardbx.rpc.result.XResult.finishBlockMode(XResult.java:166) at com.alibaba.polardbx.rpc.client.XSession.execUpdate(XSession.java:1919) at com.alibaba.polardbx.rpc.pool.XConnection.execUpdate(XConnection.java:381) at com.alibaba.polardbx.rpc.compatible.XStatement.executeUpdateX(XStatement.java:57) at com.alibaba.polardbx.rpc.compatible.XStatement.executeUpdate(XStatement.java:88) at com.alibaba.polardbx.gms.util.MetaDbUtil.executeDDL(MetaDbUtil.java:76) at com.alibaba.polardbx.gms.metadb.schema.SchemaChangeAccessor.execute(SchemaChangeAccessor.java:126) ... 12 common frames omitted 2024-04-29 13:17:11.449 [main] ERROR com.alibaba.polardbx.server.TddlLauncher - [] ## Something goes wrong when starting up the tddl server: java.lang.ExceptionInInitializerError at com.alibaba.polardbx.server.TddlLauncher.main(TddlLauncher.java:126) Caused by: ERR-CODE: [PXC-9004][ERR_GMS_GET_CONNECTION] Failed to get a MetaDB connection. Caused by: schema change lock: ERR-CODE: [PXC-9001][ERR_GMS_GENERIC] Failed to execute the DDL statement: CREATE TABLE LOCALITY_INFO ( id bigint(20) unsigned NOT NULL AUTO_INCREMENT, gmt_created timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, gmt_modified timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, object_type int(11) NOT NULL COMMENT '0:default, 1:database, 2:tablegroup, 3:partitiongroup', object_id bigint(20) NOT NULL COMMENT 'id of the locality object', primary_zone varchar(128) NOT NULL DEFAULT '' COMMENT 'primary zone of the object', locality text NOT NULL COMMENT 'locality of the object', PRIMARY KEY(id), UNIQUE KEY(object_type, object_id) ) CHARSET=utf8;. Caused by: Table 'LOCALITY_INFO' already exists. . at com.alibaba.polardbx.gms.metadb.schema.SchemaChangeManager.handle(SchemaChangeManager.java:90) at com.alibaba.polardbx.config.loader.ServerLoader.initPolarDbXComponents(ServerLoader.java:223) at com.alibaba.polardbx.config.loader.ServerLoader.load(ServerLoader.java:188) at com.alibaba.polardbx.config.loader.ServerLoader.doInit(ServerLoader.java:95) at com.alibaba.polardbx.common.model.lifecycle.AbstractLifecycle.init(AbstractLifecycle.java:43) at com.alibaba.polardbx.CobarConfig.initCobarConfig(CobarConfig.java:68) at com.alibaba.polardbx.CobarConfig.(CobarConfig.java:61) at com.alibaba.polardbx.CobarServer.(CobarServer.java:135) at com.alibaba.polardbx.CobarServer.(CobarServer.java:89) ... 1 more Caused by: ERR-CODE: [PXC-9001][ERR_GMS_GENERIC] Failed to execute the DDL statement: CREATE TABLE LOCALITY_INFO ( id bigint(20) unsigned NOT NULL AUTO_INCREMENT, gmt_created timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, gmt_modified timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, object_type int(11) NOT NULL COMMENT '0:default, 1:database, 2:tablegroup, 3:partitiongroup', object_id bigint(20) NOT NULL COMMENT 'id of the locality object', primary_zone varchar(128) NOT NULL DEFAULT '' COMMENT 'primary zone of the object', locality text NOT NULL COMMENT 'locality of the object', PRIMARY KEY(id), UNIQUE KEY(object_type, object_id) ) CHARSET=utf8;. Caused by: Table 'LOCALITY_INFO' already exists. at com.alibaba.polardbx.gms.metadb.schema.SchemaChangeAccessor.execute(SchemaChangeAccessor.java:130) at com.alibaba.polardbx.gms.metadb.schema.SchemaChangeManager.register(SchemaChangeManager.java:159) at com.alibaba.polardbx.gms.metadb.schema.SchemaChangeManager.doSchemaChange(SchemaChangeManager.java:113) at com.alibaba.polardbx.gms.metadb.schema.SchemaChangeManager.handle(SchemaChangeManager.java:82) ... 9 more Caused by: java.sql.SQLException: Table 'LOCALITY_INFO' already exists at com.alibaba.polardbx.rpc.result.XResult.internalFetchOneObject(XResult.java:959) at com.alibaba.polardbx.rpc.result.XResult.internalFetchOneObject(XResult.java:579) at com.alibaba.polardbx.rpc.result.XResult.finishBlockMode(XResult.java:166) at com.alibaba.polardbx.rpc.client.XSession.execUpdate(XSession.java:1919) at com.alibaba.polardbx.rpc.pool.XConnection.execUpdate(XConnection.java:381) at com.alibaba.polardbx.rpc.compatible.XStatement.executeUpdateX(XStatement.java:57) at com.alibaba.polardbx.rpc.compatible.XStatement.executeUpdate(XStatement.java:88) at com.alibaba.polardbx.gms.util.MetaDbUtil.executeDDL(MetaDbUtil.java:76) at com.alibaba.polardbx.gms.metadb.schema.SchemaChangeAccessor.execute(SchemaChangeAccessor.java:126) ... 12 more

jmbkeyes commented 5 months ago

bin/startup.sh -P asdf1234ghjk5678 这命令怎么还会去创建表呢?

ZSYTY commented 5 months ago

这里是在初始化 metadb 的过程中报错的。怀疑是 metadb 中有脏数据,导致初始化失败。可以把 metadb 库 drop 掉再重新初始化试试。

jmbkeyes commented 5 months ago

@ZSYTY 我用下面的sql drop过好几次了,没有用呢 drop database polardbx_meta_db_polardbx;

ZSYTY commented 5 months ago

@jmbkeyes 检查下 my.cnf 文件是否和文档中给出的配置一致,主要是这个变量 lower_case_table_names=1

jmbkeyes commented 5 months ago

嗯,检查过了没有设置lower_case_table_names=1;设置了之后,现在报了其他错了

jmbkeyes commented 5 months ago

然后参考https://github.com/polardb/polardbx-sql/issues/44 处理了No found any leader for metadb storage @ZSYTY navicate、命令行可以连到CN,heidisql不行 企业微信截图_17143778151492

ZSYTY commented 5 months ago

看起来似乎是 heidisql 执行了不兼容的 SQL 导致的,能否提供下 tddl.log 日志中 17e4a86ba6c00000 附近的报错信息?

jmbkeyes commented 5 months ago

@ZSYTY tddl中没有17e4a86ba6c00000

ZSYTY commented 5 months ago

在 sql.log 里找下 17e4a86ba6c00000 对应的 SQL 文本呢

jmbkeyes commented 5 months ago

没有这文件 1714384447631

ZSYTY commented 5 months ago

~/polardbx-server/logs/polardbx 这个目录下应该能找到

jmbkeyes commented 5 months ago

2024-04-29 16:00:23.154 - [user=polardbx_root,host=10.0.0.181,port=62053,schema=polardbx] [TDDL] [V3] [len=30] SHOW /!50002 GLOBAL / STATUS [len=2] [] # [rt=282,rows=-1,type=000,err=4500,ts=1714377623154,mr=0,bid=-1,pid=-1,wt=TP,em=NONE,lcpu=0,lmem=0,lio=0,lnet=0.0,ur=0] # 17e4a86ba6c00000, tddl version: 5.4.18-20240428

ZSYTY commented 5 months ago

目前 PolarDB-X 对于这种 SHOW 关键字后出现带版本号的条件注释的语句会解析报错,后面我们会考虑修复。可以先使用其他客户端连接 PolarDB-X

jmbkeyes commented 5 months ago

好的,谢谢