当前位置:网站首页>In kuborad graphical interface, operate kubernetes cluster to realize master-slave replication in MySQL
In kuborad graphical interface, operate kubernetes cluster to realize master-slave replication in MySQL
2022-07-24 11:46:00 【Brother radan】
mysql Master-slave replication in
1: Description of master-slave replication
When the system concurrency is very large , Generally need mysql Master-slave replication of , hold mysql Divided into multiple services ,master Copy write operation ,slaver Responsible for reading operation .
2: The principle of replication
The original copy is from the server binlog, Log of binary operations , It is also the main scheme of database recovery
3: Set up the master server
because The slave server needs to read from the master server binlog attribute . Therefore, it is necessary to set the details of multiple master servers
[mysqld]
server_id = 1
character-set-server=utf8mb4
collation-server=utf8mb4_general_ci
log-bin=/var/lib/mysql/binlog
By looking at mysql Image of the container , Find out mysql The path of the core configuration file in the back left
/etc/mysql/mysql.conf.d/mysqld.cnf4.
4: Set up slave server
The configuration of the slave server is almost the same as that of the master server . stay k8s Middle configuration , Pay attention to various naming .
The configuration file is as follows :
[mysqld]
server_id = 2
character-set-server=utf8mb4
collation-server=utf8mb4_general_ci
Compared with the previous configuration of the master server
- server_id change
- period log-bin
5 : Check the main server status
Because the default is the primary server binlog Copy to slave server , So first use the following command to check show master status;
The results are as follows :
mysql> show master status;
±--------------±---------±-------------±-----------------±------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
±--------------±---------±-------------±-----------------±------------------+
| binlog.000008 | 154 | | | |
±--------------±---------±-------------±-----------------±------------------+
1 row in set (0.03 sec)
Use the following command to connect the slave server to the master server
CHANGE MASTER TO MASTER_HOST='jd-nysql1',
MASTER_PORT=3306, MASTER_USER='root',
MASTER_PASSWORD='password',
MASTER_LOG_FILE='binlog.000008',
MASTER_LOG_POS=154;
Note that the command configuration here should be consistent with that of the main server
Then enter the slave server , Execute the above command , If there is no error prompt , That means success
6: Start from server
Although the last step has , But the connection from the server is not started , All use the following command to start slave server mode start slave;
7: Check whether the master-slave server is connected smoothly
Execute the following command on the slave server , To check ;
show slave status \G
If the following options appear , The setting is successful ;
边栏推荐
- 【C和指针第14章】预处理器
- What is the difference between low code and no code?
- ctfshow ThinkPHP专题 1
- String - Sword finger offer 05. replace spaces
- Cgo+gsoap+onvif learning summary: 9. Go and C conduct socket communication and onvif protocol processing
- L1-043 阅览室
- 什么是云原生,云原生技术为什么这么火?
- 2 万字详解,吃透 ES!
- 哈希——18. 四数之和
- Semaphore详解
猜你喜欢

字符串——344.反转字符串
What is cloud native? Why is cloud native technology so popular?

JMeter if controller

Shell script "< < EOF" my purpose and problems

1184. 公交站间的距离 : 简单模拟题

1184. Distance between bus stops: simple simulation problem

Record a garbage collection and analysis of gceasy
![MOS tube - Notes on rapid recovery application (I) [principle]](/img/a1/8427c9b1d0ea0cecce820816510045.png)
MOS tube - Notes on rapid recovery application (I) [principle]
![[deserialization vulnerability-02] principle test and magic method summary of PHP deserialization vulnerability](/img/03/f80c82d009d21a938911a155dddf6b.png)
[deserialization vulnerability-02] principle test and magic method summary of PHP deserialization vulnerability

[TA frost wolf umay - "hundred people plan] Figure 3.3 surface subdivision and geometric shader large-scale grass rendering
随机推荐
Use of getchar
Shell script "< < EOF" my purpose and problems
JPS has no namenode and datanode reasons
离散分布常用公式及应用场景
Microservice - eruka
stream流
[deserialization vulnerability-02] principle test and magic method summary of PHP deserialization vulnerability
【反序列化漏洞-01】序列化与反序列化简介
【网络空间安全数学基础第3章】同余
三、MFC消息映射机制实现原理
栈顶与栈底
Optimization method of "great mathematics for use" -- optimal design of Cascade Reservoir Irrigation
Dry goods sharing - taking over a new data team as a lead - Problem Inventory and insights findings
Detailed OSPF configuration of layer 3 switch / router [Huawei ENSP experiment]
Sorting out the ideas of data processing received by TCP server, and the note of select: invalid argument error
字符串——344.反转字符串
cgo+gSoap+onvif学习总结:9、go和c进行socket通信进行onvif协议处理
Chapter 1 Introduction
Two important laws about parallelism
CCF 1-2 question answering record (2)