innobackupex中--slave-info参数的含义和适用场景
生活随笔
收集整理的這篇文章主要介紹了
innobackupex中--slave-info参数的含义和适用场景
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
我有個(gè)問(wèn)題一直沒(méi)弄明白,就是innobackupex里面的--slave-info這個(gè)參數(shù),是干什么的呀。最終在命令幫助和我的實(shí)驗(yàn),弄清楚了其中的含義。
????下面就是一個(gè)我經(jīng)常用來(lái)備份全庫(kù)時(shí)的語(yǔ)句:
innobackupex --defaults-file=/etc/my.cnf --user=root --password='123' --host=localhost --rsync --compress --compress-threads=5 --compress-chunk-size=64K?--slave-info?/root
????下面我們就看幫助,看一下其中這個(gè)--slave-info的含義:
[root@zabbixsrvbjdb04 ~]# innobackupex --help |grep -C 5 slave
?--slave-info
? ? ? ? This option is useful when backing up a replication slave server. It
? ? ? ? prints the binary log position and name of the master server. It
? ? ? ? also writes this information to the "xtrabackup_slave_info" file as
? ? ? ? a "CHANGE MASTER" command. A new slave for this master can be set up
? ? ? ? by starting a slave server on this backup and issuing a "CHANGE
? ? ? ? MASTER" command with the binary log position saved in the
? ? ? ? "xtrabackup_slave_info" file.
????以下就是我的理解:
????在備份從庫(kù)時(shí),可以使用該參數(shù), 加上--slave-info備份目錄下會(huì)多生成一個(gè)xtrabackup_slave_info 文件, 這里會(huì)保存主日志文件以及偏移, 文件內(nèi)容類似于:CHANGE MASTER TO MASTER_LOG_FILE='', MASTER_LOG_POS=0。
????這個(gè)參數(shù)適用的場(chǎng)景:假設(shè)現(xiàn)在有主庫(kù)A和從庫(kù)B,目前想再添加一臺(tái)備庫(kù)C,并讓備庫(kù)C以主庫(kù)A為master;因?yàn)橹鲙?kù)A是生產(chǎn)庫(kù),壓力一般比較大,所以我們就在備庫(kù)B上備份一個(gè)數(shù)據(jù)庫(kù),然后把這個(gè)備份拿到C服務(wù)器上 并導(dǎo)入到C庫(kù),接下來(lái)再在C服務(wù)器上執(zhí)行change master的命令:其中 master_host是A的ip,而master_log_file和master_log_pos就是這個(gè)xtrabackup_slave_info里面的值。不知道說(shuō)明白了嗎(czxin注釋)。
????下面就是一個(gè)我經(jīng)常用來(lái)備份全庫(kù)時(shí)的語(yǔ)句:
innobackupex --defaults-file=/etc/my.cnf --user=root --password='123' --host=localhost --rsync --compress --compress-threads=5 --compress-chunk-size=64K?--slave-info?/root
????下面我們就看幫助,看一下其中這個(gè)--slave-info的含義:
[root@zabbixsrvbjdb04 ~]# innobackupex --help |grep -C 5 slave
?--slave-info
? ? ? ? This option is useful when backing up a replication slave server. It
? ? ? ? prints the binary log position and name of the master server. It
? ? ? ? also writes this information to the "xtrabackup_slave_info" file as
? ? ? ? a "CHANGE MASTER" command. A new slave for this master can be set up
? ? ? ? by starting a slave server on this backup and issuing a "CHANGE
? ? ? ? MASTER" command with the binary log position saved in the
? ? ? ? "xtrabackup_slave_info" file.
????以下就是我的理解:
????在備份從庫(kù)時(shí),可以使用該參數(shù), 加上--slave-info備份目錄下會(huì)多生成一個(gè)xtrabackup_slave_info 文件, 這里會(huì)保存主日志文件以及偏移, 文件內(nèi)容類似于:CHANGE MASTER TO MASTER_LOG_FILE='', MASTER_LOG_POS=0。
????這個(gè)參數(shù)適用的場(chǎng)景:假設(shè)現(xiàn)在有主庫(kù)A和從庫(kù)B,目前想再添加一臺(tái)備庫(kù)C,并讓備庫(kù)C以主庫(kù)A為master;因?yàn)橹鲙?kù)A是生產(chǎn)庫(kù),壓力一般比較大,所以我們就在備庫(kù)B上備份一個(gè)數(shù)據(jù)庫(kù),然后把這個(gè)備份拿到C服務(wù)器上 并導(dǎo)入到C庫(kù),接下來(lái)再在C服務(wù)器上執(zhí)行change master的命令:其中 master_host是A的ip,而master_log_file和master_log_pos就是這個(gè)xtrabackup_slave_info里面的值。不知道說(shuō)明白了嗎(czxin注釋)。
總結(jié)
以上是生活随笔為你收集整理的innobackupex中--slave-info参数的含义和适用场景的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: ERROR 1205 (HY000):
- 下一篇: 如何使用Tmux提高终端环境下的效率