Comments - Multi-Source Replication
Content reproduced on this site is the property of its respective owners,
and this content is not reviewed in advance by MariaDB. The views, information and opinions
expressed by this content do not necessarily represent those of MariaDB or any other party.
HOW TO START A SINGLE MULTI SOURCE REPLICATION WITH WINDOWS + MARIADB 10.0.0
1)Install MariaDB 10.x
2)Open 3 MariaDB terminals
3)Run 3 MariaDB instances, example:
"C:/Program Files/MariaDB 10.0/bin/mysqld" --datadir="C:/Program Files/MariaDB 10.0/data1" --log-error="C:/Program Files/MariaDB 10.0/log/1.log" --port=3306 --server-id=1 --relay_log_space_limit=1024000000 --log-bin=bin1 --binlog-do-db=t1
"C:/Program Files/MariaDB 10.0/bin/mysqld" --datadir="C:/Program Files/MariaDB 10.0/data2" --log-error="C:/Program Files/MariaDB 10.0/log/2.log" --port=3307 --server-id=2 --relay_log_space_limit=1024000000 --log-bin=bin2 --binlog-do-db=t2
"C:/Program Files/MariaDB 10.0/bin/mysqld" --datadir="C:/Program Files/MariaDB 10.0/data3" --log-error="C:/Program Files/MariaDB 10.0/log/3.log" --port=3308 --server-id=3
Here server-id 1 and 2 are masters, and 3 is slave
4)Create database t1 in server-id=1, and t2 in server-id=2, like:
CREATE TABLE t1; CREATE TABLE t2;
5)Check if t1 and t2 exists in server-id=3 (slave), if not create it
6)Configure Masters in server-id=3:
SET @@default_master_connection='t1';
CHANGE MASTER 't1' TO MASTER_HOST = '127.0.0.1', MASTER_USER = 'user', MASTER_PASSWORD = 'password', MASTER_PORT = 3306;
SET @@default_master_connection='t2';
CHANGE MASTER 't2' TO MASTER_HOST = '127.0.0.1', MASTER_USER = 'user', MASTER_PASSWORD = 'password', MASTER_PORT = 3307;
7)Here Slave is up, now let's check status: (at server-id=3) SHOW ALL SLAVES STATUS you will see two connection (if everything is ok)
8)Check Masters: (at server-id=1 and 2)
SHOW MASTER STATUS;
you will see log files and positions
9)Start replications: (at server-id=3)
START ALL SLAVES;
10)TEST IT! =D (open server-id=1)
CREATE TABLE t (a int);
INSERT INTO t VALUES (0),(1),(2),(3);
11)CHECK REPLICATION (open server-id=3)
USE t1;
SELECT * FROM t;
you will see 0,1,2,3 rows! :D
12) BE HAPPY =D
Environment: MariaDB10.6.8, Two machines: node1 and node2 node1 and node2 are in active/secondary mode
binlog logs of node1 are normal
The binlogs log of node2 reports the following error: Error during XID COMMIT; failed to update GTID state in mysql.gtid_slave_pos:1062: Duplicate entry '0-100243250' for key 'PRIMARY'
I would like to ask you, what is the cause of this factor, how can you repeat this situation