Reputation: 31
Has anyone achieved a bidirectional configuration with SymmetricDS?
There are many things to configure, and i got most of them:
server.properties:
#XXXXXXX nombre de la cabana
#SSSSSSS ip del servidor
engine.name=XXXXXXXXXXX
# The class name for the JDBC Driver
db.driver=com.mysql.jdbc.Driver
# The JDBC URL used to connect to the database
db.url=jdbc:mysql://localhost/HutteBullen_XXXXXXXXXXX? tinyInt1isBit=false
# The user to login as who can create and update tables
db.user=aDDD
# The password for the user to login as
db.password=CC
registration.url=http://SSSSSSS:31415/sync/XXXXXXXXXXX
sync.url=http://SSSSSSS:31415/sync/XXXXXXXXXXX
# Do not change these for running the demo
group.id=server
external.id=000
initial.load.create.first=true
auto.registration = true
auto.reload = true
create.table.without.foreign.keys=true
Client is embedded HSQL
client.properties(Generated in the code):
Properties props = new Properties();
props.setProperty("engine.name", "cabana-" + args[0]);
props.setProperty("db.driver", "org.hsqldb.jdbcDriver");
props.setProperty("db.user", args[1]);
props.setProperty("db.password", args[2]);
props.setProperty("registration.url", "http://" + args[4] + ":31415/sync/" + args[5]);
props.setProperty("group.id", "cabana");
props.setProperty("external.id", args[0]);
props.setProperty("job.routing.period.time.ms", "5000");
props.setProperty("job.push.period.time.ms", "10000");
props.setProperty("job.pull.period.time.ms", "10000");
props.setProperty("job.heartbeat.period.time.ms", "15000");
props.setProperty("intial.load.create.first", "true");
props.setProperty("create.table.without.foreign.keys", "true");
props.setProperty("create.table.without.defaults", "true");
The Triggers:
insert into sym_trigger (trigger_id,source_table_name, channel_id, last_update_time,create_time, sync_on_incoming_batch)
values('TriggerAll', '*', 'transaction', current_timestamp, current_timestamp,1);
insert into sym_trigger_router (trigger_id,router_id,initial_load_order,last_update_time,create_time)
values('TriggerAll','server_2_cabana', 100, current_timestamp,current_timestamp);
insert into sym_trigger_router (trigger_id,router_id,initial_load_order,last_update_time,create_time)
values('TriggerAll','cabana_2_server', 200, current_timestamp, current_timestamp);
And then, the problem, the sym_conflict(in the server):
insert into sym_conflict (conflict_id, target_channel_id, source_node_group_id, target_node_group_id, detect_type, detect_expression, resolve_type,ping_back, resolve_changes_only, resolve_row_only, create_time, last_update_time)
values ('Conflict-Server-Cabana', 'transaction', 'server', 'cabana', 'USE_TIMESTAMP', 'LASTMODIFIEDUTCDATETIME', 'NEWER_WINS', 'REMAINING_ROWS', 0, 1, current_timestamp, current_timestamp);
insert into sym_conflict (conflict_id, target_channel_id, source_node_group_id, target_node_group_id, detect_type, detect_expression, resolve_type,ping_back, resolve_changes_only, resolve_row_only, create_time, last_update_time)
values ('Conflict-Cabana-Server', 'transaction', 'cabana', 'server', 'USE_TIMESTAMP', 'LASTMODIFIEDUTCDATETIME', 'NEWER_WINS', 'REMAINING_ROWS', 0, 1, current_timestamp, current_timestamp);
The big problem is the next one: I have many nodes that sync in a star topology. All of them sync in a bi-directional way. All of them have the same schema, and should have the exact same data.
Inserts, and updates work correctly with the configuration above. The problems are the deletes. I am node one, and i create a row, and then it gets synced to the central server, and then to node two. And then node two decides to delete this row, it gets deleted on node two and then on the server, but not on the node that created the row, and i dont know why!. It doesn't stay consistent.
Did anybody achieve full bi-directional replication with SymmetricDS?
Upvotes: 3
Views: 2070
Reputation: 64632
Set the value for the column sync_on_incoming_batch
to 1 as explained in the documentation http://www.symmetricds.org/doc/3.8/html/user-guide.html#_bi_directional_synchronization
Upvotes: 1