真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

MySQL5.5級聯(lián)復(fù)制配置的示例分析-創(chuàng)新互聯(lián)

這篇文章主要介紹MySQL 5.5級聯(lián)復(fù)制配置的示例分析,文中介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們一定要看完!

員工經(jīng)過長期磨合與沉淀,具備了協(xié)作精神,得以通過團隊的力量開發(fā)出優(yōu)質(zhì)的產(chǎn)品。創(chuàng)新互聯(lián)堅持“專注、創(chuàng)新、易用”的產(chǎn)品理念,因為“專注所以專業(yè)、創(chuàng)新互聯(lián)網(wǎng)站所以易用所以簡單”。公司專注于為企業(yè)提供網(wǎng)站制作、成都網(wǎng)站設(shè)計、微信公眾號開發(fā)、電商網(wǎng)站開發(fā),小程序制作,軟件按需設(shè)計等一站式互聯(lián)網(wǎng)企業(yè)服務(wù)。

如下圖,A節(jié)點是B節(jié)點的Master,B節(jié)點是C節(jié)點的Master
A -> B -> C

在已有的A -> B復(fù)制環(huán)境中,添加級聯(lián)slave節(jié)點C
--各節(jié)點IP如下
A 192.168.78.141
B 192.168.78.137
C 192.168.78.135

A -> B復(fù)制配置流程,請參考文章
http://blog.itpub.net/26506993/viewspace-2091601/

--在節(jié)點B上,增加下面參數(shù)后,重啟MySQL數(shù)據(jù)庫服務(wù)
--log-slave-updates

通常,在Mysql復(fù)制環(huán)境中,slave節(jié)點不會將從主節(jié)點接收的數(shù)據(jù)更新寫入到它的二進制日志中。這個參數(shù)將會使SQL線程在應(yīng)用日志的時候?qū)⑾嚓P(guān)變更記錄到它自己的二進制日志中。

[root@localhost 5505]# vim /mysql_data/cnf/my.cnf
[mysqld]
# Replication
log-slave-updates

--節(jié)點B,重啟Mysql服務(wù)
[root@localhost bin]# /data/bin/mysqladmin -usystem -p'Mysql#2015' shutdown
160502 19:36:01 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
[1]+  Done                    /data/bin/mysqld_safe --defaults-file=/mysql_data/cnf/my.cnf
[root@localhost bin]# /data/bin/mysqld_safe --defaults-file=/mysql_data/cnf/my.cnf &
[1] 57552
[root@localhost bin]# 160502 19:36:13 mysqld_safe Logging to '/mysql_log/err.log'.
160502 19:36:13 mysqld_safe Starting mysqld daemon with databases from /mysql_data/5505

--查看參數(shù)是否生效
mysql> show variables like 'log_slave_updates';
+-------------------+-------+
| Variable_name     | Value |
+-------------------+-------+
| log_slave_updates | ON    |
+-------------------+-------+
1 row in set (0.00 sec)

--節(jié)點B,停止sql_thread線程
mysql> stop slave sql_thread;
Query OK, 0 rows affected (0.03 sec)

--節(jié)點B,記錄下二進制日志的文件和位置
mysql> show master status;
+------------------+----------+--------------+------------------+
| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
| mysql-bin.000005 |      107 |              |                  |
+------------------+----------+--------------+------------------+
1 row in set (0.00 sec)

--配置B -> C的復(fù)制環(huán)境

--在C節(jié)點,安裝好Mysql數(shù)據(jù)庫軟件

--創(chuàng)建數(shù)據(jù)文件目錄
[root@localhost 70005]# mkdir -p /mysql_data/70005

--創(chuàng)建配置文件的目錄
[root@localhost 70005]# mkdir -p /mysql_data/cnf/

--創(chuàng)建日志文件所在目錄
[root@localhost ~]# mkdir -p /mysql_log/binlog
[root@localhost ~]# mkdir -p /mysql_log/innodb
[root@localhost ~]# chown -R mysql.mysql /mysql_log/

--在B節(jié)點,使用Xtrabackup創(chuàng)建完整備份
[root@localhost percona-xtrabackup-2.4.2-Linux-x86_64]# ./bin/innobackupex  --defaults-file=/mysql_data/cnf/my.cnf --stream=tar /tmp --user system --password 'Mysql#2015' | gzip -> 
/backup/xtra_fullbackup_20160503.tar.gz

--拷貝備份和配置文件到C節(jié)點
[root@localhost backup]# scp /backup/xtra_fullbackup_20160503.tar.gz  root@192.168.78.135:/backup/20160503
[root@localhost percona-xtrabackup-2.4.2-Linux-x86_64]# scp /mysql_data/cnf/my.cnf  root@192.168.78.135:/mysql_data/cnf/

