原创:知数堂
上一篇文章,我们详细介绍了 Xenon 实现 MySQL 高可用架构的部署过程。接下来本篇将介绍 Xenon 的常用操作,帮助大家在完成环境搭建之后,能把 Xenon 熟练的用起来,以更好的对 MySQL 高可用架构进行管理。
| 1 启动集群
1.1 启动 MySQL
# db1:
[mysql@db1 ~]$ nohup mysqld_safe --defaults-file=/etc/my.cnf &
[1] 5526
[mysql@db1 ~]$ nohup: ignoring input and appending output to ‘nohup.out’
# db2:
[mysql@db2 ~]$ nohup mysqld_safe --defaults-file=/etc/my.cnf &
[1] 3637
[mysql@db2 ~]$ nohup: ignoring input and appending output to 'nohup.out'
mysql –uroot –p # 开启增强半同步
set global rpl_semi_sync_slave_enabled=1;
stop slave io_thread;
start slave io_thread;
db3 的启动步骤同 db2。
1.2 启动 Xenon
db1:
[mysql@db1 ~]$ cd /usr/local/xenon/bin/
[mysql@db1 bin]$ ./xenon -c /etc/xenon/xenon.json > /etc/xenon/log/xenon.log 2>&1 &
db2、db3 的启动方式同 db1。
注意:当 MySQL 未启动时,启动 Xenon 会自动启动 MySQL。
1.3 检查半同步复制
启动时,需要检查半同步复制是否开启。
(product)root@localhost [(none)]> show variables like '%semi%';
+-------------------------------------------+------------+
| Variable_name | Value |
+-------------------------------------------+------------+
| rpl_semi_sync_master_enabled | ON |
| rpl_semi_sync_master_timeout | 10000 |
| rpl_semi_sync_master_trace_level | 32 |
| rpl_semi_sync_master_wait_for_slave_count | 1 |
| rpl_semi_sync_master_wait_no_slave | ON |
| rpl_semi_sync_master_wait_point | AFTER_SYNC |
| rpl_semi_sync_slave_enabled | OFF |
| rpl_semi_sync_slave_trace_level | 32 |
……
主要参数:主节点rpl_semi_sync_master_enabled 的状态为 ON,从节点 rpl_semi_sync_slave_enabled 的状态为 ON,表示半同步复制正常开启。
| 2 帮助命令
通过 xenoncli 的帮助命令查看可选的命令。
[mysql@db1 bin]$ ./xenoncli help
A simple command line client for xenon
Usage:
xenoncli [command]
Available Commands:
cluster cluster related commands
init init the xenon config file
mysql mysql related commands
perf perf related commands
raft raft related commands
version Print the version number of xenon client
xenon xenon related commands
Use "xenoncli [command] --help" for more information about a command.
举例说明,查看 cluster 的操作命令帮助。
[mysql@db1 bin]$ ./xenoncli cluster -h
cluster related commands
Usage:
xenoncli cluster [command]
Available Commands:
add add peers to leader(if there is no leader, add to local)
gtid show cluster gtid status
log merge cluster xenon.log from logdir
mysql show cluster mysql status
raft show cluster raft status
remove remove peers from leader(if there is no leader, remove from local)
status show cluster status
xenon show cluster xenon status
Use "xenoncli cluster [command] --help" for more information about a command.
| 3 查看集群
3.1 查看状态
xenoncli clus

本文详细介绍了 Xenon 实现 MySQL 高可用架构的常用操作,包括启动集群、检查半同步复制、添加/删除节点、重建及手动 Failover 等,帮助管理员更好地管理和维护 MySQL 集群。
最低0.47元/天 解锁文章
692

被折叠的 条评论
为什么被折叠?



