0
votes

There are two eXist-db servers. One is master and one is slave. I know we can replicate the content using ActiveMQ when they are running in the same time(I made this work). But I want to know is there a way to replicate the content manually? Like synchronizing content from A server when B server starts. Actually, they are the same folder in two servers. collection.xconf as below.

<collection xmlns="http://exist-db.org/collection-config/1.0">
    <triggers>
        <trigger class="org.exist.jms.replication.publish.ReplicationTrigger">
            <!-- 
                Class name of the initial context provider, default value 
                for ActiveMQ
                see javax.naming.Context#INITIAL_CONTEXT_FACTORY
            -->
            <parameter name="java.naming.factory.initial" value="org.apache.activemq.jndi.ActiveMQInitialContextFactory"/>
            <!-- 
                URL of the message broker, default value for ActiveMQ 
                see javax.naming.Context#PROVIDER_URL
            --> 
            <parameter name="java.naming.provider.url" value="tcp://localhost:61616"/>
            <!-- 
                Lookup connection factory
                see javax.naming.InitialContext#lookup(String) 
            -->
            <parameter name="connection-factory" value="ConnectionFactory"/>
            <!--
                Lookup destination (topic)
                see javax.naming.InitialContext#lookup(String) 
            -->
            <parameter name="destination" value="dynamicTopics/eXistdb-replication-example"/>
        </trigger>
        <trigger event="update" class="org.exist.collections.triggers.XQueryTrigger">
            <parameter name="url" value="xmldb:exist:///db/triggerUpdate.xql"/>
        </trigger>
    </triggers>
</collection>
1
I am really not clear what you are trying to do here. Is it the case that when a new server starts you want to pull content from an existing server? or something else? - adamretter
The goal is to synchronize contents between two servers. The use case would be: when A server is running, B can synchronize contents when B starts. - xinpeng sun
what about writes, say B updates some content would that need to be synced back to A? - duncdrum
no need. Actually, we have more than two servers. How to make sure each server has the same content? When they are running, we can fix it by replication. I wonder if one of them shut down, how to make sure it still has the latest content when it comes back. - xinpeng sun
i m afraid the answer is it depends. From what i can discern so far I would recommend configuring a kubernetes cluster or docker-swarm, with distinct data-volumes shared by multiple nodes - duncdrum

1 Answers

0
votes

The extension actually has the sync($doc) function, you can use this function to send one resource into the broker. I will add documentation about this to the wiki soon.

That reminds that I need to release some minor fixes soon....