当前位置:网站首页>MySQL master-slave replication
MySQL master-slave replication
2022-07-07 12:57:00 【LC181119】
1. Master slave replication architecture and principle
1.1MySQL Master-slave replication of
- Read / write separation
- Copy : Each node has the same data set , To expand outward , One way replication based on binary logs
1.2 The replication of
- Load balanced read operations
- Backup
- High availability and fail over
- The data distribution
- MySQL upgrade
1.3 Replication Architecture
One master multi slave replication Architecture
1.4 Master slave replication principle
- Master node :
- From the node :
1.5 Master slave replication features
- Asynchronous replication : Good client performance
- Inconsistency between master and slave data is common
2. Implement master-slave replication configuration
2.1 Master configuration :
[mysqld]
server-id=# # Recommended setting is ip The last digit of the address
log_bin
[mysqld]
server-id=# # Recommended setting is ip The last digit of the address
log-basename=master # optional , Set up datadir Log name in , Make sure you don't rely on host names
server-id Value range of1 to 4294967295 (>= MariaDB 10.2.2), The default value is 10 to 4294967295 (<= MariaDB 10.2.1), The default value is 0, If the slave node is 0, all master Will reject this slave The connection of
(3) View and copy from the file and location of the binary log
SHOW MASTER STATUS;
GRANT REPLICATION SLAVE ON *.* TO 'repluser'@'HOST' IDENTIFIED BY 'replpass';
#MySQL8.0 In two steps
mysql> create user [email protected]'10.0.0.%' identified by '123456';
mysql> grant replication slave on *.* to [email protected]'10.0.0.%';
2.2 From node configuration :
[mysqld]
server_id=# # Set a global only... For the current node ID Number
log-bin
read_only=ON # Set database read-only , in the light of supper user Invalid
relay_log=relay-log #relay log File path , The default value is hostname-relay-bin
relay_log_index=relay-log.index # The default value is hostname-relay-bin.index
CHANGE MASTER TO
MASTER_HOST='10.0.0.8',
MASTER_USER='repluser',
MASTER_PASSWORD='123456',
MASTER_PORT=3306,
MASTER_LOG_FILE='mariadb-bin.xxxxxx',
MASTER_LOG_POS=#;
边栏推荐
- 2022 polymerization process test question simulation test question bank and online simulation test
- What if the xshell evaluation period has expired
- Leetcode skimming: binary tree 23 (mode in binary search tree)
- Star Enterprise Purdue technology layoffs: Tencent Sequoia was a shareholder who raised more than 1billion
- 用mysql查询某字段是否有索引
- AUTOCAD——大于180度的角度标注、CAD直径符号怎么输入?
- Query whether a field has an index with MySQL
- 【从 0 开始学微服务】【02】从单体应用走向服务化
- [pytorch practice] write poetry with RNN
- What if does not match your user account appears when submitting the code?
猜你喜欢
[pytorch practice] write poetry with RNN
About IPSec
Polymorphism, final, etc
HZOJ #240. Graphic printing IV
[statistical learning methods] learning notes - Chapter 5: Decision Tree
ICLR 2022 | 基于对抗自注意力机制的预训练语言模型
人均瑞数系列,瑞数 4 代 JS 逆向分析
Sorting, dichotomy
Talk about four cluster schemes of redis cache, and their advantages and disadvantages
ICLR 2022 | pre training language model based on anti self attention mechanism
随机推荐
HZOJ #236. 递归实现组合型枚举
COSCon'22 社区召集令来啦!Open the World,邀请所有社区一起拥抱开源,打开新世界~
Lingyunguang of Dachen and Xiaomi investment is listed: the market value is 15.3 billion, and the machine is implanted into the eyes and brain
DHCP 动态主机设置协议 分析
About IPSec
[learn microservices from 0] [03] explore the microservice architecture
Creation and assignment of graphic objects
《ASP.NET Core 6框架揭秘》样章[200页/5章]
Cmu15445 (fall 2019) project 2 - hash table details
智云健康上市:市值150亿港元 SIG经纬与京新基金是股东
2022广东省安全员A证第三批(主要负责人)考试练习题及模拟考试
Day-20 file operation, recursive copy, serialization
Day-24 UDP, regular expression
File operation command
Session
Importance of database security
Cookie
Sample chapter of "uncover the secrets of asp.net core 6 framework" [200 pages /5 chapters]
有什么类方法或是函数可以查看某个项目的Laravel版本的?
Conversion from non partitioned table to partitioned table and precautions