0 Replies Latest reply on May 7, 2014 12:58 PM by petrussello

    Hibernate Search into a JBoss AS7 Cluster

    petrussello

      Hello,

      I'm developing a Seam 2.3.1 application that runs on a JBoss AS7 Cluster configured following the official tutorial.

       

      My question is 'How to configure the persistence.xml file to obtain a replicated index in every node of the cluster?'

       

      Hibernate Search says that there are 2 approaches using jgroups backend:

      1. Master-Slaves backend with different persistence.xml configurations for every node.
      2. Automatic Master election

       

      I don't know how to realize the first solution because I don't know how to deploy different myapplication.war archive files for the nodes (I'm deploying the application from the apposite panel 'Manage Deployments' in the admin console).

       

      I don't even know how to realize the second solution because I didn't understand how to configure the persistence.xml to do the trick,

       

      I have tried with this persistence.xml file (I only added the red row to my original file):

       

      <?xml version="1.0" encoding="UTF-8"?>

      <!-- Persistence deployment descriptor for dev profile -->

      <persistence xmlns="http://java.sun.com/xml/ns/persistence"

                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                   xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"

                   version="2.0">

                  

        <persistence-unit name="myApplication" transaction-type="JTA">

         <provider>org.hibernate.ejb.HibernatePersistence</provider>

         <jta-data-source>java:jboss/datasources/MySqlXADS</jta-data-source>

       

         <properties>

           <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>

           <property name="hibernate.hbm2ddl.auto" value="update"/>

           <property name="hibernate.show_sql" value="false"/>

           <property name="hibernate.format_sql" value="true"/>

           <property name="hibernate.default_catalog" value="myapplication"/>

           <property name="jboss.entity.manager.factory.jndi.name" value="java:/myApplicationEntityManagerFactory"/>

       

           <property name="hibernate.search.default.directory_provider" value="filesystem"/>

           <property name="hibernate.search.default.indexBase" value="/HibernateSearchIndexFolder"/>

       

                   <property name="hibernate.search.default.worker.backend" value="jgroups"/>

       

           <property name="hibernate.search.indexing_strategy" value="manual"/>

          </properties>

        </persistence-unit>   

      </persistence>

       

       

      I hope someone can help me.

      Thanks