欧美一级特黄大片做受成人-亚洲成人一区二区电影-激情熟女一区二区三区-日韩专区欧美专区国产专区

MySQL5.5主主復(fù)制搭建過(guò)程是怎樣的-創(chuàng)新互聯(lián)

MySQL 5.5 主主復(fù)制搭建過(guò)程是怎樣的,相信很多沒(méi)有經(jīng)驗(yàn)的人對(duì)此束手無(wú)策,為此本文總結(jié)了問(wèn)題出現(xiàn)的原因和解決方法,通過(guò)這篇文章希望你能解決這個(gè)問(wèn)題。

站在用戶的角度思考問(wèn)題,與客戶深入溝通,找到鄂城網(wǎng)站設(shè)計(jì)與鄂城網(wǎng)站推廣的解決方案,憑借多年的經(jīng)驗(yàn),讓設(shè)計(jì)與互聯(lián)網(wǎng)技術(shù)結(jié)合,創(chuàng)造個(gè)性化、用戶體驗(yàn)好的作品,建站類型包括:成都做網(wǎng)站、網(wǎng)站制作、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣、域名與空間、網(wǎng)站空間、企業(yè)郵箱。業(yè)務(wù)覆蓋鄂城地區(qū)。

--節(jié)點(diǎn)1 IP 192.168.78.141  PORT 3306
--節(jié)點(diǎn)2 IP 192.168.78.137  PORT 5505

--配置節(jié)點(diǎn)1到節(jié)點(diǎn)2的復(fù)制
--編輯節(jié)點(diǎn)1的配置文件
[root@localhost install]# vim /etc/my.cnf
# Log
server-id = 100
log-bin = /log/binlog/mysql-bin

--在節(jié)點(diǎn)2安裝好MySQL軟件,安裝流程可以參考源碼安裝文章
http://blog.itpub.net/26506993/viewspace-2072859/

--在節(jié)點(diǎn)1,使用Xtrabackup創(chuàng)建完整備份
關(guān)于Xtrabackup,可參考
http://blog.itpub.net/26506993/viewspace-2087734/
http://blog.itpub.net/26506993/viewspace-2088737/

[root@localhost backup]# /install/percona/percona-xtrabackup-2.4.2-Linux-x86_64/bin/innobackupex  --defaults-file=/etc/my.cnf --stream=tar /tmp --user system --password 'Mysql#2015' | gzip -> 
/backup/xtra/xtra_fullbackup_20160501.tar.gz

--拷貝備份到節(jié)點(diǎn)2
[root@localhost backup]# scp /backup/xtra/xtra_fullbackup_20160501.tar.gz  root@192.168.78.137:/backup/20160501

解壓備份到數(shù)據(jù)文件目錄
[root@localhost 5505]# tar xivfz xtra_fullbackup_20160501.tar.gz -C /mysql_data/5505

在節(jié)點(diǎn)2上面需要安裝Xtraback
--使用Xtrabackup準(zhǔn)備數(shù)據(jù)、應(yīng)用日志,使數(shù)據(jù)文件達(dá)到一致性的狀態(tài)
[root@localhost bin]# ./innobackupex --defaults-file=/mysql_data/cnf/my.cnf  --apply-log /mysql_data/5505
.....
InnoDB: Doing recovery: scanned up to log sequence number 68405269 (0%)
InnoDB: Doing recovery: scanned up to log sequence number 68405269 (0%)
InnoDB: Database was not shutdown normally!
InnoDB: Starting crash recovery.
InnoDB: xtrabackup: Last MySQL binlog file position 414, file name /log/binlog/mysql-bin.000012
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 68405269
xtrabackup: starting shutdown with innodb_fast_shutdown = 1
InnoDB: FTS optimize thread exiting.
InnoDB: Starting shutdown...
InnoDB: Shutdown completed; log sequence number 68405621
160430 23:51:25 completed OK!

