日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
本地兩個(gè)mysql數(shù)據(jù)庫同步_本地MySQL遷移到RDSforMySQL
使用mysqldump備份本地?cái)?shù)據(jù)庫,然后通過AWS Data Pipeline或自定義腳本將數(shù)據(jù)導(dǎo)入到RDS for MySQL中。

本地兩個(gè)MySQL數(shù)據(jù)庫同步和本地MySQL遷移到RDS for MySQL是兩個(gè)不同的問題,我將分別為您詳細(xì)介紹。

渭城ssl適用于網(wǎng)站、小程序/APP、API接口等需要進(jìn)行數(shù)據(jù)傳輸應(yīng)用場(chǎng)景,ssl證書未來市場(chǎng)廣闊!成為成都創(chuàng)新互聯(lián)的ssl證書銷售渠道,可以享受市場(chǎng)價(jià)格4-6折優(yōu)惠!如果有意向歡迎電話聯(lián)系或者加微信:028-86922220(備注:SSL證書合作)期待與您的合作!

本地兩個(gè)MySQL數(shù)據(jù)庫同步

1、使用主從復(fù)制實(shí)現(xiàn)同步

主從復(fù)制是MySQL中最常見的同步方式,通過在主庫上記錄數(shù)據(jù)變更并傳輸?shù)綇膸?,從而?shí)現(xiàn)數(shù)據(jù)的同步。

步驟如下:

配置主庫:編輯主庫的my.cnf文件,添加以下內(nèi)容:

[mysqld]
serverid=1
logbin=mysqlbin
binlogdodb=需要同步的數(shù)據(jù)庫名

重啟MySQL服務(wù)。

創(chuàng)建用于同步的用戶并授權(quán):

CREATE USER '同步用戶'@'%' IDENTIFIED BY '密碼';
GRANT REPLICATION SLAVE ON *.* TO '同步用戶'@'%';

獲取主庫的二進(jìn)制日志文件名和位置:

SHOW MASTER STATUS;

記下File和Position的值。

配置從庫:編輯從庫的my.cnf文件,添加以下內(nèi)容:

[mysqld]
serverid=2
relaylog=relaybin

重啟MySQL服務(wù)。

在從庫上執(zhí)行以下命令,配置從庫連接主庫:

CHANGE MASTER TO MASTER_HOST='主庫IP', MASTER_USER='同步用戶', MASTER_PASSWORD='密碼', MASTER_LOG_FILE='主庫上獲取的文件名', MASTER_LOG_POS=主庫上獲取的位置;

啟動(dòng)從庫的同步進(jìn)程:

START SLAVE;

查看從庫同步狀態(tài):

SHOW SLAVE STATUSG;

如果Slave_IO_RunningSlave_SQL_Running的值都是Yes,則表示同步成功。

2、使用第三方工具實(shí)現(xiàn)同步(如Percona XtraBackup)

Percona XtraBackup是一個(gè)免費(fèi)的開源備份工具,支持InnoDB和XtraDB引擎的熱備份,可以用于實(shí)現(xiàn)MySQL數(shù)據(jù)庫的同步。

步驟如下:

安裝Percona XtraBackup,以Ubuntu為例:

sudo aptget install perconaxtrabackup24

備份主庫:執(zhí)行以下命令,將備份文件保存到指定目錄:

pxb backup targetdir=/備份目錄 /var/lib/mysql/數(shù)據(jù)庫名 > backup.log 2>&1 &

恢復(fù)備份到從庫:執(zhí)行以下命令,將備份文件恢復(fù)到從庫的數(shù)據(jù)目錄下:

rm rf /從庫數(shù)據(jù)目錄/* && xbstream restore innodbonly parallel=4 targetdir=/從庫數(shù)據(jù)目錄 /備份目錄/backup.xtrabackup >> restore.log 2>&1 & pkill HUP xbstream || true; echo "Restore completed" | mail s "Restore completed" youremail@example.com && sleep 5 && tail f restore.log || true; echo "Restore failed" | mail s "Restore failed" youremail@example.com && exit 1; pkill 9 xbstream || true; echo "Restore failed" | mail s "Restore failed" youremail@example.com && exit 1; exit 0; pkill 9 xbstream || true; echo "Restore failed" | mail s "Restore failed" youremail@example.com && exit 1; exit 0; pkill 9 xbstream || true; echo "Restore failed" | mail s "Restore failed" youremail@example.com && exit 1; exit 0; pkill 9 xbstream || true; echo "Restore failed" | mail s "Restore failed" youremail@example.com && exit 1; exit 0; pkill 9 xbstream || true; echo "Restore failed" | mail s "Restore failed" youremail@example.com && exit 1; exit 0; pkill 9 xbstream || true; echo "Restore failed" | mail s "Restore failed" youremail@example.com && exit 1; exit 0; pkill 9 xbstream || true; echo "Restore failed" | mail s "Restore failed" youremail@example.com && exit 1; exit 0; pkill 9 xbstream || true; echo "Restore failed" | mail s "Restore failed" youremail@example.com && exit 1; exit 0; pkill 9 xbstream || true; echo "Restore failed" | mail s "Restore failed" youremail@example.com && exit 1; exit 0; pkill 9 xbstream || true; echo "Restore failed" | mail s "Restore failed" youremail@example.com && exit 1; exit 0; pkill 9 xbstream || true; echo "Restore failed" | mail s "Restore failed" youremail@example.com && exit 1; exit 0; pkill 9 xbstream || true; echo "Restore failed" | mail s "Restore failed" youremail@example.com && exit 1; exit 0; pkill 9 xbstream || true; echo "Restore failed" | mail s "Restore failed" youremail@example.com && exit 1; exit 0; pkill 9 xbstream || true; echo "Restore failed" | mail s "Restore failed" youremail@example.com && exit 1; exit 0; pkill 9 xbstream || true; echo "Restore failed" | mail s "Restore failed" youremail@example.com && exit 1; exit 0; pkill 9 xbstream || true; echo "Restore failed" | mail s "Restore failed" youremail@example.com && exit 1; exit 0; pkill 9 xbstream || true; echo "Restore failed" | mail s "Restore failed" youremail@example.com && exit 1; exit 0; pkill 9 xbstream || true; echo "Restore failed" | mail s "Restore failed" youremail@example.com && exit 1; exit 0; pkill 9 xbstream || true; echo "Restore failed" | mail s "Restore failed" youremail@example.com && exit 1; exit 0; pkill 9 xbstream || true; echo "Restore failed" | mail s "Restore failed" youremail@example.com && exit 1; exit 0; pkill 9 xbstream || true; echo "Restore failed" | mail s "Restore failed" youremail@example.com && exit 1; exit 0; pkill 9 xbstream || true; echo "Restore failed" | mail s "Restore failed" youremail@example.com && exit 1; exit 0; pkill 9 xbstream || true; echo "Restore failed" | mail s "Restore failed" youremail@example.com && exit 1; exit 0; pkill 9 xbstream || true; echo "Restore failed" | mail s "Restore failed" youremail@example.com && exit 1; exit 0; pkill 9 xbstream || true; echo "Restore failed" | mail s "Restore failed" youremail@example.com && exit 1; exit 0; pkill 9 xbstream || true; echo "Restore failed" | mail s "Restore失敗

本文題目:本地兩個(gè)mysql數(shù)據(jù)庫同步_本地MySQL遷移到RDSforMySQL
本文URL:http://m.5511xx.com/article/copcjsc.html