Skip to content

Commit

Permalink
update descriptions, remove manual inserts to node tables
Browse files Browse the repository at this point in the history
  • Loading branch information
erilong committed Jan 10, 2019
1 parent 7a341bc commit c3e84a7
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 50 deletions.
33 changes: 24 additions & 9 deletions symmetric-server/src/main/deploy/samples/corp-000.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
# under the License.
#

# Friendly name to refer to this node from command line
engine.name=corp-000

# The class name for the JDBC Driver
Expand Down Expand Up @@ -53,27 +54,41 @@ db.driver=org.h2.Driver
#db.url=jdbc:com.nuodb://localhost/database?schema=database
db.url=jdbc:h2:corp;AUTO_SERVER=TRUE;LOCK_TIMEOUT=60000

# The user to login as who can create and update tables
db.user=sa
# The database user that SymmetricDS should use.
db.user=symmetric

# The password for the user to login as
# The database password
db.password=

# This node will contact the root node's sync.url to register itself.
# Leave blank to indicate this is the root node.
registration.url=

# Sync URL where other nodes can contact this node to push/pull data or register.
sync.url=http://localhost:31415/sync/corp-000

# Do not change these for running the demo
# Node group this node belongs to, which defines what it will sync with who.
# Must match the sym_node_group configuration in database.
group.id=corp

# External ID for this node, which is any unique identifier you want to use.
external.id=000

# Don't muddy the waters with purge logging
# How often to run purge job,
job.purge.period.time.ms=7200000

# This is how often the routing job will be run in milliseconds
# How to run routing (in millis), which puts changes into batches.
job.routing.period.time.ms=5000
# This is how often the push job will be run.

# How often to run push (in millis), which sends changes to other nodes.
job.push.period.time.ms=10000
# This is how often the pull job will be run.

# How often to run pull (in millis), which receives changes from other nodes.
job.pull.period.time.ms=10000
# Kick off initial load

# Automatically register new nodes when they request it.
# If this is false, accept the registration requests using "symadmin open-registration" command.
auto.registration=true

# When this node sends an initial load of data to another node, first send table create scripts.
initial.load.create.first=true
61 changes: 44 additions & 17 deletions symmetric-server/src/main/deploy/samples/insert_sample.sql
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,20 @@
------------------------------------------------------------------------------
-- Sample Data
------------------------------------------------------------------------------

-- Items to sell and their prices
insert into item (item_id, name) values (11000001, 'Yummy Gum');
insert into item_selling_price (item_id, store_id, price, cost) values (11000001, '001',0.20, 0.10);
insert into item_selling_price (item_id, store_id, price, cost) values (11000001, '002',0.30, 0.20);

-- Sales transactions and line items
insert into sale_transaction (tran_id, store_id, workstation, day, seq)
values (900, '001', '3', '2012-12-01', 90);
insert into sale_return_line_item (tran_id, item_id, price, quantity, returned_quantity)
values (900, 11000001, 0.20, 1, 0);

------------------------------------------------------------------------------
-- Sample Symmetric Configuration
-- Clear and load SymmetricDS Configuration
------------------------------------------------------------------------------

delete from sym_trigger_router;
Expand All @@ -46,20 +49,42 @@ delete from sym_node_identity;
delete from sym_node_security;
delete from sym_node;

------------------------------------------------------------------------------
-- Channels
------------------------------------------------------------------------------

-- Channel "sale_transaction" for tables related to sales and refunds
insert into sym_channel
(channel_id, processing_order, max_batch_size, enabled, description)
values('sale_transaction', 1, 100000, 1, 'sale_transactional data from register and back office');

-- Channel "item" for tables related to items for purchase
insert into sym_channel
(channel_id, processing_order, max_batch_size, enabled, description)
values('item', 1, 100000, 1, 'Item and pricing data');

------------------------------------------------------------------------------
-- Node Groups
------------------------------------------------------------------------------

insert into sym_node_group (node_group_id) values ('corp');
insert into sym_node_group (node_group_id) values ('store');

------------------------------------------------------------------------------
-- Node Group Links
------------------------------------------------------------------------------

-- Corp sends changes to Store when Store pulls from Corp
insert into sym_node_group_link (source_node_group_id, target_node_group_id, data_event_action) values ('corp', 'store', 'W');

-- Store sends changes to Corp when Store pushes to Corp
insert into sym_node_group_link (source_node_group_id, target_node_group_id, data_event_action) values ('store', 'corp', 'P');

------------------------------------------------------------------------------
-- Triggers
------------------------------------------------------------------------------

-- Triggers for tables on "item" channel
insert into sym_trigger
(trigger_id,source_table_name,channel_id,last_update_time,create_time)
values('item_selling_price','item_selling_price','item',current_timestamp,current_timestamp);
Expand All @@ -68,6 +93,7 @@ insert into sym_trigger
(trigger_id,source_table_name,channel_id,last_update_time,create_time)
values('item','item','item',current_timestamp,current_timestamp);

