Sie sind auf Seite 1von 2

QUICK START

Setup Sync
0) cd ke symmetricds install dir (i.e $HOME/working/symmetric-server-3.9.2)
1) buat schema table aplikasi di db induk
./bin/dbimport --engine induk-000 --format XML --alter-case
samples/create_sample.xml

2) buat schema tabel-tabel sym di db induk


./bin/symadmin --engine induk-000 create-sym-tables

3) insert sample data ke db induk


./bin/dbimport --engine induk-000 samples/insert_sample.sql

4) start symmetricds service:


./bin/sym_service start

5) amati log:
tail -f logs/symmetric.log

6) jika tidak ada error (java exception) maka coba insert di induk dan di kedai.

Testing Sync
Testing router
router ada di table sym_router

Test router yang bertype default (router_type = default)


ada 2 router type default: induk_2_kedai , kedai_2_induk

1) induk_2_kedai: source group: induk, target group: kedai


di database induk:
INSERT INTO item (item_id,name) VALUES (99000001,'robot pemburu tikus 0x8080');

cek log, lalu cek hasil sync di database kedai01 dan kedai02:
SELECT * FROM item WHERE item_id = 99000001;

2) kedai_2_induk: source group: kedai, target group: induk


di database kedai01:
INSERT INTO sale_transaction (tran_id,kedai_id,workstation,day,seq) VALUES
(9901,'001',3,CAST(now() as DATE),90);

cek log, lalu cek hasil sync di database induk


SELECT * FROM sale_transaction WHERE tran_id=9901;
Test router yang bertype column (router_type = column)
Hanya ada 1 router type column:

induk_2_one_kedai: source group: induk, target group: kedai,


bedanya dg router bertype default adalah router ini men-sync data secara selektif, tidak ke semua
node di group kedai, tapi hanya yg memenuhi kondisi di router_expression,

router induk_2_one_kedai mempunyai router_expression sbb:


KEDAI_ID=:EXTERNAL_ID or OLD_KEDAI_ID=:EXTERNAL_ID

(artinya: data hanya di sync pada record yg memenuhi syarat kedai_id = :external_id atau
nilai old kedai_id= :external_id , nilai old adalah nilai sebelum diubah)

di database induk:
UPDATE item_selling_price SET price=price*1000,cost=cost*1000 WHERE item_id =
11000001 and kedai_id='001';

cek log, lalu cek hasil sync di database kedai01 (jika sync sukses maka record tsb harus ada)
SELECT * FROM item_selling_price WHERE item_id = 11000001;

lalu cek hasil sync di database kedai02 dg query yg sama (record tsb seharusnya *tidak* ada)

Testing trigger
Trigger ada di tabel sym_trigger
catatan: terutama dengan sync_on_incoming_batch, external_select, tx_id_expression,

channel_expression, ini adalah konsep2 yg tidak ada di versi 1.x

(yet to be done)

Das könnte Ihnen auch gefallen