Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Removed [WIP] for title, since this document is ready to use.

Table of Contents

Introduction

To sync data of specific entities or packages between two or more OFBiz instances, we can use EntitySync functionality of OOTB. Data synchronisation can achieve by pull and push of data between OFBiz instances. 

...

  1. Setup a ofbiz-master server with required data

  2. Set the Time Zone value of ofbiz-slave instance in ‘start.properties’ file of OFbiz similar to ofbiz-master instance or vice versa.

  3. Set sequenced-id-prefix  value for default delegator in ‘entityengine.xml’ on ofbiz-slave server

  4. Set the domain/IP of target(ofbiz-master) server in ‘serviceengine.xml’ file for entity-sync-http on ofbiz-slave server

  5. Set ‘maxPostSize’ value to "-1” for "http-connector” property in ‘framework/catalina/ofbiz-component.xml’ file on ofbiz-slave server

  6. Get SSL certificate of ofbiz-master server and install it on ofbiz-slave server

Data Pull from ofbiz-master to ofbiz-slave server

Below is example to pull Products data from ofbiz-master to ofbiz-slave server.

  1. Load below data on ofbiz-master server. This data defines the set of entities and packages that require to pull product data from master server. We can add/remove entities and packages as per data need

    Code Block
    languagexml
    <EntityGroup entityGroupId="PRODUCT_PULL" entityGroupName="Pull catalog, categories and product data from master server to slave Server"/>
    <!-- Catalogs -->
    <EntityGroupEntry entityGroupId="PRODUCT_PULL" entityOrPackage="org.apache.ofbiz.product.catalog" applEnumId="ESIA_INCLUDE"/>
    <!-- Categories -->
    <EntityGroupEntry entityGroupId="PRODUCT_PULL" entityOrPackage="org.apache.ofbiz.product.category" applEnumId="ESIA_INCLUDE"/>
    <!-- Products -->
    <EntityGroupEntry entityGroupId="PRODUCT_PULL" entityOrPackage="org.apache.ofbiz.product.facility" applEnumId="ESIA_INCLUDE"/>
    <EntityGroupEntry entityGroupId="5507_2_PULL" entityOrPackage="org.apache.ofbiz.product.product" applEnumId="ESIA_INCLUDE"/>
    <EntityGroupEntry entityGroupId="5507_2_PULL" entityOrPackage="org.apache.ofbiz.product.feature" applEnumId="ESIA_INCLUDE"/>
    <EntityGroupEntry entityGroupId="5507_2_PULL" entityOrPackage="org.apache.ofbiz.product.price" applEnumId="ESIA_INCLUDE"/>
    <EntityGroupEntry entityGroupId="5507_2_PULL" entityOrPackage="org.apache.ofbiz.product.promo" applEnumId="ESIA_INCLUDE"/>
    <EntityGroupEntry entityGroupId="5507_2_PULL" entityOrPackage="org.apache.ofbiz.product.supplier" applEnumId="ESIA_INCLUDE"/>
    <EntitySync entitySyncId="PRODUCT_PULL" runStatusId="ESR_NOT_STARTED" syncSplitMillis="600000"  syncEndBufferMillis="120000" keepRemoveInfoHours="24" forPullOnly="Y"/>
    <EntitySyncIncludeGroup entitySyncId="PRODUCT_PULL" entityGroupId="PRODUCT_PULL"/>



  2. Load Schedule job data(defined below) on ofbiz-slave server or run service ‘runPullEntitySync’ manually on ofbiz-slave server. We can schedule it as per requirement.

    Code Block
    languagexml
    <RuntimeData runtimeDataId="PRODUCT_PULL">
            <runtimeInfo><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
    <ofbiz-ser>
      <map-HashMap>
        <map-Entry>
          <map-Key>
            <std-String value="entitySyncId"/>
          </map-Key>
          <map-Value>
            <std-String value="PRODUCT_PULL"/>
          </map-Value>
          <map-Key>
            <std-String value="remotePullAndReportEntitySyncDataName"/>
          </map-Key>
          <map-Value>
            <std-String value="remotePullAndReportEntitySyncDataHttp"/>
          </map-Value>
        </map-Entry>
      </map-HashMap>
    </ofbiz-ser>
            ]]></runtimeInfo>
        </RuntimeData>
    <!-- Schedule job onofbiz-slave server on daily basis at zero hour of day -->
        <JobSandbox jobId="PRODUCT_PULL" jobName="PULL  Products" runtimeDataId="PRODUCT_PULL" runTime="2000-01-01 00:00:00.000" serviceName="runPullEntitySync" poolId="pool" runAsUser="system" tempExprId="HOUR_00"/>


Data Push to ofbiz-master from ofbiz-slave server

Below is example to push customer/party data from ofbiz-slave server to ofbiz-master server.

...