--C節(jié)點,解壓備份到數(shù)據(jù)文件目錄
[root@localhost 5505]# tar xivfz /backup/20160503/xtra_fullbackup_20160503.tar.gz -C /mysql_data/70005
[root@localhost ~]# chown -R mysql.mysql /mysql_data/

--在C節(jié)點上面需要安裝Xtraback,可參看文章
http://blog.itpub.net/26506993/viewspace-2087734/
http://blog.itpub.net/26506993/viewspace-2088737/

--節(jié)點C,使用Xtrabackup準備數(shù)據(jù)、應(yīng)用日志,使數(shù)據(jù)文件達到一致性的狀態(tài)
[root@localhost bin]# ./innobackupex --defaults-file=/mysql_data/cnf/my.cnf  --apply-log /mysql_data/70005
.....
InnoDB: Log scan progressed past the checkpoint lsn 68409356
InnoDB: Doing recovery: scanned up to log sequence number 68409365 (0%)
InnoDB: Doing recovery: scanned up to log sequence number 68409365 (0%)
InnoDB: Database was not shutdown normally!
InnoDB: Starting crash recovery.
InnoDB: xtrabackup: Last MySQL binlog file position 823, file name /mysql_log/binlog/mysql-bin.000002
InnoDB: Removed temporary tablespace data file: "ibtmp1"
InnoDB: Creating shared tablespace for temporary tables
InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
InnoDB: File './ibtmp1' size is now 12 MB.
InnoDB: 96 redo rollback segment(s) found. 1 redo rollback segment(s) are active.
InnoDB: 32 non-redo rollback segment(s) are active.
InnoDB: 5.7.11 started; log sequence number 68409365
xtrabackup: starting shutdown with innodb_fast_shutdown = 1
InnoDB: FTS optimize thread exiting.
InnoDB: Starting shutdown...
InnoDB: Shutdown completed; log sequence number 68409384
160502 20:41:13 completed OK!

--節(jié)點B,在Master節(jié)點B上面創(chuàng)建復(fù)制專用賬戶
mysql> grant replication slave on *.* to 'repl'@'192.168.78.%' identified by 'Mysql#2015';
Query OK, 0 rows affected (0.04 sec)

--節(jié)點C,配置Slave節(jié)點C的配置文件
[root@localhost bin]# vim /mysql_data/cnf/my.cnf 
# Log
server-id = 50005
log-bin = /mysql_log/binlog/product-node3-mysql-bin
relay-log = /mysql_log/binlog/product-node3-relay-bin
relay-log-index = /mysql_log/binlog/product-node3-relay-index
binlog_cache_size = 32M
max_binlog_cache_size = 512M
max_binlog_size = 512M
binlog_format = MIXED

--節(jié)點C,啟動Slave節(jié)點的Mysql服務(wù)
[root@localhost bin]# /software/bin/mysqld_safe --defaults-file=/mysql_data/cnf/my.cnf &

--節(jié)點C,配置Slave節(jié)點復(fù)制環(huán)境
--節(jié)點C,在Slave節(jié)點執(zhí)行CHANGE MASTER語句
mysql> change master to
    -> master_host='192.168.78.137',
    -> master_port=5505,
    -> master_user='repl',
    -> master_password='Mysql#2015',
    -> master_log_file='mysql-bin.000005',
    -> master_log_pos=107;

--節(jié)點C,啟動應(yīng)用線程
mysql> start slave;

--節(jié)點C,查看應(yīng)用狀態(tài)
mysql> show slave status\G
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: 192.168.78.137
                  Master_User: repl
                  Master_Port: 5505
                Connect_Retry: 60
              Master_Log_File: mysql-bin.000005
          Read_Master_Log_Pos: 107
               Relay_Log_File: product-node3-relay-bin.000002
                Relay_Log_Pos: 253
        Relay_Master_Log_File: mysql-bin.000005
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes

--啟動節(jié)點B的SQL線程
mysql> start slave sql_thread;

以上是“MySQL 5.5級聯(lián)復(fù)制配置的示例分析”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對大家有幫助,更多相關(guān)知識,歡迎關(guān)注創(chuàng)新互聯(lián)-成都網(wǎng)站建設(shè)公司行業(yè)資訊頻道!


分享名稱:MySQL5.5級聯(lián)復(fù)制配置的示例分析-創(chuàng)新互聯(lián)
文章起源:http://weahome.cn/article/ipdej.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部