当前位置:网站首页>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新变化的数据同步过来。反之也是如此。
边栏推荐
- After eight years of testing and opening experience and interview with 28K company, hematemesis sorted out high-frequency interview questions and answers
- Have you ever met a fake interview in a job interview? How to avoid?
- Stm32f407------- external interrupt
- Stm32f407-------- NVIC interrupt priority management
- 炒股开户万一免五是靠谱么,安全么
- Stm32f407----- register address name mapping analysis
- 三个pwn题
- Easy to use free ppt template
- Stm32f407 ------ running lamp and buzzer
- What will be done after digital IC Verification?
猜你喜欢

12.物体检测Mask-Rcnn
![[machine learning] numerical analysis 02 -- finding roots of arbitrary equations](/img/fd/ec82a50017e692ac90f6e8739b28d3.jpg)
[machine learning] numerical analysis 02 -- finding roots of arbitrary equations

Stm32f407 ------ running lamp and buzzer
![[opencv] - linear filtering: box filtering, mean filtering, Gaussian filtering](/img/1d/3a46517cbfa90005a15d7858d81ca9.png)
[opencv] - linear filtering: box filtering, mean filtering, Gaussian filtering

How many locks are added to an update statement? Take you to understand the underlying principles

Phoenix installation tutorial

Software testing tools: complete and precise

"Five considerations" for safe use of the Internet

MapReduce case
![[Electronic Experiment 2] simple electronic doorbell](/img/40/227f9ac1f427c1435e0e3aa02640b1.png)
[Electronic Experiment 2] simple electronic doorbell
随机推荐
scrapy保存数据到excel:利用openpyxl创建多张表,设置Excel行数限制
Association line exploration, how to connect the two nodes of the flow chart
三个pwn题
After eight years of testing and opening experience and interview with 28K company, hematemesis sorted out high-frequency interview questions and answers
urllib. Parse parses the parameters in the URL connection
The second session of question swiping and clock out activity -- solving the switching problem with recursion as the background (2)
stm32F407-------IO引脚复用映射
随笔记:重新认识 else if
What will be done after digital IC Verification?
Is it safe to open a stock account on the Internet?
MySQL connection query is easy to understand
Leetcode 178 Score ranking (June 27, 2022)
Stm32f407------- external interrupt
[C Prime plus chapitre II Questions de programmation après la Classe]
I can't sleep
Add the premise of ganggan
SQL note 2 [MySQL]
MNIST handwritten numeral recognition demo based on pytorch framework
请问指南针股票软件可靠吗?在上面交易股票安全吗?
pymysql. Error get error code and specific error information