我是使用Hibernate Search編寫Web應用程序的團隊的一員,我們最近試圖開始實現使用JGroups來保持不同節點上的Lucene索引與彼此。Hibernate搜索JBoss 7下的JGroups配置
但是,我一直無法通過獲得此設置的最基本的第一步,文檔似乎quite sparse。
<bean class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" id="myFactory">
<property name="dataSource" ref="myDataSource"/>
<property name="persistenceXmlLocation" value="/WEB-INF/persistence.xml"/>
<property name="persistenceUnitName" value="persistenceUnit"/>
<property name="jpaVendorAdapter" ref="vendorAdapter"/>
<property name="jpaProperties">
<props>
<prop key="hibernate.search.worker.backend.jgroups.configurationFile">jgroups-config.xml</prop>
<prop key="hibernate.search.default.directory_provider">infinispan</prop>
<prop key="hibernate.search.default.indexBase">indexes</prop>
<prop key="hibernate.search.default.worker.backend">jgroups</prop>
<prop key="hibernate.search.services.jgroups.clusterName">MyCluster</prop>
<prop key="hibernate.search.error_handler">log</prop>
<prop key="hibernate.search.lucene_version">LUCENE_36</prop>
<prop key="hibernate.search.generate_statistics">true</prop>
<prop key="hibernate.search.jmx_enabled">true</prop>
</props>
</property>
這裏的關鍵屬性是hibernate.search.worker.backend.jgroups.configurationFile
這給了JGroups的配置文件,這是我們最終需要的名字。我試過把這個文件放在WEB-INF中,並將其放在JBoss模塊目錄結構中的其他文件所在位置併成功加載的道具文件中,但它並沒有被拾取。
在日誌中我可以看到:
16:34:57,609 INFO [org.hibernate.search.backend.impl.jgroups.JGroupsChannelProvider] (MSC service thread 1-1) HSEARCH000005: Starting JGroups Channel
16:34:57,609 INFO [org.hibernate.search.backend.impl.jgroups.JGroupsChannelProvider] (MSC service thread 1-1) HSEARCH000011: Unable to use any JGroups configuration mechanisms provided in properties { hibernate.search.default.worker.backend=jgroups, hibernate.search.default.directory_provider=infinispan, hibernate.search.worker.backend.jgroups.configurationFile=jgroups-config.xml}. Using default JGroups configuration file!
16:34:59,427 INFO [stdout] (MSC service thread 1-1)
16:34:59,427 INFO [stdout] (MSC service thread 1-1) -------------------------------------------------------------------
16:34:59,428 INFO [stdout] (MSC service thread 1-1) GMS: address=LDNLPT1271-PC-17149, cluster=CrisisHubCluster, physical address=172.26.10.169:58147
16:34:59,428 INFO [stdout] (MSC service thread 1-1) -------------------------------------------------------------------
16:35:02,448 INFO [org.hibernate.search.backend.impl.jgroups.JGroupsMasterMessageListener] (MSC service thread 1-1) HSEARCH000015: Received new cluster view: [LDNLPT1271-PC-17149|0] [LDNLPT1271-PC-17149]
16:35:02,450 INFO [org.hibernate.search.backend.impl.jgroups.JGroupsChannelProvider] (MSC service thread 1-1) HSEARCH000006: Connected to cluster [ MyCluster ]. The node address is LDNLPT1271-PC-17149
16:35:02,513 INFO [org.infinispan.remoting.transport.jgroups.JGroupsTransport] (CacheStartThread,HibernateSearch-Infinispan-cluster,LuceneIndexesMetadata) ISPN000078: Starting JGroups Channel
16:35:02,514 INFO [org.infinispan.remoting.transport.jgroups.JGroupsTransport] (CacheStartThread,HibernateSearch-Infinispan-cluster,LuceneIndexesMetadata) ISPN000088: Unable to use any JGroups configuration mechanisms provided in properties {}. Using default JGroups configuration!
我截斷Unable to use any JGroups configuration mechanisms provided in properties
屬性的列表,因爲它會佔用幾頁,但如果你看行,你可以看到它列出了財產在同一時間,它說它無法找到它。
所以,它沒有拿起配置文件的位置,它使用的是默認值。
有沒有人在這裏使用Hibernate搜索jgroups?你有沒有設法提供一個自定義的jgroups配置文件?你是怎麼做到的?
正確:https://community.jboss.org/wiki/HibernateSearchMigrationGuide#JGroups_integration_and_configuration – Sanne
Sanne - 我遇到了嚴重的問題,試圖讓JGroups在兩個JBoss節點之間通話。任何機會,我可以問你一些幫助(假設你對這個主題知道很多)? – Jon