cancel
Showing results for 
Search instead for 
Did you mean: 

Inbound Replication URGENT PLEASE

thaneshk
Champ in-the-making
Champ in-the-making
Hi,

I have changed the replicating-content-services-context.xml file in such a way



<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>
   <!–
    This file is not included in the application context by default.
    If you include this file, please ensure that you review the sample
    beans contained here.
    –>
   
   <bean id="backupContentStore"
         class="org.alfresco.repo.content.filestore.FileContentStore">
      <constructor-arg>
         <value>C:/Store</value>
      </constructor-arg>
   </bean>

   <bean id="primaryContentStoreBackupComponent"
         class="org.alfresco.repo.content.replication.ContentStoreReplicator"
         depends-on="fileContentStore, backupContentStore"
         init-method="start">
      <!– content source –>
      <property name="sourceStore">
          <ref bean="fileContentStore" />
      </property>
      <!– content target –>
      <property name="targetStore">
           <ref bean="backupContentStore" />
      </property>
      <!– set to 'false' to perform a single pass before quitting –>
      <property name="runContinuously">
          <value>true</value>
      </property>
      <!– time between passes –>
      <property name="waitTime">
          <value>60</value>
      </property>
   </bean>

   <bean id="replicatingContentStore"
         class="org.alfresco.repo.content.replication.ReplicatingContentStore" >
      <!– the preferred store for reads and writes –>
      <property name="primaryStore">
         <ref bean="fileContentStore" />
      </property>
      <!– example of possible secondary store configuration –>
      <property name="secondaryStores">
         <list>
            <ref bean="backupContentStore" />
         </list>
      </property>
      <!– enable content missing from the primary store to be pulled in from the secondary stores –>
      <property name="inbound">
         <value>true</value>
      </property>
      <!– enable replication from the primary to the secondary stores –>
      <property name="outbound">
         <value>true</value>
      </property>
      <!– this is required if outbound replication is active, otherwise not –>
      <property name="transactionService">
         <ref bean="transactionComponent" />
      </property>
        </bean>

</beans>


How is it possible for me to check whether inbound replication works on the Alfresco web application. I am just basically using my local machine that runs on Windows for POC purposes.

Should inbound replication retrieve content from a secondary store if it does not exist in the primary store? I am guessing this is what its supposed to do and should also work when testing a deleted peiece of content from primary store.

Also was wondering whether any configruation needs to take place to make this replication work?

Cheers
7 REPLIES 7

derek
Star Contributor
Star Contributor
Hi,

Yes.  The replicating store can lazily pull and push content from and to the backup store you have.  I would recommend that you disable the outbound replication given that you have a content store replicator going already.  Or you could disable the replicator and leave the outbound replication on.

No further configuration is necessary.  The beans will be active if Spring reads them in.

To check the replication, divide the primary content store into two and put one half of the content in the backup store.  Then the system should still be able to access content (and pull it in, if configured to do so) when the file is opened.

In 1.3, the ContentStoreReplicator should be activated using a Quartz scheduled job, but the appropriate sample files are present to show how to do this.

Regards

thaneshk
Champ in-the-making
Champ in-the-making


<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
 
<beans>
   <!–
    This file is not included in the application context by default.
    If you include this file, please ensure that you review the sample
    beans contained here.
    –>
   
   <bean id="backupContentStore"
         class="org.alfresco.repo.content.filestore.FileContentStore">
      <constructor-arg>
         <value>C:/Store</value>
      </constructor-arg>
   </bean>

  

   <bean id="replicatingContentStore"
         class="org.alfresco.repo.content.replication.ReplicatingContentStore" >
      <!– the preferred store for reads and writes –>
      <property name="primaryStore">
         <ref bean="fileContentStore" />
      </property>
      <!– example of possible secondary store configuration –>
      <property name="secondaryStores">
         <list>
            <ref bean="backupContentStore" />
         </list>
      </property>
      <!– enable content missing from the primary store to be pulled in from the secondary stores –>
      <property name="inbound">
         <value>true</value>
      </property>
      <!– enable replication from the primary to the secondary stores –>
      <property name="outbound">
         <value>true</value>
      </property>
      <!– this is required if outbound replication is active, otherwise not –>
      <property name="transactionService">
         <ref bean="transactionComponent" />
      </property>
        </bean>

</beans>


When i take off the contentStoreReplicator bean off, outbound replication does not take place. I think contentStoreReplicatorBean works because it gets triggered by the start method. What needs to happen to trigger replicating content store.

