Reputation: 103
I am trying to get the example from the SymmetricDS tutorial to work. I am using the configuration files corp-000.properties and store-001.properties found in the samples directory of the download zip. I have placed them in the engine directory and edited them so that corp-000 is using a MySQL DB and store-001 is using an H2 DB, both on my local machine.
Here are the registration and synch urls from the corp-000.properties:
registration.url=
sync.url= http : // localhost : 31415 / sync / corp-000
Here are the ones in store-001:
registration.url= http: // localhost : 31415 / sync / corp-000
sync.url= http : // localhost : 31415 / sync / corp-000
When I run bin/sym, it finds the two databases. But then, store-001 reports:
[store-001] - DefaultOfflineClientListener - Failed to connect to the transport: http: // localhost : 8080 / sync / corp-000
[store-001] - PushService - Could not communicate with corp:000:000 at http: // localhost : 8080 / sync / corp-000 because: Connection refused
This is a mystery since port 8080 is not specified anywhere in the two properties file.
Note: the URLs above don't have spaces in the properties files. I had to do that to get Stackoverflow to allow me to have them in my question.
Thank you in advance for assistance.
Upvotes: 1
Views: 2250
Reputation: 4763
I too have been trying to get the SymmetricDS tutorial to work.
It is all new to me and I ran into a number of issues which took a long while to resolve, due to my inexperience with Java databases and Java database drivers etc., in addition to SymmeticDS also being new to me.
Description
There are instructions like
../bin/sym --port 8080 --server
but in other places the default port is 31415, which I remember by thinking of pi, 3.1415926....
Solution
I have an Apache web server running on localhost and so for testing SymmeticDS I adapted port 8080 instruction to use 31415, though the other way around might make more sense to most people living with firewalls etc. Since both engines (corp and store-001) are running on the same machine, firewalls etc are not a problem for the tutorial, though I expect they may trouble me later.
Description and Solution
I needed to download and install some JDBC H2 database drivers to get things to work.
Description
In places the tutorial asks you to run some SQL commands against the H2 database corp-000 or store-001. I am used to MySQL WorkBench and MS SQL Server Management Studio and needed somthing similar to allow me to open the databases, see their contents and run SQL commands.
Solution
I used something (called a console viewer I believe) that runs in normal web browser. I downloaded and installed things from the H2 database website.
Some of the commands were crashing with error messages like table ITEM (uppercase) not found. Inspecting my database showed that there was a table called item (lowercase). The issue arises due to table and field names being defaulted to uppercase in standard SQL unless they are quoted. So in SQL
item
means ITEM whereas
'item'
means item. So (for example) this line from the tutorial
insert into item (item_id, price_id, name) values (110000055, 55, 'Soft Drink');
is incorrect if table names are lower case, e.g. for a table called 'item'.
Solution
I went through and converted table names and column names to uppercase in the files that came with the tutorial. It was more work than I expect other people to want to do. I wanted to contribute my changes to SymmetricDS but gave up when I read about signing and posting off copyright agreements. I picked uppercase as my standard for the names so that any sloppyness by myself or SymmetricDS over the quoting the names would no longer be a show stopper. Also, any poor SQL implementations that either insisted on having quotes or insisted on not having quotes in some places could still be made to work. For example if a poorly implemented driver didn't like quotes then ITEM instead of 'ITEM' would still work, whereas item or ITEM instead of 'item' would not.
Description
Changes in the H2 database software seem to be in progress with some default seeming to use *.mv.db files.
jdbc:h2:file:C:/Work/symmetric-server-3.7.34/tmp/h2/corp;MV_STORE=FALSE;AUTO_SERVER=TRUE
Solution
The addition of
;MV_STORE=FALSE
to my connection strings in my browser seemed to fix that.
Description
I couldn't run SQL commands against the H2 databases (to create new data to sync) while the databases were already open by SymmetricDS, which was trying to sync them.
Solution
jdbc:h2:file:C:/Work/symmetric-server-3.7.34/tmp/h2/corp;MV_STORE=FALSE;AUTO_SERVER=TRUE
The addition of
;AUTO_SERVER=TRUE
in the console/browser connection strings fixed that. You might notice that I have the full paths to my database too. I am not sure whether I needed that or just added it when trying to fix one of the problems listed above.
Upvotes: 0
Reputation: 11
Quite late to post an answer but there's a mistake in the property file of store-001:
registration.url should point to your root node (which is corp-000), not to localhost.
I suggest to replace localhost with corp-000 IP address or network name:
registration.url=http://<Corp-000-IPAddress>:31415/sync/corp-000
Upvotes: 1
Reputation: 64632
Try replacing:
sync.url= http : // localhost : 31415 / sync / corp-000
with
sync.url=http://localhost:31415/sync/corp-000
then:
registration.url= http: // localhost : 31415 / sync / corp-000
with
registration.url=http://localhost:31415/sync/corp-000
and
sync.url= http : // localhost : 31415 / sync / corp-000
with
sync.url=http://localhost:31415/sync/corp-000
i.e. remove all spaces (blanks) from URLs.
Upvotes: 0