TDSQL 集群 noshard 实例之间搭建 主从复制 The server is not configured as slave 解决方法
作者:
dave
1 故障说明
在2个noshard 实例之间搭建主从复制, 操作步骤参考:
MariaDB 主从复制 搭建手册
https://www.cndba.cn/dave/article/2659
但是配置从库时报如下错误:
[dave@www.cndba.cn install]# ./jmysql.sh 4008
cmd: e
/data1/tdengine/data/4008/prod/mysql.sock
/data/tdsql_run/4008/percona-5.7.17
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or /g.
Your MySQL connection id is 1589
Server version: 5.7.17-11-V2.0R540D002-20191226-1152-log Source distribution
Copyright (c) 2009-2016 Percona LLC and/or its affiliates
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '/h' for help. Type '/c' to clear the current input statement.
mysql> change master to master_host='192.168.31.61',master_port=4002,master_user='slave',master_password='slave',master_log_file='binlog.000002',master_log_pos=44231066;
Query OK, 0 rows affected, 2 warnings (0.18 sec)
mysql> show warnings;
+-------+------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Level | Code | Message |
+-------+------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Note | 1759 | Sending passwords in plain text without SSL/TLS is extremely insecure. |
| Note | 1760 | Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information. |
+-------+------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
2 rows in set (0.01 sec)
mysql> start slave;
ERROR 1200 (HY000): The server is not configured as slave; fix in config file or with CHANGE MASTER TO
mysql> show slave status;
Empty set (0.00 sec)
这里提示slave 参数设置失败,参数没有写入成功,所以slave 启动失败,提示没有配置slave 参数。 实际上我们已经执行了change master 命令,虽然执行没有报错,但是确实失败的。
2 解决方法
实际上,这里是缺少了参数CHANNEL 。 因为我尝试直接手工往mysql.slave_master_info表里添加值时提示channel 不为能为空。
所以加上FOR CHANNEL “master_1”; 后在执行,执行是一样,但是值可以写入到配置表了。 slave 也可以正常启动了。
[dave@www.cndba.cn install]# ./jmysql.sh 4008
cmd: e
/data1/tdengine/data/4008/prod/mysql.sock
/data/tdsql_run/4008/percona-5.7.17
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or /g.
Your MySQL connection id is 16350
Server version: 5.7.17-11-V2.0R540D002-20191226-1152-log Source distribution
Copyright (c) 2009-2016 Percona LLC and/or its affiliates
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '/h' for help. Type '/c' to clear the current input statement.
mysql>
mysql> change master to master_host='192.168.31.61',master_port=4002,master_user='slave',master_password='slave',master_log_file='binlog.000001',master_log_pos=3414767 FOR CHANNEL "master_1";
Query OK, 0 rows affected, 2 warnings (0.23 sec)
mysql> start slave FOR CHANNEL "master_1";
Query OK, 0 rows affected (0.35 sec)
mysql> show slave status /G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.31.61
Master_User: slave
Master_Port: 4002
Connect_Retry: 60
Master_Log_File: binlog.000001
Read_Master_Log_Pos: 3436217
Relay_Log_File: relay-master_1.000002
Relay_Log_Pos: 21759
Relay_Master_Log_File: binlog.000001
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 3436217
Relay_Log_Space: 21957
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 524113826
Master_UUID: 3422532c-eee2-11eb-8a1b-000c29be8288
Master_Info_File: mysql.slave_master_info
SQL_Delay: 0
SQL_Remaining_Delay: NULL
Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates
Master_Retry_Count: 86400
Master_Bind:
Last_IO_Error_Timestamp:
Last_SQL_Error_Timestamp:
Master_SSL_Crl:
Master_SSL_Crlpath:
Retrieved_Gtid_Set: 3422532c-eee2-11eb-8a1b-000c29be8288:9552-9611
Executed_Gtid_Set: 3422532c-eee2-11eb-8a1b-000c29be8288:4620-4621:9552-9611,
c71da6a5-eee9-11eb-9a98-000c29be8288:1-9523
Auto_Position: 0
Replicate_Rewrite_DB:
Channel_Name: master_1
Master_TLS_Version:
1 row in set (0.00 sec)
mysql>
mysql> select * from mysql.slave_master_info /G
……
*************************** 3. row ***************************
Number_of_lines: 25
Master_log_name: binlog.000001
Master_log_pos: 3414767
Host: 192.168.31.61
User_name: slave
User_password: slave
Port: 4002
Connect_retry: 60
Enabled_ssl: 0
Ssl_ca:
Ssl_capath:
Ssl_cert:
Ssl_cipher:
Ssl_key:
Ssl_verify_server_cert: 0
Heartbeat: 1800
Bind:
Ignored_server_ids: 0
Uuid: 3422532c-eee2-11eb-8a1b-000c29be8288
Retry_count: 86400
Ssl_crl:
Ssl_crlpath:
Enabled_auto_position: 0
Channel_name: master_1
Tls_version:
3 rows in set (0.01 sec)
mysql>
版权声明:本文为博主原创文章,未经博主允许不得转载。