I have currently one app server and one backup store with a primary store. Technically if content cannot be found in the primary store, it should be loaded through backup store thanx to inbound replication. This is not happening.

Am i doing something wrong mates?

Cheers

derek
Star Contributor
Star Contributor

<configRoot>/alfresco/content-services-context.xml
The contentService bean's store property points to the store to be used by the server. The default store is a FileContentStore.

You need to override the contentService bean to use the store you require.

Regards

thaneshk
Champ in-the-making
Champ in-the-making
Very interesting Derek. What i am concerned about is the usage of the property term "store" rather than "stores". So basically it would look for one Content Store even if i override it. How can i apply multiple content stores

can i add

<property name="stores">
     <list>
          <ref bean="fileContentStore" />
          <ref bean="backupContentStore" />
     <list>
</property>

or just plain

<property name="store">
    
          <ref bean="backupContentStore" />

</property>

Would the latter's overriding allow content to be searched in the backup as well as primary store?

derek
Star Contributor
Star Contributor
The contentService uses a single store.  That store can, however, be a ReplicatingContentStore that sits on top of a primary and any number of secondary ContentStore instances.

So, the ReplicatingContentStore is responsible for (a) finding the content in the underlying stores, (b) pulling the content into the primary store if not already there and configured to do so, and © putting the necessary stream listeners in place so that content is replicated out to the secondary stores, if so configured.

Take a look at the tests for the ReplicatingContentStore.  It does exactly that, but sets the stores up programmatically.

Regards

thaneshk
Champ in-the-making
Champ in-the-making
Cheers Derek - Worked



     <bean id="contentService" class="org.alfresco.repo.content.RoutingContentService" init-method="init">
      <property name="transactionService">
          <ref bean="transactionComponent" />
      </property>
      <property name="dictionaryService">
          <ref bean="dictionaryService" />
      </property>
      <property name="nodeService">
          <ref bean="nodeService" />
      </property>
      <property name="transformerRegistry">
          <ref bean="contentTransformerRegistry" />
      </property>
      <property name="store">
          <ref bean="replicatingContentStore" />
      </property>
      <property name="policyComponent">
          <ref bean="policyComponent" />
      </property>
   </bean>


This needs to go in the custom-context.xml



<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>

<beans>
   <!–
    This file is not included in the application context by default.
    If you include this file, please ensure that you review the sample
    beans contained here.
    –>
   
   
      <bean id="fileContentStore" class="org.alfresco.repo.content.filestore.FileContentStore">
      <constructor-arg>
         <value>${dir.contentstore}/primary</value>
      </constructor-arg>
        </bean>
 
 
   <bean id="backupContentStore"
         class="org.alfresco.repo.content.filestore.FileContentStore">
      <constructor-arg>
         <value>${dir.contentstore}/secondary</value>
      </constructor-arg>
   </bean>
  
      <bean id="primaryContentStoreBackupComponent"
         class="org.alfresco.repo.content.replication.ContentStoreReplicator"
         depends-on="fileContentStore, backupContentStore"
         init-method="start">
      <!– content source –>
      <property name="sourceStore">
          <ref bean="fileContentStore" />
      </property>
      <!– content target –>
      <property name="targetStore">
          <ref bean="backupContentStore" />
      </property>
      <!– set to 'false' to perform a single pass before quitting –>
      <property name="runContinuously">
          <value>true</value>
      </property>
      <!– time between passes –>
      <property name="waitTime">
          <value>60</value>
      </property>
   </bean>

  
   <bean id="replicatingContentStore"
         class="org.alfresco.repo.content.replication.ReplicatingContentStore"
     
         >
      <!– the preferred store for reads and writes –>
      <property name="primaryStore">
         <ref bean="fileContentStore" />
      </property>
      <!– example of possible secondary store configuration –>
      <property name="secondaryStores">
         <list>
         <ref bean="backupContentStore" />
         </list>
      </property>
      <!– enable content missing from the primary store to be pulled in from the secondary stores –>
      <property name="inbound">
         <value>true</value>
      </property>
      <!– enable replication from the primary to the secondary stores –>
      <property name="outbound">
         <value>false</value>
      </property>
      <!– this is required if outbound replication is active, otherwise not –>
     </bean>

</beans>

You alfresco guys are too good… need any help ping me ..

kamal1387
Champ in-the-making
Champ in-the-making
Hi Guys,

Thank u for sharing xml to replicate content store. I have used the same xml file which is shared in this post. Now i can able to replicate my content. But it is working only on Bootsrap. I dont know where and how to handle content repliation through scheduled jobs.

Kindly help me out.

Thanks in Advance.