|
使用 msyql-unity 工具 msyqlrpladmin 工具 mysqlrplshow 工具。都无法显示当前的主机连接的从机是哪写。 仔细查找官方档之后才发现mysql 的从机 还没有配置完全。这里放出全部配置以供参考。 [mysqld1] #skip-grant-tables user=mysql pid-file=/var/lib/mysql3307/mysql1db.pid port=3307 socket=/var/lib/mysql3307/mysql3307.sock datadir=/var/lib/mysql3307/ log-error=/var/log/mysql1.log log-bin expire_logs_days=7 server_id=1 log_slave_updates=on
enforce_gtid_consistency=on gtid_mode=on
#report_port=3309
[mysqld2] #skip-grant-tables user=mysql pid-file=/var/lib/mysql3308/mysql2db.pid port=3308 socket=/var/lib/mysql3308/mysql3308.sock datadir=/var/lib/mysql3308/ log-error=/var/log/mysql2.log server_id=2 log-bin expire_logs_days=7 log_slave_updates=on
enforce_gtid_consistency=on gtid_mode=on report_host=127.0.0.1 report_port=3308 report_user=root report_password='123'
[mysqld3] #skip-grant-tables user=mysql pid-file=/var/lib/mysql3309/mysql3db.pid port=3309 socket=/var/lib/mysql3309/mysql3309.sock datadir=/var/lib/mysql3309/ log-error=/var/log/mysql3.log server_id=3 log-bin expire_logs_days=7
log_slave_updates=on
enforce_gtid_consistency=on gtid_mode=on
report_host=127.0.0.1 report_port=3309 report_user=root report_password='123'
[mysqld4] #skip-grant-tables user=mysql pid-file=/var/lib/mysql3310/mysql4db.pid port=3310 socket=/var/lib/mysql3310/mysql3310.sock datadir=/var/lib/mysql3310/ log-error=/var/log/mysql4.log server_id=4 log-bin expire_logs_days=7
新加的参数 这些参数是开启guuid 的唯一标示符。 配置完master mysql> CHANGE MASTER TO -> MASTER_HOST = 'host_name', -> MASTER_PORT = port_num, -> MASTER_USER = 'user_name', -> MASTER_PASSWORD = 'password', -> MASTER_LOG_FILE = 'master_log_name', -> MASTER_LOG_POS = master_log_pos;
转换使用GUUID 唯一标示符管理事务。 CHANGE MASTER TO MASTER_AUTO_POSITION=1;
在msyql1 -5 添加一下选项,重启服务器。 log_slave_updates=on
enforce_gtid_consistency=on gtid_mode=on
这些选项是报告给master 主机的,这些参数设置好以后mysql-unity 工具才能显示主机相关联的从机状态。
report_host=127.0.0.1 report_port=3309 report_user=root report_password='123'
配置这些参数 后才能使用msyqlsqlrpladmin socket.gaierror: [Errno -2] Name or service not known [root@mysqldb ~]# mysqlrpladmin --master=root:123@127.0.0.1:3307 --slaves=root:123@127.0.0.1:3308,root:123@127.0.0.1:3309 elect; WARNING: Using a password on the command line interface can be insecure. # Checking privileges. # Electing candidate slave from known slaves. # Best slave found is located on 127.0.0.1:3308. # ...done.
|
|