Cloning Pervasync Client to Avoid Costly Initial Sync

Initial sync could take a long time if you have Gigabytes of application data or files to sync. If a lot of the data or files are shared by all or groups of your clients, you could use cloning to avoid doing an initial sync for each client.

NOTE: “Sharing the same data or files” means that clients subscribe to a schema table or a sync folder with the same parameter values. This includes no parameter subscriptions.

Let’s call the client to clone from the “seed client” and the client to clone to the “target client”. The idea is to sync the data and files to the seed client, make a copy of the seed client and change the client ID and user name to those of the target client. Following are the cloning steps.

  1. Create publications, clients and subscriptions on Pervasync Admin Console.
  2. Install and sync the seed client. For fast synchronization, install the client on the same host or network as the Pervasync server.
  3. Copy the seed client to target client hosts. Includes Pervasync client home folder, local database and folders synced to client. Refer to documentation of the specific database type (Oracle, MySQL) on how to clone the database schemas to another host. Remember to include both Pervasync admin schema (default “pvcadmin”) and the application schema(s) when you clone the databases.
  4. On Pervasync Admin Console, click on the “Clients” tab and find the client ID, user name and device name of the target client. Also create subscriptions for the target client if you haven’t done so.
  5. On the target client host, connect to the Pervasync admin schema (default “pvcadmin”) of the local database. Change the client ID, user name and device name in table pvc$sync_client_properties from seed client to target client. Assuming your target client ID is 12, client name is “user_2” and device name is “DEFAULT”, do the following:

    update pvcadmin.pvc$sync_client_properties set value=’12’ where name = ‘pervasync.client.id’;

    update pvcadmin.pvc$sync_client_properties set value=’user_2′ where name = ‘pervasync.user.name’;

    update pvcadmin.pvc$sync_client_properties set value=’DEFAULT’ where name = ‘pervasync.device.name’;

  6. On the target client host, open file <Pervasync Client Home>/config/pervasync_install.dat. You may need to change some parameter values. For example, if the database is on a different host than the sync client host, you will need to correct values of pervasync.client.db.url and pervasync.client.host.

    NOTE: If Pervasync client and DB are on the same host, you should use “localhost” in the values when you setup the seed client. Then you don’t need to update the pervasync_install.dat file.

  7. On the target client host, launch the sync client (pvc.bat or pvc.sh). You will find that the new values are reflected on the “Setup” tab. Use the same tab to update sync user password if needed.
  8. Start a sync session. You will see that shared data/files are not re-synced while client specific data/file subscriptions are synced to client.

NOTE: Make sure you have all the sync folder files on the target host. Any missing files will cause delete operations sent to server during synchronization. To avoid accidental deletions, consider using REFRESH-ONLY sync or setting the server config parameter “pervasync.policy.check.in.deletes” to “DISCARD” depending on your business logic.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s