hanchuanchuan / goInception

一个集审核、执行、备份及生成回滚语句于一身的MySQL运维工具
https://hanchuanchuan.github.io/goInception/
GNU General Public License v3.0
1.59k stars 545 forks source link

Slave_IO_Running: No, Slave_SQL_Running: No. Please make sure replication runs before using gh-ost. #647

Open yuexiaofengqing opened 1 month ago

yuexiaofengqing commented 1 month ago

描述 当我们今天调用时,前边几个调用正常,后边几个调用遇到了error: level=error msg="Replication on 121.37.129.7:3306 is broken: Slave_IO_Running: No, Slave_SQL_Running: No. Please make sure replication runs before using gh-ost." file=osc.go func=mysqlExecuteAlterTableGhost line=771 所有调用的目标数据库实例是同一个,但是库名和SQL内容不一样。请问是什么原因导致的出现此报错? Note:华为云RDS的show slave status;查看到的Slave_IO_Running: No, Slave_SQL_Running: No.一直是这个状态。

重现 无法重现

环境

日志 time="2024/05/14 15:21:31.993" level=error msg="con:11207 解析失败! line 1 column 25 near \"fauth\" " file=session_inception.go func=executeInc line=219 time="2024/05/14 15:21:31.993" level=error msg=" fauth" file=session_inception.go func=executeInc line=220 time="2024/05/14 15:21:31.993" level=info msg="[GENERAL_LOG] con:11207 user:root@127.0.0.1 sql:/*--user=dbafabu;--password=;--host=121.37.129.7;--check=1;--port=3306;--real_row_count=true;--trans=1000;/ inception_magic_start; fauth; use fauth;ALTER TABLE manual_auth ADD INDEX IDX_CREATETIME(createTime) USING BTREE, ADD INDEX IDX_AUDITOR(auditor) USING BTREE;; inception_magic_commit; " file=session.go func=logQuery line=1610 time="2024/05/14 15:21:31.993" level=info msg="con:11207 close connection" file=server.go func=func1 line=321 time="2024/05/14 15:21:31.998" level=info msg="con:11208 new connection 127.0.0.1:36420" file=server.go func=onConn line=319 time="2024/05/14 15:21:31.998" level=info msg="[GENERAL_LOG] con:11208 user:root@127.0.0.1 sql:SET AUTOCOMMIT = 0" file=session.go func=logQuery line=1610 time="2024/05/14 15:21:32.004" level=info msg="con:11209 new connection 127.0.0.1:36426" file=server.go func=onConn line=319 time="2024/05/14 15:21:32.005" level=info msg="[GENERAL_LOG] con:11209 user:root@127.0.0.1 sql:SET AUTOCOMMIT = 0" file=session.go func=logQuery line=1610 time="2024/05/14 15:21:32.027" level=error msg="con:11208 解析失败! line 1 column 23 near \"ecs\" " file=session_inception.go func=executeInc line=219 time="2024/05/14 15:21:32.027" level=error msg=" ecs" file=session_inception.go func=executeInc line=220 time="2024/05/14 15:21:32.027" level=info msg="[GENERAL_LOG] con:11208 user:root@127.0.0.1 sql:/--user=dbafabu;--password=;--host=121.37.129.7;--check=1;--port=3306;--real_row_count=true;--trans=1000;/ inception_magic_start; ecs; use ecs;CREATE INDEX IDX_CONTRACTID USING BTREE ON sign_record (contractId);; inception_magic_commit; " file=session.go func=logQuery line=1610 time="2024/05/14 15:21:32.027" level=info msg="con:11208 close connection" file=server.go func=func1 line=321 time="2024/05/14 15:21:32.038" level=info msg="con:11210 new connection 127.0.0.1:36438" file=server.go func=onConn line=319 time="2024/05/14 15:21:32.038" level=info msg="[GENERAL_LOG] con:11210 user:root@127.0.0.1 sql:SET AUTOCOMMIT = 0" file=session.go func=logQuery line=1610 time="2024/05/14 15:21:32.061" level=info msg="con:11209 use gh-ost: ALTER TABLE manual_auth\nADD INDEX IDX_CREATETIME(createTime) USING BTREE,\nADD INDEX IDX_AUDITOR(auditor) USING BTREE" file=session_inception.go func=executeRemoteStatement line=1449 time="2024/05/14 15:21:32.062" level=info msg="Migrating fauth.manual_auth" file=migrator.go func=Migrate line=356 time="2024/05/14 15:21:32.078" level=info msg="connection validated on 121.37.129.7:3306" file=utils.go func=ValidateConnection line=89 time="2024/05/14 15:21:32.082" level=info msg="User has REPLICATION CLIENT, REPLICATION SLAVE privileges, and has ALL privileges on fauth." file=inspect.go func=validateGrants line=261 time="2024/05/14 15:21:32.086" level=info msg="binary logs validated on 121.37.129.7:3306" file=inspect.go func=validateBinlogs line=364 time="2024/05/14 15:21:32.086" level=info msg="Inspector initiated on host-172-16-16-20:3306, version 5.7.44-240100-log" file=inspect.go func=InitDBConnections line=72 time="2024/05/14 15:21:32.088" level=info msg="Table found. Engine=InnoDB" file=inspect.go func=validateTable line=422 time="2024/05/14 15:21:32.088" level=warning msg="--skip-foreign-key-checks provided: will not check for foreign keys" file=inspect.go func=validateTableForeignKeys line=430 time="2024/05/14 15:21:32.096" level=info msg="Estimated number of rows via EXPLAIN: 36727" file=inspect.go func=estimateTableRowsViaExplain line=531 time="2024/05/14 15:21:32.102" level=info msg="Recursively searching for replication master" file=inspect.go func=getMasterConnectionConfig line=768 time="2024/05/14 15:21:32.113" level=info msg="Tearing down inspector" file=migrator.go func=teardown line=1384 time="2024/05/14 15:21:32.113" level=error msg="Replication on 121.37.129.7:3306 is broken: Slave_IO_Running: No, Slave_SQL_Running: No. Please make sure replication runs before using gh-ost." file=osc.go func=mysqlExecuteAlterTableGhost line=771 time="2024/05/14 15:21:32.115" level=info msg="[GENERAL_LOG] con:11209 user:root@127.0.0.1 sql:/*--user=dbafabu;--password=*****;--host=121.37.129.7;--execute=1;--port=3306;--real_row_count=true;--trans=1000;*/ inception_magic_start; use fauth; ALTER TABLE manual_auth ADD INDEX IDX_CREATETIME(createTime) USING BTREE, ADD INDEX IDX_AUDITOR(auditor) USING BTREE; inception_magic_commit; " file=session.go func=logQuery line=1610 time="2024/05/14 15:21:32.121" level=info msg="con:11209 close connection" file=server.go func=func1 line=321

zmix999 commented 1 month ago

这格式有问题吧,inception_magic_start; fauth; use fauth; 正常是inception_magic_start;use db1;

yuexiaofengqing commented 1 month ago

这个格式不影响,因为前面的几个也是这种格式,但是执行成功了。

zmix999 commented 1 month ago

inception_magic_start; fauth; use fauth; ALTER TABLE manual_auth ADD INDEX IDX_CREATETIME(createTime) USING BTREE, ADD INDEX IDX_AUDITOR(auditor) USING BTREE;; inception_magic_commit; 这种格式语法都校验不通过,你能执行成功?