innobackupex中--slave-info参数的含义和适用场景
生活随笔
收集整理的這篇文章主要介紹了
innobackupex中--slave-info参数的含义和适用场景
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
我有個問題一直沒弄明白,就是innobackupex里面的--slave-info這個參數,是干什么的呀。最終在命令幫助和我的實驗,弄清楚了其中的含義。
????下面就是一個我經常用來備份全庫時的語句:
innobackupex --defaults-file=/etc/my.cnf --user=root --password='123' --host=localhost --rsync --compress --compress-threads=5 --compress-chunk-size=64K?--slave-info?/root
????下面我們就看幫助,看一下其中這個--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.
????以下就是我的理解:
????在備份從庫時,可以使用該參數, 加上--slave-info備份目錄下會多生成一個xtrabackup_slave_info 文件, 這里會保存主日志文件以及偏移, 文件內容類似于:CHANGE MASTER TO MASTER_LOG_FILE='', MASTER_LOG_POS=0。
????這個參數適用的場景:假設現在有主庫A和從庫B,目前想再添加一臺備庫C,并讓備庫C以主庫A為master;因為主庫A是生產庫,壓力一般比較大,所以我們就在備庫B上備份一個數據庫,然后把這個備份拿到C服務器上 并導入到C庫,接下來再在C服務器上執行change master的命令:其中 master_host是A的ip,而master_log_file和master_log_pos就是這個xtrabackup_slave_info里面的值。不知道說明白了嗎(czxin注釋)。
????下面就是一個我經常用來備份全庫時的語句:
innobackupex --defaults-file=/etc/my.cnf --user=root --password='123' --host=localhost --rsync --compress --compress-threads=5 --compress-chunk-size=64K?--slave-info?/root
????下面我們就看幫助,看一下其中這個--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.
????以下就是我的理解:
????在備份從庫時,可以使用該參數, 加上--slave-info備份目錄下會多生成一個xtrabackup_slave_info 文件, 這里會保存主日志文件以及偏移, 文件內容類似于:CHANGE MASTER TO MASTER_LOG_FILE='', MASTER_LOG_POS=0。
????這個參數適用的場景:假設現在有主庫A和從庫B,目前想再添加一臺備庫C,并讓備庫C以主庫A為master;因為主庫A是生產庫,壓力一般比較大,所以我們就在備庫B上備份一個數據庫,然后把這個備份拿到C服務器上 并導入到C庫,接下來再在C服務器上執行change master的命令:其中 master_host是A的ip,而master_log_file和master_log_pos就是這個xtrabackup_slave_info里面的值。不知道說明白了嗎(czxin注釋)。
總結
以上是生活随笔為你收集整理的innobackupex中--slave-info参数的含义和适用场景的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: ERROR 1205 (HY000):
- 下一篇: 如何使用Tmux提高终端环境下的效率