当前位置:网站首页>mysql 高可用双主同步
mysql 高可用双主同步
2022-06-28 23:57:00 【hay_lee】
1.首先两台服务器/虚拟机各安装mysql (网上很多,不再赘述)
2.修改两mysql容器的server-id(注意:两台机器mysql server-id 不能相同)
vi /etc/mysql/my.cnf
3.配置双主
mysql1/mysql2上分别授权root同步: GRANT REPLICATION SLAVE ON *.* to 'root'@'%'
mysql1/mysql2上先后执行:
stop slave;
reset slave all;
show master status; //重点查看File/ Position
Change master to master_host='对方 IP',master_user='root',master_password='123456',master_port=3306,master_log_file='master status File',master_log_pos= master status Position;
start slave;
show slave status\G //查看配置的slave是否正常
以上亲测mysql版本8.0;实现高可用可以加上keeplived做ip漂移,这样mysql1宕掉,可以自动切换到mysql2上。mysql1再次启动之后会把mysql2新变化的数据同步过来。反之也是如此。
边栏推荐
- Implementation of dynamic timer for quartz
- MySQL connection query is easy to understand
- Yes, use local_ setup. Bash or setup bash
- TypeScript -- 第一节:基础类型
- Is it safe and reliable to open a securities account in Yixue school?
- Reading notes of English grammar new thinking Basic Edition 2 (I)
- Edge extraction based on Halcon learning [2] circles Hdev routine
- Online yaml to JSON tool
- Three PWN questions
- Picture 64base transcoding and decoding
猜你喜欢
随机推荐
Summary of software testing cognition
Scrapy使用xlwt实现将数据以Excel格式导出的Exporter
Stm32f407----- register address name mapping analysis
Typescript -- Section 2: variable declaration
【软件分析】软件分析、设计与建模迭代式详解
EditText监听焦点
Typescript-- section 4: Functions
[Electronic Experiment 2] simple electronic doorbell
Machine learning 6-decision tree
Stm32f407 ------- RTC real time clock
stm32F407-------LCD
Along with the notes: methods simulating array like classes
Have you ever met a fake interview in a job interview? How to avoid?
Yyds dry goods inventory building knowledge map from scratch with neo4j (I)
Advice to friends
Stm32f407 ------- GPIO input experiment
11.目标分割
How to make two objects or arrays equal
PHP uses endroid/qrcode QR code to generate, and Gd library generates sharing posters
stm32F407-------RTC实时时钟








