当前位置:网站首页>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新变化的数据同步过来。反之也是如此。
边栏推荐
- Analysis of CSRF Cross Site Request Forgery vulnerability
- MapReduce case
- ES6模块
- 一条update语句到底加了多少锁?带你深入理解底层原理
- LinkedIn datahub - experience sharing
- window10 phpstudy 安装redis扩展
- Scrapy使用xlwt实现将数据以Excel格式导出的Exporter
- Solve the problem of Chinese parsing by configparser
- Hesitating root sound
- What is the lifecycle of automated testing?
猜你喜欢

Association line exploration, how to connect the two nodes of the flow chart

剑指 Offer 12. 矩阵中的路径

Typescript-- section 4: Functions

MapReduce case

Yyds dry goods inventory building knowledge map from scratch with neo4j (I)

stm32F407-------NVIC中断优先级管理

6.28 学习内容

Stm32f407----- capacitive touch button

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

Have you ever met a fake interview in a job interview? How to avoid?
随机推荐
PHP 使用endroid/qrcode 二维码生成, GD库生成分享海报
Rongyun communication solution solves the pain points of enterprise communication
Yyds dry goods inventory building knowledge map from scratch with neo4j (I)
Reading notes of English grammar new thinking Basic Edition 2 (I)
What will be done after digital IC Verification?
IO playback function of FIO
Be on the list again! Know that Chuangyu was selected as one of the top 50 competitive enterprises in China's network security industry in 2022
[machine learning] numerical analysis 02 -- finding roots of arbitrary equations
6.28 learning content
关联线探究,如何连接流程图的两个节点
Give you a project, how will you carry out performance testing (I)
Learn binary tree like this
Phoenix installation tutorial
Have you ever met a fake interview in a job interview? How to avoid?
MapReduce case
[SSM] an error is reported that the user name of the access denied for user 'WYF' @ 'localhost' (using password: yes) data becomes the user name of the computer
Summary of software testing cognition
随笔记:定义setter和getter的三种方式
转载:VTK笔记-裁剪分割-不规则闭合圈选裁剪-vtkSelectPolyData类(黑山老妖)
Three PWN questions