Replication Issue

#1

Hi,

I am trying to use replication for this first time - so most likely I am doing something wrong.

I have a server on which I run my master DB server

java -cp objectdb.jar com.objectdb.Server start -conf objectdbMASTER.conf

on the same server I run a java program - which is writing objects every second a database KAKI.odb - here is the code:

EntityManagerFactory EMF = Persistence.createEntityManagerFactory("objectdb://localhost:6001/KAKI.odb;user=admin;password=admin");
        EntityManager em = EMF.createEntityManager();

        int count = 0;
        while( true )
        {
            DummyEntity x = new DummyEntity(String.valueOf(count));
            em.getTransaction().begin();
            em.persist(x);
            em.getTransaction().commit();
            System.out.println(count +":" +x.toString());
            Thread.sleep(1000);
            count++;
        }

Then locally on my machine I run a slave DB server with the following command

java -cp objectdb.jar com.objectdb.Server start -conf objectdb.conf

Here is the config for the slave DB

<!-- ObjectDB Configuration -->
<objectdb>

        <general>
                <temp path="$temp" threshold="64mb" />
                <network inactivity-timeout="0" />
                <url-history size="50" user="true" password="true" />
                <log path="$objectdb/log/" max="8mb" stdout="false" stderr="false" />
                <log-archive path="$objectdb/log/archive/" retain="90" />
                <logger name="*" level="info" />
        </general>

        <database>
                <size initial="256kb" resize="256kb" page="2kb" />
                <recovery enabled="false" sync="false" path="." max="128mb" />
                <recording enabled="false" sync="false" path="." mode="write" />
                <locking version-check="true" />
                <processing cache="64mb" max-threads="10" />
                <query-cache results="32mb" programs="500" />
                <extensions drop="temp,tmp" />
        </database>

        <entities>
                <enhancement agent="false" reflection="warning" />
                <cache ref="weak" level2="0" />
                <persist serialization="false" />
                <cascade-persist always="auto" on-persist="false" on-commit="true" />
                <dirty-tracking arrays="false" />
        </entities>

        <schema>
        </schema>

        <server>
                <connection port="6000" max="100" />
                <data path="$objectdb/db" />
                <replication url="objectdb://12.345.678.910:6001/KAKI.odb;user=admin;password=admin" />
        </server>

        <users>
                <user username="admin" password="admin">
                        <dir path="/" permissions="access,modify,create,delete" />
                </user>
                <user username="$default" password="$$$###">
                        <dir path="/$user/" permissions="access,modify,create,delete">
                                <quota directories="5" files="20" disk-space="5mb" />
                        </dir>
                </user>
                <user username="user1" password="user1" />
        </users>

        <ssl enabled="false">
                <server-keystore path="$objectdb/ssl/server-kstore" password="pwd" />
                <client-truststore path="$objectdb/ssl/client-tstore" password="pwd" />
        </ssl>

</objectdb>

The slave DB server complains with the following error every second (every time an object is added on the master DB)

com.objectdb.o.UserException: Failed to synchronize replicated database
        at com.objectdb.o.MSG.d(MSG.java:61)
        at com.objectdb.o.RPT.d(RPT.java:99)
        at com.objectdb.o.RPT.<init>(RPT.java:66)
        at com.objectdb.o.SHN.aw(SHN.java:703)
        at com.objectdb.o.SHN.K(SHN.java:202)
        at com.objectdb.o.HND.run(HND.java:133)
        at java.lang.Thread.run(Thread.java:722)

Thanks for your help

EKK

#2

First, verify that recording is enabled on the master side.

If you are using an existing database you have to start replication after copying the master database manually to the salve side (under the $replication directory).

Please also check if the log files include additional stack traces.

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)

Post Reply

To post a reply and/or subscribe to update notifications - please login