-- Triggers for tables on "sale_transaction" channel
insert into sym_trigger
(trigger_id,source_table_name,channel_id,last_update_time,create_time)
values('sale_transaction','sale_transaction','sale_transaction',current_timestamp,current_timestamp);
Expand All @@ -76,6 +102,7 @@ insert into sym_trigger
(trigger_id,source_table_name,channel_id,last_update_time,create_time)
values('sale_return_line_item','sale_return_line_item','sale_transaction',current_timestamp,current_timestamp);

-- Triggers with capture disabled, so they are used for initial load only
insert into sym_trigger
(trigger_id,source_table_name,channel_id, sync_on_insert, sync_on_update, sync_on_delete,last_update_time,create_time)
values('sale_transaction_corp','sale_transaction','sale_transaction',0,0,0,current_timestamp,current_timestamp);
Expand All @@ -84,26 +111,41 @@ insert into sym_trigger
(trigger_id,source_table_name,channel_id, sync_on_insert, sync_on_update, sync_on_delete,last_update_time,create_time)
values('sale_return_line_item_corp','sale_return_line_item','sale_transaction',0,0,0,current_timestamp,current_timestamp);

------------------------------------------------------------------------------
-- Routers
------------------------------------------------------------------------------

-- Default router sends all data from corp to store
insert into sym_router
(router_id,source_node_group_id,target_node_group_id,router_type,create_time,last_update_time)
values('corp_2_store', 'corp', 'store', 'default',current_timestamp, current_timestamp);

-- Default router sends all data from store to corp
insert into sym_router
(router_id,source_node_group_id,target_node_group_id,router_type,create_time,last_update_time)
values('store_2_corp', 'store', 'corp', 'default',current_timestamp, current_timestamp);

-- Column match router will subset data from corp to specific store
insert into sym_router
(router_id,source_node_group_id,target_node_group_id,router_type,router_expression,create_time,last_update_time)
values('corp_2_one_store', 'corp', 'store', 'column','STORE_ID=:EXTERNAL_ID or OLD_STORE_ID=:EXTERNAL_ID',current_timestamp, current_timestamp);


------------------------------------------------------------------------------
-- Trigger Routers
------------------------------------------------------------------------------

-- Send all items to all stores
insert into sym_trigger_router
(trigger_id,router_id,initial_load_order,last_update_time,create_time)
values('item','corp_2_store', 100, current_timestamp, current_timestamp);

-- Send item prices to associated stores
insert into sym_trigger_router
(trigger_id,router_id,initial_load_order,initial_load_select,last_update_time,create_time)
values('item_selling_price','corp_2_one_store',100,'store_id=''$(externalId)''',current_timestamp,current_timestamp);

-- Send all sales transactions to corp
insert into sym_trigger_router
(trigger_id,router_id,initial_load_order,last_update_time,create_time)
values('sale_transaction','store_2_corp', 200, current_timestamp, current_timestamp);
Expand All @@ -112,6 +154,7 @@ insert into sym_trigger_router
(trigger_id,router_id,initial_load_order,last_update_time,create_time)
values('sale_return_line_item','store_2_corp', 200, current_timestamp, current_timestamp);

-- Send all sales transactions to store during initial load
insert into sym_trigger_router
(trigger_id,router_id,initial_load_order,last_update_time,create_time)
values('sale_transaction_corp','corp_2_store', 200, current_timestamp, current_timestamp);
Expand All @@ -120,19 +163,3 @@ insert into sym_trigger_router
(trigger_id,router_id,initial_load_order,last_update_time,create_time)
values('sale_return_line_item_corp','corp_2_store', 200, current_timestamp, current_timestamp);

insert into sym_node (node_id,node_group_id,external_id,sync_enabled,sync_url,schema_version,symmetric_version,database_type,database_version,batch_to_send_count,batch_in_error_count,created_at_node_id)
values ('000','corp','000',1,null,null,null,null,null,0,0,'000');
insert into sym_node (node_id,node_group_id,external_id,sync_enabled,sync_url,schema_version,symmetric_version,database_type,database_version,batch_to_send_count,batch_in_error_count,created_at_node_id)
values ('001','store','001',1,null,null,null,null,null,0,0,'000');
insert into sym_node (node_id,node_group_id,external_id,sync_enabled,sync_url,schema_version,symmetric_version,database_type,database_version,batch_to_send_count,batch_in_error_count,created_at_node_id)
values ('002','store','002',1,null,null,null,null,null,0,0,'000');


insert into sym_node_security (node_id,node_password,registration_enabled,registration_time,initial_load_enabled,initial_load_time,created_at_node_id)
values ('000','5d1c92bbacbe2edb9e1ca5dbb0e481',0,current_timestamp,0,current_timestamp,'000');
insert into sym_node_security (node_id,node_password,registration_enabled,registration_time,initial_load_enabled,initial_load_time,created_at_node_id)
values ('001','5d1c92bbacbe2edb9e1ca5dbb0e481',1,null,1,null,'000');
insert into sym_node_security (node_id,node_password,registration_enabled,registration_time,initial_load_enabled,initial_load_time,created_at_node_id)
values ('002','5d1c92bbacbe2edb9e1ca5dbb0e481',1,null,1,null,'000');

