Search code examples
symmetricds

SymmetricDS File Synchronization Router


I have 3 nodes (corp, store-1, store-2). I want to do file synchronization that filtering based on node's external.id. So the file is synchronizing to the right nodes (not to all nodes). I read the docs that column match router can do filtered synchronization, but the example is in database synchronization.

How to do that in file synchronization? Thanks.


Solution

  • use the same router linked through file_trigger_router to your file_trigger for filtering which files go to which target nodes

    here's an example: http://www.symmetricds.org/doc/3.5/html-single/user-guide.html#filesync-example-2

    INSERT INTO sym_file_trigger
      (trigger_id,base_dir,recurse,includes_files,excludes_files,sync_on_create,
      sync_on_modified,sync_on_delete,before_copy_script,after_copy_script,create_time,
      last_update_by,last_update_time)
    VALUES
      ('node_specific','/filesync/server/nodes',1,null,null,1,1,1,'',null,
      current_timestamp,'example',current_timestamp);
    
    INSERT INTO sym_file_trigger_router
      (trigger_id,router_id,enabled,initial_load_enabled,target_base_dir,
      conflict_strategy,create_time,last_update_by,last_update_time)
    VALUES
      ('node_specific','router_files_to_node',1,1,'/filesync/clients','SOURCE_WINS',
      current_timestamp,'example',current_timestamp);
    
    INSERT INTO sym_router
      (router_id,target_catalog_name,target_schema_name,target_table_name,
       source_node_group_id,target_node_group_id,router_type,router_expression,
       sync_on_update,sync_on_insert,sync_on_delete,create_time,last_update_by,
       last_update_time)
    VALUES
      ('router_files_to_node',null,null,null,'server','client','column',
      'RELATIVE_DIR = :NODE_ID ',1,1,1,current_timestamp,'example', current_timestamp);