--在節(jié)點(diǎn)1數(shù)據(jù)庫(kù)上面創(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é)點(diǎn)2的配置文件
[root@localhost 5505]# vim /mysql_data/cnf/my.cnf
# Log
server-id = 200
log-bin = /mysql_log/binlog/mysql-bin
relay-log = /mysql_log/binlog/product-relay-bin
relay-log-index = /mysql_log/binlog/product-relay-index
binlog_cache_size = 32M
max_binlog_cache_size = 512M
max_binlog_size = 512M
binlog_format = MIXED

--啟動(dòng)節(jié)點(diǎn)2的Mysql服務(wù)
[root@localhost bin]# /data/bin/mysqld_safe --defaults-file=/mysql_data/cnf/my.cnf &

--配置Slave節(jié)點(diǎn)復(fù)制環(huán)境
查詢Slave節(jié)點(diǎn)連接Master節(jié)點(diǎn)的二進(jìn)制文件和位置
使用Xtrabackup備份時(shí),在xtrabackup_binlog_info文件中會(huì)保存這部分信息
[root@localhost 5505]# more xtrabackup_binlog_info
mysql-bin.000012 414

--在節(jié)點(diǎn)2執(zhí)行CHANGE MASTER語(yǔ)句
mysql> change master to
    -> master_host='192.168.78.141',
    -> master_port=3306,
    -> master_user='repl',
    -> master_password='Mysql#2015',
    -> master_log_file='mysql-bin.000012',
    -> master_log_pos=414;
Query OK, 0 rows affected (0.13 sec)

--啟動(dòng)應(yīng)用線程
mysql> start slave;

--查看同步狀態(tài)
mysql> show slave status\G
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: 192.168.78.141
                  Master_User: repl
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: mysql-bin.000013
          Read_Master_Log_Pos: 341
               Relay_Log_File: product-relay-bin.000003
                Relay_Log_Pos: 487
        Relay_Master_Log_File: mysql-bin.000013
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes

--搭建節(jié)點(diǎn)2到節(jié)點(diǎn)1的復(fù)制
--在節(jié)店1的配置文件中,增加中繼日志的設(shè)置
[root@localhost log]# vim /etc/my.cnf
relay-log = /log/binlog/product-relay-bin
relay-log-index = /log/binlog/product-relay-index

--重啟節(jié)點(diǎn)1的數(shù)據(jù)庫(kù)
[root@localhost tmp]# /software/bin/mysqladmin -usystem -p'system' shutdown
160512 02:47:54 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
[1]+  Done                    /software/bin/mysqld_safe --defaults-file=/etc/my.cnf  (wd: ~)
(wd now: /tmp)
[root@localhost tmp]# /software/bin/mysqld_safe --defaults-file=/etc/my.cnf &
[1] 40246
[root@localhost tmp]# 160512 02:48:13 mysqld_safe Logging to '/log/err.log'.
160512 02:48:13 mysqld_safe Starting mysqld daemon with databases from /data

mysql> show variables like 'relay_log%';
+-----------------------+---------------------------------+
| Variable_name         | Value                           |
+-----------------------+---------------------------------+
| relay_log             | /log/binlog/product-relay-bin   |
| relay_log_index       | /log/binlog/product-relay-index |
| relay_log_info_file   | relay-log.info                  |
| relay_log_purge       | ON                              |
| relay_log_recovery    | OFF                             |
| relay_log_space_limit | 0                               |
+-----------------------+---------------------------------+
6 rows in set (0.00 sec)

--在節(jié)點(diǎn)1上面增加全局只讀鎖,如果應(yīng)用只連接到一個(gè)節(jié)點(diǎn),如節(jié)點(diǎn)1,這一步可以忽略
mysql> flush tables with read lock;
Query OK, 0 rows affected (0.00 sec)

--查看節(jié)點(diǎn)2當(dāng)前的日志名稱和位置,用于下面在節(jié)點(diǎn)1的change master to命令
mysql> show master status;
+------------------+----------+--------------+------------------+
| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
| mysql-bin.000006 | 14078491 |              |                  |
+------------------+----------+--------------+------------------+
1 row in set (0.00 sec)

