使用 tungsten-replicator4 實現 mysql -- > monogo 資料同步

來源:互聯網
上載者:User

標籤:

tungsten-replicator 技術交流群:376068310

一 規劃主機:

192.168.67.128 #mysql主機 (事先安裝好,安裝步驟詳見 前一篇部落格 )192.168.67.129 #mongodb主機 (事先安裝好,安裝步驟詳見 前一篇部落格)

二 前置條件:(128和129)

1 建立tungsten使用者

[[email protected] ~] useradd tungsten[[email protected] ~] passwd tungsten

2 將tungsten賬戶添加到 mysql 使用者組裡

128主機:[[email protected] ~] sudo usermod -G mysql tungsten129主機[[email protected] ~] sudo usermod -G mongod tungsten

3 修改sudoers許可權,並且讓 tungsten 使用者使用 sudo 命令時免密碼

[[email protected] ~] chmod 740 /etc/sudoers[[email protected] ~] vi /etc/sudoers添加如下一行:tungsten        ALL=(ALL)       NOPASSWD: ALL

4 切換到 tungsten 使用者下

[[email protected] ~] su - tungsten

5 切換到 tungsten 使用者後,建立金鑰組。預設在/home/tungsten/.ssh 目錄下

[[email protected] ~] ssh-keygen -t rsa

6 修改 limit 檔案

[[email protected] ~] vi /etc/security/limits.conf添加下面一行:* - nofile 65535

7 檢查修改是否成功

[[email protected] ~] ulimit -n 65535

8 配置hosts

[[email protected] ~] sudo vi /etc/hosts127.0.0.1 localhost192.168.67.128 host1192.168.67.129 host2

9 測試主機

[[email protected] ~] uname -nhost1

10 測試ip地址

[[email protected] ~] hostname --ip-address

11 防火牆設定

[[email protected] ~] iptables -A INPUT -i lo -m state --state NEW -j ACCEPT

12 把產生的公開金鑰和私密金鑰拷貝到 tungsten使用者的主目錄下 。預設就在使用者主目錄

[[email protected] ~] cp .ssh/id_rsa.pub .ssh/id_rsa /home/tungsten/.ssh

13 把公開金鑰放到 .ssh/authorized_keys檔案中,128 的公開金鑰放到 129,129 的公開金鑰放到 128

[[email protected] ~] cat .ssh/id_rsa.pub >> .ssh/authorized_keys

14 修改許可權

[[email protected] ~] chmod 700 ~/.ssh[[email protected] ~] 600 ~/.ssh/*

15 測試主機間ssh

[[email protected] ~] ssh [email protected]

16 修改mysql配置

[[email protected]st ~] vi /etc/my.cnfserver-id = 128open_files_limit = 65535log-bin = mysql-binsync_binlog = 1max_allowed_packet = 52mdefault-storage-engine = InnoDBinnodb_flush_log_at_trx_commit = 2binlog-format = rowbinlog-row-image = full

17 登入mysql,建立使用者 tungsten 複製的 mysql 使用者

[[email protected] ~] /usr/bin/mysqlmysql> grant all privileges on *.* to [email protected]‘%‘ identified by ‘ts‘ with grant options;mysql> flush privileges;

三 安裝服務:

1 建立 tungsten-replication 軟體主目錄

[[email protected] ~] sudo mkdir /opt/continuent/soft[[email protected] ~] sudo chown -R tungsten /opt/continuent[[email protected] ~] sudo chmod 700 /opt/continuent

2 把下載好的 tungsten-replicator-4.0.0-2667425.tar.gz 包上傳到 soft 目錄

[[email protected] ~] cd /opt/continuent/soft[[email protected] software] ll [[email protected] software] tungsten-replicator-4.0.0-2667425.tar.gz[[email protected] software] tar -zxvf tungsten-replicator-4.0.0-2667425.tar.gz[[email protected] software] cd tungsten-replicator-4.0.0-2667425[[email protected] tungsten-replicator-4.0.0-2667425]

128主機(mysql)上:

[[email protected] tungsten-replicator-4.0.0-2667425] ./tools/tpm install alpha --info --master=192.168.67.128 --datasource-mysql-conf=/etc/my.cnf --enable-heterogenous-master=true --replication-user=tungsten_alpha --replication-password=ts --install-directory=/opt/continuent/alpha --start-and-report

129主機(mongo)上:

[[email protected] tungsten-replicator-4.0.0-2667425]./tools/tpm install alpha --info --datasource-type=mongodb --master=192.168.67.128 --members=192.168.67.129 --enable-heterogenous-slave=true --topology=master-slave --install-directory=/opt/continuent/alpha --start-and-report

3 如果兩個主機的 state 都是 online 說明 兩個主機的 tungsten-replicator 都正常運行了


4 在mysql 主機上的 tungsten_alpha 庫中 建立一張表,然後在mongo主機中查看 同步是否成功


使用 tungsten-replicator4 實現 mysql -- > monogo 資料同步

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.