当前位置:网站首页>Mysql5.7 master-slave database deployment (offline deployment)
Mysql5.7 master-slave database deployment (offline deployment)
2022-07-25 10:24:00 【Puffiness is also strong】
Mysql5.7.24tar
link :https://pan.baidu.com/s/1W21ew4LY_i3AGMzALho1zw?pwd=1234
Extraction code :1234
Linux CentOS7 7.6_1810
link :https://pan.baidu.com/s/1NV4MjfORIj290Q3scy6iYQ?pwd=pzse
Extraction code :pzse
Mind mapping tools
free , Succinct can be “ Mind mapping ” Copy and paste the article to get a mind map ( No joy, no spray. )

You need two databases with the same version mysql
2. Installation steps
When the formal environment is deployed , Keep the data of master database and slave database consistent in advance
Main library
modify mysql The configuration file :vi /etc/my.cnf
newly added :
server-id = 1 Unique code of the service
log-bin = mysql-bin Turn on mysql,binlog function
binlog_format = ROW binlog The way of recording (ROW Record each line )
binlog_row_image = minimal Reduce the amount of logging , Only the affected columns are recorded
binlog-do-db = The name of the database that needs data synchronization Specify the database name that needs data synchronization

Restart the database :service mysql restart
Enter the database background :cd /usr/local/mysql/bin
Log on to the terminal :./mysql -uroot -p123456( Here is mysql Account and password )
Create an account and password for the synchronization database :
grant replication slave on *.* to ' user id'@' From database ip Address ' identified by ' User password ';
![]()
Refresh database :flush privileges;
Check the database status :show master status\G;
Record the values in the figure , From the library, you need to use

Slave Library
modify mysql To configure :vi /etc/my.cnf
newly added :
server-id = 2 Unique code of the service
log-bin = mysql-bin Turn on mysql,binlog function
binlog_format = ROW binlog The way of recording (ROW Record each line )
binlog_row_image = minimal Reduce the amount of logging , Only the affected columns are recorded
binlog-do-db = The name of the database that needs data synchronization Specify the database name that needs data synchronization

Restart the database :service mysql restart
Enter the database background :cd /usr/local/mysql/bin
Log on to the terminal :./mysql -uroot -p123456( Here is mysql Account and password )
Set the login account and password of the main database 、 Synchronize location information, etc :
change master to master_host=’ Main library IP Address ’,master_user=’ user id’,master_password=’ User password ’,master_log_file=’ Put the main warehouse File Fill in the value after ’,master_log_pos=Position Fill in the value after
![]()
Turn on the synchronization function :start slave;
View synchronization status :show slave status\G;
( As shown in the figure, the master-slave configuration is successful )

Enter the visualization tool test synchronization :
Any new table created in the set database will be synchronized into the slave database
Modifying any information will also be synchronized into the slave database

Mysql The master-slave is to synchronize the data of the master database to the slave database in real time , It can also be understood that it will be active and standby , In the active / standby architecture system, only the primary database provides services , The slave library is only used for real-time data backup ; Another concept that can be extended here is the dual master architecture , Dual master architecture is also called dual active architecture in storage , Common in 3DC( Three centers in different places )
3DC: It is divided into production business centers , Local disaster backup center and remote disaster backup center , Three centers are three data centers with the same infrastructure ( Computer room ).
边栏推荐
猜你喜欢
随机推荐
Angr(九)——angr_ctf
多线程——Runnable接口,龟兔赛跑
bug要素
Yiwen society, three necessary packet capturing tools for hackers
strut2 表单标签
四、TestFixture测试夹具,或者测试固件
Small knowledge of common classes
多线程——死锁和synchronized
SQL topic sorting
1、 The difference between unittest framework and pytest framework
Angr(三)——angr_ctf
复现 SSL_Anti-spoofing, 使用 wav2vec 2.0 和数据增强的自动说话人认证的欺骗攻击与深度伪造检测
GUI窗口
Swing component Icon
IO流中的输出流
简易加法计算器
Multithreading - five states
Duplicate SSL_ Anti spoofing, spoofing attacks and deep forgery detection using wav2vec 2.0 and data enhanced automatic speaker authentication
UE4 碰撞(Collsion)
IDEA整体字体大小修改