--在節(jié)點(diǎn)1執(zhí)行CHANGE MASTER語(yǔ)句
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.000006',
    -> master_log_pos=14078491;
Query OK, 0 rows affected (0.13 sec)

--啟動(dòng)應(yīng)用線程
mysql> start slave;

--節(jié)點(diǎn)1釋放全局只讀鎖
mysql> unlock tables;
Query OK, 0 rows affected (0.00 sec)

--查看同步狀態(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.000006
          Read_Master_Log_Pos: 14078491
               Relay_Log_File: product-relay-bin.000002
                Relay_Log_Pos: 253
        Relay_Master_Log_File: mysql-bin.000006
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes

在兩個(gè)節(jié)點(diǎn)的配置文件中增加序列的相關(guān)參數(shù),以避免生成的序列相同而產(chǎn)生沖突
--節(jié)點(diǎn)1

節(jié)點(diǎn)1上序列從1開(kāi)始,增長(zhǎng)值為2,即為奇數(shù),如1、3、5

## set this to server-id value

auto_increment_offset = 1

## set this to the number of mysql servers

auto_increment_increment = 2


--節(jié)點(diǎn)2
節(jié)點(diǎn)2上序列從2開(kāi)始,增長(zhǎng)值為2,即為奇數(shù),如2、4、6

## set this to server-id value

auto_increment_offset = 2

## set this to the number of mysql servers

auto_increment_increment = 2

看完上述內(nèi)容,你們掌握MySQL 5.5 主主復(fù)制搭建過(guò)程是怎樣的的方法了嗎?如果還想學(xué)到更多技能或想了解更多相關(guān)內(nèi)容,歡迎關(guān)注創(chuàng)新互聯(lián)-成都網(wǎng)站建設(shè)公司行業(yè)資訊頻道,感謝各位的閱讀!

網(wǎng)站標(biāo)題:MySQL5.5主主復(fù)制搭建過(guò)程是怎樣的-創(chuàng)新互聯(lián)
轉(zhuǎn)載來(lái)于:http://aaarwkj.com/article16/dpjjgg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供商城網(wǎng)站用戶體驗(yàn)、網(wǎng)站設(shè)計(jì)公司小程序開(kāi)發(fā)、ChatGPT動(dòng)態(tài)網(wǎng)站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

小程序開(kāi)發(fā)
十八禁一区二区在线观看| 2020中文字字幕在线不卡| 亚洲av区一区二区三| 免费看欧美黄片在线看| 亚洲国产日韩精品av| 国产精品原创传媒在线观看| 偷拍一区二区三区夫妻| 午夜欧美激情在线视频| 国产精品美女露脸av毛片| 久久99久久久久久精品| 日韩精品一区三区二区| 日本亚洲一级中文字幕| 免费一区二区三区黄色| 九九九热在线观看视频| 日韩人妻中文字幕乱码一区| 放荡精品少妇一区二区三区| 日韩精品视频在线不卡播放| 超碰av之男人的天堂| 伦理中文字幕一区二区| 欧美日韩精品偷拍一区二区| 强d乱码中文字幕在线| 久久精品国产免费夜夜嗨| 97免费在线视频观看| 久久熟妇少妇亚洲精品| 日本免费一区二区在线视频| 免费观看毛片一区二区三区| 人妻一区二区免费视频| 伊人欧美一区二区三区| 精品人妻中文av一区二区| 未满十八周岁禁看视频| 少妇诱惑一区二区三区| 国产亚洲av一区二区三区| 精品人妻中文字幕在线| 精品视频一区二区三区在线观看| 精品国产av一区蜜臀av| 两性色午夜视频在线观看| 国产区二区三区在线视频| 蜜桃视频中文字幕二区三区| 日韩免费在线观看av| 亚洲精品精品一区二区| 日韩女同性一区二区三区|