当前位置:网站首页>Mysql5.7 master-slave hot standby settings on CentOS
Mysql5.7 master-slave hot standby settings on CentOS
2022-07-27 16:16:00 【Carrot eating crocodile】
mysql Installation :https://blog.csdn.net/qq_37135484/article/details/78594782
Premise : Make sure that servers can communicate with each other ping through , Mutual login .
1. Server introduction
Lord (master):192.168.78.154
from (slave):192.168.78.155
All users are root, The password for :123456
2. Main server configuration
1) Set up /etc/my.cnf
Main configuration server-id( Each server is required id only )
and log Binary system (log-bin=mysql-bin)
vim /etc/my.cnf
Add... At the end
server-id=1
log-bin=mysql-bin
binlog-ignore-db=mysql
The effect is shown in the small picture :

2) Set the user permissions of the slave server , It is convenient to read and copy the contents of the master server from the server users
grant replication slave,replication on *.* to 'root'@'192.168.78.155' identified by '123456';
User name and IP All are slave servers
May come across Your password does not satisfy the current policy requirements This mistake , Refer to the blog at this time https://blog.csdn.net/qq_37135484/article/details/98735515
3) Log in to the main server mysql View the status of the primary server
show master status;

Remember this time File and Position, It will be used when configuring the slave service
4) Refresh
flush privileges;

3. Slave server configuration
1) Configure from the server /etc/my.cnf

2) land mysql stay mysql Execute the following command at the command line :
CHANGE MASTER TO MASTER_HOST='192.168.78.154',MASTER_USER='root',MASTER_PASSWORD='123456',MASTER_LOG_FILE='mysql-bin.000004',MASTER_LOG_POS=763;
Among them MASTER_LOG_FILE=‘mysql-bin.000004’,MASTER_LOG_POS=763;
Execute the command corresponding to the main server above show master status; Display data 
Then start slave;
start slave;

3) see slave state
show slave status\G

If Slave_IO_Running and Slave_SQL_Running All items are yes It means that the master-slave replication configuration is successful , Otherwise failure , Don't panic about failure , There will be an error prompt below .
边栏推荐
- Test novice learning classic (with ideas)
- [sword finger offer] interview question 55 - Ⅰ / Ⅱ: depth of binary tree / balanced binary tree
- Short video mall system, system prompt box, confirmation box, click blank to close the pop-up box
- These questions~~
- Wechat applet personal number opens traffic master
- Mlx90640 infrared thermal imager temperature sensor module development notes (VII)
- Brief description of tenant and multi tenant concepts in cloud management platform
- [sword finger offer] interview question 46: translating numbers into strings - dynamic programming
- Vant UI toast and dialog use
- 2.2 basic elements of JMeter
猜你喜欢

Mapreduce实例(一):WordCount

Determine the exact type of data

Mapreduce实例(二):求平均值

Axure 安装图标字体元件库

webRTC中的coturn服务安装

编码技巧——全局异常捕获&统一的返回体&业务异常

Pychart import existing project

Ncnn reasoning framework installation; Onnx to ncnn

Coding skills - Global exception capture & unified return body & Business exception

时间序列——使用tsfresh进行分类任务
随机推荐
Penetration test - dry goods | 80 + network security interview experience post (interview)
Chapter I Marxist philosophy is a scientific world outlook and methodology
渗透测试-干货 | 80篇+网络安全面试经验帖(面试篇)
MySQL索引
Nacos
Excel提取重复项
一款功能强大的Web漏洞扫描和验证工具(Vulmap)
Text capture picture (Wallpaper of Nezha's demon child coming to the world)
百度图片复制图片地址
4位数的随机数据
实现浅拷贝和深拷贝+
Easy to understand, distinguish between ++i and I++
携手SiFive,格兰仕进军半导体领域!两款自研芯片曝光
DRF学习笔记(二):数据反序列化
[sword finger offer] interview question 52: the first common node of two linked lists - stack, hash table, double pointer
openwrt 编译驱动模块(在openwrt源代码外部任意位置编写代码,独立模块化编译.ko)
Have you ever used the comma operator?
项目优化个人感悟
Common problems of mobile terminal H5
[sword finger offer] interview question 51: reverse pairs in the array - merge sort