View source | Discuss this page | Page history | Printable version   
Toolbox
Main Page
Upload file
What links here
Recent changes
Help

PDF Books
Add page
Show collection (0 pages)
Collections help

Search

How to Set Up and Start the Synchronization Engine

Contents

Introduction

It is very easy to set up and start the SymmetricDS engine. The SetupSymmetricListener does it automatically, based on the contents of the symmetric-ds.properties file and the list of tables to be synchronized (see how to configure the synchronization of a table).

Note: for symmetric ds to work correctly it is important that the source.path property in the Openbravo.properties should be set correctly.

Install the module

First install the module by cloning it like this in the modules directory of your development project:

hg clone https://code.openbravo.com/erp/pmods/org.openbravo.replication.symmetricds

The module will be offered on the Openbravo forge in a later stadium.

Note: If you are on OB Commerce 16Q1 development then you need to apply a changeset to get the right dbsourcemanager. This is described in the README which is present in the replication symmetric ds module.

It most of the time makes sense to install an additional module which contains the sync definition (for syncing masterdata from main server to store server):

These modules have to be inserted both in the central and in the store servers.

Then rebuild the system using ant smartbuild -Dlocal=no.

Installing SymmetricDS in the Main Server

To install SymmetricDS in the main server, the install.symmetric.ds ant task needs to be invoked:

ant -f modules/org.openbravo.replication.symmetricds/build.xml install.symmetric.ds

That task will:

Once the task has been invoked, the symmetric-ds.properties file needs to be copied to the WEB-INF folder, for instance by running the ant smartbuild task.

Installing SymmetricDS in a Store Server

There is no need to install SymmetricDS manually in the store servers, apart from cloning the modules as explained in the previous section. When Tomcat is started in a store server, the synchronization properties file will be automatically created based on the configuration of the mobile servers, and those properties will be used to set up and start the synchronization engine. As part of the start up procedure of the synchronization engine, it will issue a registration request to the main server. Once the store server has been successfully registered, it will load all the non node specific synchronization properties from the main server.

Uninstalling SymmetricDS

The SymmetricDS database objects can be uninstalled at any moment by running the ant uninstall.symmetric.ds task in the org.openbravo.replication.symmetricds module. This process must be executed also in the store servers, even though the install.symmetric.ds task is not run in those servers.

Updating an environment where SymmetricDS is installed

The following steps needs to be executed in order to update an environment where SymmetricDS is installed:

Giving registration access to a server

For a store server to be given registration access, the Can Be Registered flag of its entry in the Mobile Servers window must be activated. Until then, all its registration requests will be rejected.

GrantRegistration.png

How to give custom values to SymmetricDS parameters

The Default Synchronization Parameters window can be used to modify the default value of SymmetricDS's parameters. Check here the full list of configurable parameters. The contents of the Default Synchronization Parameters table are read only on Tomcat start, so it can be used to modify the value for both the Startup and Runtime parameters.

Note that, as that table is only read on Tomcat start, changes done to it will not take effect until Tomcat is restarted. To modify a SymmetricDS parameter live, the Synchronization Properties window must be used instead. The difference with the Default Synchronization Parameters window is that the changes done in the Synchronization Properties cannot be exported to modules, and will be reverted when Tomcat is restarted.

How to configure the SymmetricDS log

SymmetricDS uses log4j for logging, so you can configure the Openbravo log4j.lcf file to configure its logging. This is an example on how to do it, storing the SymmetricDS log in the ${catalina.base}/logs/symmetric.log file:

log4j.category.org.jumpmind.symmetric=INFO, SYMMETRIC, C
log4j.additivity.org.jumpmind.symmetric=false
log4j.appender.SYMMETRIC=org.apache.log4j.RollingFileAppender
log4j.appender.SYMMETRIC.File=${catalina.base}/logs/symmetric.log
log4j.appender.SYMMETRIC.MaxFileSize=10000KB
log4j.appender.SYMMETRIC.layout=org.apache.log4j.PatternLayout
log4j.appender.SYMMETRIC.layout.ConversionPattern=%d{ISO8601} %p [%X{engineName}] [%c{1}] [%t] %m%n
log4j.logger.org.jumpmind.symmetric.util.PropertiesFactoryBean=ERROR, SYMMETRIC

We recommend setting the log leve of the org.jumpmind.symmetric.util.PropertiesFactoryBean class to ERROR, that class is is very verbose and the messages that it logs are not useful.

Setting the additivity to false will prevent the SymmetricDS log from being logged in the appenders defined in the root category. For instance, the console appender and the Openbravo file appender are defined in the root category. SymmetricDS log will be shown in the console because it has been explicitely selected when defining the category, but it will not be shown in the Openbravo file appender.

Symmetric DS Clustering

Symmetric DS can be deployed in a clustered environment in combination with a clustered central server with multiple store servers. For background information, see this presentation.

To configure Symmetric DS for clustering, two properties must be provided to the SymmetricDS engine:

These properties will be automatically set if the hostname of the server (available from Java with System.getProperty("machine.name")) is defined. As described here, there are three ways to define the hostname:

Note that if the cluster.lock.enabled and cluster.server.id properties are defined in a non-clustered environment, there will not be any negative repercusion and SymmetricDS will work as usual.

There is an additional configuration parameter for Symmetric DS clustering:

Troubleshooting

Error when restarting tomcat: The configured state does not match recorded database state

When you see a message like this in your console or Openbravo.log:

8504 [symmetric-engine-startup-0] ERROR org.jumpmind.symmetric.AbstractSymmetricEngine - The configured state does not match recorded database state.  The recorded external id is 7EAAA333467244FE8527B7C57F082D4B while the configured external id is 2ABAF56A0FFD4764983814DE5A0C68F0. The recorded node group id is {} while the configured node group id is {}

This probably means that there is no symmetric-ds.properties file in the WEB-INF directory or it has invalid data.

FileNotFoundException in the log

When you see a message like this in the log:

Caused by: java.io.FileNotFoundException: http://main.openbravo.com:9080/openbravo/symmetric-ds/sync/registration?nodeGroupId=StoreServer&externalId=2ABAF56A0FFD4764983814DE5A0C68F0&syncURL=http%3A%2F%2Fstore1.openbravo.com%3A8080%2Fopenbravo%2Fsymmetric-ds%2Fsync&schemaVersion=%3F&databaseType=PostgreSQL&databaseVersion=9.3&symmetricVersion=development&hostName=oslo&ipAddress=192.168.1.14
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1626)

This is caused by a wrong url in the symmetric-ds.properties file. So you should check the symmetric-ds.properties file.

Installing in Postgresql 9.1

If the install.symmetric.ds task is run against a Postgresql 9.1 database the following error will occur:

[java] 9624 [main] ERROR org.jumpmind.symmetric.db.postgresql.PostgreSqlSymmetricDialect  - Please add "custom_variable_classes = 'symmetric'" to your postgresql.conf file

As the error messages describes, this problem is solved by adding this line to the postgresql.conf file and reloading postgresql:

custom_variable_classes = 'symmetric'

Retrieved from "http://wiki.openbravo.com/wiki/How_to_Set_Up_and_Start_the_Synchronization_Engine"

This page has been accessed 4,502 times. This page was last modified on 3 August 2017, at 09:14. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.