一、环境描述
单机多实例,一主多从
mysql> show slave hosts; +-----------+----------------+------+-----------+--------------------------------------+ | Server_id | Host | Port | Master_id | Slave_UUID | +-----------+----------------+------+-----------+--------------------------------------+ | 3308 | 192.168.80.123 | 3308 | 3307 | e7bb816c-c823-11e6-abf0-00e06f68209e | | 3309 | 192.168.80.122 | 3309 | 3307 | c1039a79-c82b-11e6-ac23-00e06f68209e | | 10123 | 192.168.80.123 | 3306 | 3307 | a817b53d-5a23-11e6-9ea4-00e06f68209e | +-----------+----------------+------+-----------+--------------------------------------+ 3 rows in set (0.00 sec)
二、分析
Host 列不应该出现192.168.80.122 ,应该是192.168.80.123,判断应该和复制相关的参数设置的
不争取引起的。检查参数文件即可。
mysql> show variables like ‘report%‘; +-----------------+----------------+ | Variable_name | Value | +-----------------+----------------+ | report_host | 192.168.80.122 | | report_password | | | report_port | 3309 | | report_user | | +-----------------+----------------+ 4 rows in set (0.01 sec)
三、解决问题
- 直接在线修改
- 修改参数文件重启数据库,因为是一个slave 节点,没有太大影响
mysql> set global report_host=‘192.168.80.122‘; ERROR 1238 (HY000): Variable ‘report_host‘ is a read only variable
第一种方式不行,直接修改参数文件吧,然后重启搞定。
vi /etc/my3309.cnf report-host=192.168.80.123
保存退出,重启数据库
这几个参数之前没有细研究,正好可以好好查看一下官方文档。
http://dev.mysql.com/doc/refman/5.6/en/replication-options-slave.html#option_mysqld_report-host
Command-Line Format | --report-host=host_name |
||
System Variable | Name | report_host |
|
Variable Scope | Global | ||
Dynamic Variable | No | ||
Permitted Values | Type | string |
The host name or IP address of the slave to be reported to the master during slave registration. This value appears in the output of SHOW SLAVE HOSTS
on the master server. Leave the value unset if you do not want the slave to register itself with the master.
时间: 2024-10-07 19:41:26