MySQL Forums
Forum List  »  NDB clusters

Master-Master Replication
Posted by: Shannon Joyner
Date: December 04, 2017 08:52PM

Hello,
I'm trying to set up master-master replication for MySQL and use TPCC to benchmark the setup.

This is the my.cnf file for the primary master (master in the first cluster).

[mysqld]
auto_increment_increment=2
auto_increment_offset=1
binlog-do-db=mysql
binlog-do-db=tpcc
ndbcluster
ndb_connectstring=server-1
log_bin=mysql-bin
log_slave_updates
server_id=12
ndb_log_update_as_write=OFF
ndb_log_updated_only=OFF
ndb_log_apply_status=ON
log_bin_use_v1_row_events=OFF
ndb_log_transaction_id=ON
binlog_format=ROW
default-storage-engine=ndbcluster
log-error=/var/log/mysql/mysql.err
ndb-nodeid=12
relay-log=slave-relay-bin
relay-log-index=slave-relay-bin.index
skip_slave_start
ndb_slave_conflict_role=PRIMARY
[mysql_cluster]
ndb-connectstring=server-1

This is the my.cnf file for the secondary master (master in the second cluster).

[mysqld]
auto_increment_increment=2
auto_increment_offset=2
binlog-do-db=mysql
binlog-do-db=tpcc
ndbcluster
ndb_connectstring=server-15
log_bin=mysql-bin
log_slave_updates
server_id=26
ndb_log_update_as_write=OFF
ndb_log_updated_only=OFF
ndb_log_apply_status=ON
log_bin_use_v1_row_events=OFF
ndb_log_transaction_id=ON
binlog_format=ROW
default-storage-engine=ndbcluster
log-error=/var/log/mysql/mysql.err
ndb-nodeid=26
relay-log=slave-relay-bin
relay-log-index=slave-relay-bin.index
skip_slave_start
ndb_slave_conflict_role=SECONDARY
[mysql_cluster]
ndb-connectstring=server-15

I want to have exception tables for every TPCC table. I created the mysql.replication table, the TPCC tables, and the exception tables on the primary. This is the replication table.

mysql> describe ndb_replication;
+-------------+------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------------+------------------+------+-----+---------+-------+
| db | varbinary(63) | NO | PRI | | |
| table_name | varbinary(63) | NO | PRI | | |
| server_id | int(10) unsigned | NO | PRI | 0 | |
| binlog_type | int(10) unsigned | YES | | NULL | |
| conflict_fn | varbinary(128) | YES | | NULL | |
+-------------+------------------+------+-----+---------+-------+
5 rows in set (0.00 sec)

I need to be able to run conflicting updates. If I run conflicting updates on the primary and secondary (both nodes attempting to delete the same records), the secondary node stops acting as a slave.

2017-12-05 02:34:33 5377 [ERROR] Slave SQL: Could not execute Delete_rows event on table tpcc.HISTORY; Can't find record in 'HISTORY', Error_code: 1032; handler error HA_ERR_END_OF_FILE; the event's master log mysql-bin.000010, end_log_pos 94759, Error_code: 1032
2017-12-05 02:34:33 5377 [Warning] Slave: Can't find record in 'HISTORY' Error_code: 1032
2017-12-05 02:34:33 5377 [ERROR] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with "SLAVE START". We stopped at log 'mysql-bin.000010' position 94091

I saw that usually the solution for this is to add SET GLOBAL sql_slave_skip_counter = 1.

I added this to both master MySQL nodes, but when I do this, the secondary node no longer syncs the replication table. I checked the error logs and I don't see any attempts made at syncing the replication table.

Does anyone know what I'm doing incorrectly? Thanks!

Options: ReplyQuote


Subject
Views
Written By
Posted
Master-Master Replication
1687
December 04, 2017 08:52PM
620
December 05, 2017 07:59AM
656
December 05, 2017 10:26AM
600
December 07, 2017 04:10PM
638
December 11, 2017 06:25PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.