当前位置:网站首页>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新变化的数据同步过来。反之也是如此。
边栏推荐
- Advice to friends
- [opencv] - linear filtering: box filtering, mean filtering, Gaussian filtering
- What is the lifecycle of automated testing?
- PHP 使用endroid/qrcode 二维码生成, GD库生成分享海报
- 转载:VTK笔记-裁剪分割-不规则闭合圈选裁剪-vtkSelectPolyData类(黑山老妖)
- 《英语语法新思维 基础版2》读书笔记(一)
- stm32F407-------LCD
- Typescript -- Section 6 generic
- Yyds dry goods inventory building knowledge map from scratch with neo4j (I)
- Blue Bridge Cup top ten common heaven level skill - breath of water The type of one recursion
猜你喜欢

Blue Bridge Cup top ten common heaven level skill - breath of water The type of one recursion

Machine learning 4-dimension reduction technology

LinkedIn datahub - experience sharing

What pitfalls should be avoided in the job interview for the operation post in 2022?

stm32F407-------LCD
![[Electronic Experiment 2] simple electronic doorbell](/img/40/227f9ac1f427c1435e0e3aa02640b1.png)
[Electronic Experiment 2] simple electronic doorbell

一条update语句到底加了多少锁?带你深入理解底层原理

这玩意叫跳表?
![[opencv] - linear filtering: box filtering, mean filtering, Gaussian filtering](/img/1d/3a46517cbfa90005a15d7858d81ca9.png)
[opencv] - linear filtering: box filtering, mean filtering, Gaussian filtering

【LeetCode】21. Merge two ordered linked lists - go language solution
随机推荐
What pitfalls should be avoided in the job interview for the operation post in 2022?
Form verification problem - El select (solution to automatically trigger verification on initialization page)
转载:VTK笔记-裁剪分割-不规则闭合圈选裁剪-vtkSelectPolyData类(黑山老妖)
Leetcode 178 Score ranking (June 27, 2022)
[buuctf.reverse] 131-135
stm32F407-------时钟系统(SystemInit时钟初始化、Systick滴答定时器)
Common mistakes in software testing
PHP函数file_get_contents与操作系统的内存映射
Stm32f407------- external interrupt
三个pwn题
【软件分析】软件分析、设计与建模迭代式详解
Behaviortree in ros2
Machine learning 4-dimension reduction technology
pymysql. Error get error code and specific error information
10、YOLO系列
小白创业做电商,选对商城系统很重要!
What are some tips to improve your interview success rate?
好用免费的PPT模板
Auto encoder
Software testing tools: complete and precise