insert into sym_node_identity values ('000');
20 changes: 13 additions & 7 deletions symmetric-server/src/main/deploy/samples/store-001.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
# under the License.
#

# Friendly name to refer to this node from command line
engine.name=store-001

# The class name for the JDBC Driver
Expand Down Expand Up @@ -53,22 +54,27 @@ db.driver=org.h2.Driver
#db.url=jdbc:com.nuodb://localhost/database?schema=database
db.url=jdbc:h2:store001;AUTO_SERVER=TRUE;LOCK_TIMEOUT=60000

# The user to login as who can create and update tables
# The database user that SymmetricDS should use.
db.user=symmetric

# The password for the user to login as
# The database password
db.password=

# The HTTP URL of the root node to contact for registration
# This node will contact the root node's sync.url to register itself.
registration.url=http://localhost:31415/sync/corp-000

# Do not change these for running the demo
# Node group this node belongs to, which defines what it will sync with who.
# Must match the sym_node_group configuration in database.
group.id=store

# External ID for this node, which is any unique identifier you want to use.
external.id=001

# This is how often the routing job will be run in milliseconds
# How to run routing (in millis), which puts changes into batches.
job.routing.period.time.ms=5000
# This is how often the push job will be run.

# How often to run push (in millis), which sends changes to other nodes.
job.push.period.time.ms=10000
# This is how often the pull job will be run.

# How often to run pull (in millis), which receives changes from other nodes.
job.pull.period.time.ms=10000
40 changes: 23 additions & 17 deletions symmetric-server/src/main/deploy/samples/store-002.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
# under the License.
#

# Friendly name to refer to this node from command line
engine.name=store-002

# The class name for the JDBC Driver
Expand All @@ -38,37 +39,42 @@ engine.name=store-002
db.driver=org.h2.Driver

# The JDBC URL used to connect to the database
#db.url=jdbc:mysql://localhost/store002?tinyInt1isBit=false
#db.url=jdbc:oracle:thin:@127.0.0.1:1521:store002
#db.url=jdbc:postgresql://localhost/store002?stringtype=unspecified
#db.url=jdbc:derby:store002;create=true
#db.url=jdbc:hsqldb:file:store002;shutdown=true
#db.url=jdbc:jtds:sqlserver://localhost:1433/store002;useCursors=true;bufferMaxMemory=10240;lobBuffer=5242880
#db.url=jdbc:db2://localhost/store002
#db.url=jdbc:informix-sqli://localhost:9088/store002:INFORMIXSERVER=ol_ids_1150_1
#db.url=jdbc:mysql://localhost/store001?tinyInt1isBit=false
#db.url=jdbc:oracle:thin:@127.0.0.1:1521:store001
#db.url=jdbc:postgresql://localhost/store001?stringtype=unspecified
#db.url=jdbc:derby:store001;create=true
#db.url=jdbc:hsqldb:file:store001;shutdown=true
#db.url=jdbc:jtds:sqlserver://localhost:1433/store001;useCursors=true;bufferMaxMemory=10240;lobBuffer=5242880
#db.url=jdbc:db2://localhost/store001
#db.url=jdbc:informix-sqli://localhost:9088/store001:INFORMIXSERVER=ol_ids_1150_1
#db.url=jdbc:firebirdsql:localhost:/var/lib/firebird/data/databasename
#db.url=jdbc:interbase://localhost//opt/interbase/data/store002.gdb
#db.url=jdbc:sqlite:store002.sqlite
#db.url=jdbc:interbase://localhost//opt/interbase/data/store001.gdb
#db.url=jdbc:sqlite:store001.sqlite
#db.url=jdbc:sybase:Tds:localhost:5000/databasename
#db.url=jdbc:com.nuodb://localhost/database?schema=database
db.url=jdbc:h2:store002;AUTO_SERVER=TRUE;LOCK_TIMEOUT=60000

# The user to login as who can create and update tables
# The database user that SymmetricDS should use.
db.user=symmetric

# The password for the user to login as
# The database password
db.password=

# The HTTP URL of the root node to contact for registration
# This node will contact the root node's sync.url to register itself.
registration.url=http://localhost:31415/sync/corp-000

# Do not change these for running the demo
# Node group this node belongs to, which defines what it will sync with who.
# Must match the sym_node_group configuration in database.
group.id=store

# External ID for this node, which is any unique identifier you want to use.
external.id=002

# This is how often the routing job will be run in milliseconds
# How to run routing (in millis), which puts changes into batches.
job.routing.period.time.ms=5000
# This is how often the push job will be run.

# How often to run push (in millis), which sends changes to other nodes.
job.push.period.time.ms=10000
# This is how often the pull job will be run.

# How often to run pull (in millis), which receives changes from other nodes.
job.pull.period.time.ms=10000

0 comments on commit c3e84a7

Please sign in to comment.