本篇文章為大家展示了MySQL 中怎么利用master實(shí)現(xiàn)熱備份,內(nèi)容簡(jiǎn)明扼要并且容易理解,絕對(duì)能使你眼前一亮,通過(guò)這篇文章的詳細(xì)介紹希望你能有所收獲。
1 開(kāi)啟binlog
mysql
server-id = 151
log-bin =/opt/soft/mysql/binlog/mysql-bin
binlog_format = MIXED
2 獲得基礎(chǔ)備份
/opt/soft/mysql/bin/mysqldump -p123456 --single-transaction --master-data=2 AdDataCenter | gzip >AdDataCenter.sql.gz
3 開(kāi)通用于binlog 復(fù)制的 用戶(hù)
GRANT REPLICATION SLAVE ON *.* TO'repat152'@'192.168.%' IDENTIFIED BY'123456';
4到從機(jī)上恢復(fù) www.2cto.com
gzip –cd AdDataCenter.sql.gzip | opt/soft//bin/mysql –p123456 AdDataCenter
5 設(shè)置復(fù)制庫(kù)選項(xiàng)
gzip -cd AdDataCenter.sql.gz | grep -i"CHANGE MASTER TO"
得到binlog 文件和binlog pos
CHANGEMASTER TO MASTER_HOST='master_host_name',MASTER_USER='replication_user_name',MASTER_PASSWORD='replication_password',MASTER_LOG_FILE='recorded_log_file_name',ASTER_LOG_POS=recorded_log_position;
6 開(kāi)啟從庫(kù)復(fù)制
Start slave
上述內(nèi)容就是MySQL 中怎么利用master實(shí)現(xiàn)熱備份,你們學(xué)到知識(shí)或技能了嗎?如果還想學(xué)到更多技能或者豐富自己的知識(shí)儲(chǔ)備,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。