亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

【Mysql】Mysql5.7的多源復制搭建

發布時間:2020-08-05 10:32:50 來源:ITPUB博客 閱讀:213 作者:小亮520cl 欄目:MySQL數據庫

    一.基本環境
主庫1: 10.24.65.30  3306 MySQL 5.7.14
主庫2: 10.24.65.30  3307 mysql 5.7.14
從庫:10.24.65.33  3306 mysql 5.7.14
基于gtid復制

    二.搭建注意事項
1.每個實例上DB名字不能一樣。
2.創建或是復制用戶時名字不能一樣,如果經常遇到一樣的帳號若是為了規范創建的帳
號是一樣的,考慮在slave的過濾規則把mysql復制忽略掉。
[stop slave sql_thread;change replication filter replicate_ignore_db=mysql;]

    3307啟停:
mysqld_safe --defaults-file=/data/mysql/mysql3307/data/my3307.cnf &
mysqladmin shutdown -S /tmp/mysql3307.sock
mysql  -S /tmp/mysql3307.sock

    三.主庫配置
1.master1參數設置
gtid-mode=on
enforce-gtid-consistency=1
skip_slave_start=1
2.master2參數設置
gtid-mode=on
enforce-gtid-consistency=1
skip_slave_start=1
3.復制帳號建立
grant replication slave on *.* to repl@'10.24%' identified by 'replsafe';
flush privileges;
4.slave參數設置
gtid-mode=on
enforce-gtid-consistency=1
skip_slave_start=1
master-info-repository=table
relay-log-info-repository=table
5.slave配置連接主庫
change master to
master_host='10.24.65.30',
master_port=3306,
master_user='repl',
master_password='replsafe',
master_auto_position=1 for channel 'master-65303306';

    change master to
master_host='10.24.65.30',
master_port=3307,
master_user='repl',
master_password='replsafe',
master_auto_position=1 for channel 'master-65303307';

    四.常用命令:
1.開關復制
start slave io_thread|sql_thread for channel 'master-65303306';
stop slave io_thread|sql_thread for channel 'master-65303306'

    2.監控復制
show slave status for channel 'master-65303306';

    五.校驗
master1:
create database mdb1;
use mdb1;
create table t1(id int);

    master2:
create database mdb2;
use mdb2;
create table t2(id int);

    slave:
(product)root@localhost [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mdb1               |
| mdb2               |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
6 rows in set (0.00 sec)

    (product)root@localhost [(none)]> use mdb1;
Database changed
(product)root@localhost [mdb1]> show tables;
+----------------+
| Tables_in_mdb1 |
+----------------+
| t1             |
+----------------+
1 row in set (0.00 sec)

    (product)root@localhost [mdb1]> use mdb2;
Database changed
(product)root@localhost [mdb2]> show tables;
+----------------+
| Tables_in_mdb2 |
+----------------+
| t2             |
+----------------+
1 row in set (0.00 sec)

    六.相關問題
1.多源復制處理之一:
binlog+position:
stop slave sql_thread for channel 'master-65303306';
set sql_slave_skip_counter=n;
start slave sql_thread for channel 'master-65303306';

    gtid:
stop slave sql_thread for channel 'master-65303306';
set gtid_next='uuid-N';
begin;commit;
set gtid_next='automatic';
start slave sql_thread for channel 'master-65303306';
2.從多源復制處理之二:
                Last_IO_Errno: 1236
                Last_IO_Error: Got fatal error 1236 from master when reading data from binary log: 'A slave with the same server_uuid/server_id as this slave has connected to the master; 
the first event 'mysql-bin.000181' at 154, the last event read from '/data/mysql/mysql3306/logs/mysql-bin.000181' at 123, the last byte read from '/data/mysql/mysql3306/logs/mysql-bin.000181' at 154.'

    解決方法:
a.由于兩主庫的server-uuid相同,更改其中一個auto.cnf中的server-uuid號
b.并在從庫上執行reset slave all清除slave信息
c.重新change master


    補充:

  •             1.dump master1 master2 數據文件(master-data=2)注釋掉set_gtid——purged
  •             2.scp master1.sql 至slave  ,reset master 并且導入master1.sql,master_auto=0搭建復制步驟
  •             3.scp master2.sql 至slave  ,reset master 并且導入master2.sql,master_auto=0搭建復制步驟
  •  4.搭建復制通道

  • change master to master_host='127.0.0.1',master_user='repluser',master_password='replpass',master_port=3308,MASTER_LOG_FILE='mysql-bin.000005', MASTER_LOG_POS=9460 for channel 'master_3308';


  • 5.檢查無誤

   

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

巴中市| 广平县| 伊通| 兴城市| 大田县| 石景山区| 博爱县| 万宁市| 富平县| 宁津县| 凌海市| 甘孜| 张家界市| 龙岩市| 石嘴山市| 平江县| 湟源县| 北宁市| 洛扎县| 寿阳县| 汝州市| 武隆县| 垣曲县| 建瓯市| 蒙阴县| 南乐县| 高唐县| 舞钢市| 都昌县| 延寿县| 诸暨市| 甘德县| 上栗县| 巴彦淖尔市| 抚州市| 车致| 腾冲县| 东兴市| 繁峙县| 仁布县| 海伦市|