前期准备
安装Atlas
请查看官方文档
数据库配置
1.1台master2台slave,都要配置相同的用户名密码,且都要可以远程访问
2.分别进入3台服务器,创建相同的用户名密码,创建数据库test,设置权限
- CREATE USER 'test'@'%' IDENTIFIED BY 'test123';
- CREATE USER 'test'@'localhost' IDENTIFIED BY 'test123';
- grant all privileges on test.* to 'test'@'%' identified by 'test123';
- grant all privileges on test.* to 'test'@'localhost' identified by 'test123';
- flush privileges;
3.主从数据库配置
1.配置master服务器
- [mysqld]
- # 一些其他配置
- ...
- #主从复制配置
- innodb_flush_log_at_trx_commit=1
- sync_binlog=1
- #需要备份的数据库
- binlog-do-db=test
- #不需要备份的数据库
- binlog-ignore-db=mysql
- #启动二进制文件
- log-bin=mysql-bin
- #服务器ID
- server-id=1
- # Disabling symbolic-links is recommended to prevent assorted security risks
- symbolic-links=0
- mysql -uroot -p123456
- grant replication slave on *.* to 'test'@'127.0.0.1' identified by 'test123';
- mysql> show master status;
- +------------------+----------+--------------+------------------+
- | File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
- +------------------+----------+--------------+------------------+
- | mysql-bin.000002 | 17620976 | test | mysql |
- +------------------+----------+--------------+------------------+
- 1 row in set (0.00 sec)
2.配置两台salve服务器
- [mysqld]
- # 一些其他配置
- ...
- # 几台服务器不能一样
- server-id=2
- # Disabling symbolic-links is recommended to prevent assorted security risks
- symbolic-links=0
- # master数据库的ip
- mysql> change master to master_host='192.168.20.122',
- # master的用户名
- master_user='buck',
- # 密码
- master_password='hello',
- # 端口
- master_port=3306,
- # master数据库的`File `
- master_log_file='mysql-bin.000002',
- # master数据库的`Position`
- master_log_pos=17620976,
- master_connect_retry=10;
- mysql> start slave;
- Query OK, 0 rows affected (0.00 sec)
- mysql> show slave status \G;
(责任编辑:综合)
康健国际医疗(03886.HK)公布消息:预计年度综合亏损约2.55亿港元
中交集团投建的柬埔寨首条高速公路建成通车 总投资额20.19亿美元
国内首个“站城融合”现代铁路客站开通运营 设计时速350公里
中远海运完成核电项目核心设备交付 有效满足客户对工期节点的要求
向家坝灌区工程15公里引水隧道项目全部完成 促进川南经济区快速崛起
我国最长盾构高速公路隧道首段顺利贯通 北京市交通服务水平再提升
青海扁门高速公路盘坡至浩门段正式通车 线路穿越“百里油菜花海”