首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >异常:加载索引文件的元数据时出错: segments_2j|M|field...在两台机器上运行infinispan时

异常:加载索引文件的元数据时出错: segments_2j|M|field...在两台机器上运行infinispan时
EN

Stack Overflow用户
提问于 2018-01-03 18:37:23
回答 1查看 307关注 0票数 1

我尝试在两台机器上运行infinispan,并在一台机器上持久化索引数据。当我试图在两台机器上同时运行索引和持久化(缓存-存储)到数据库时,我得到了以下异常,

代码语言:javascript
运行
复制
Caused by: java.io.FileNotFoundException: Error loading metadata for index file: segments_2j|M|Course
 at org.infinispan.lucene.impl.DirectoryImplementor.openInput(DirectoryImplementor.java:134)
 at org.infinispan.lucene.impl.DirectoryLuceneV4.openInput(DirectoryLuceneV4.java:101)
 at org.apache.lucene.store.Directory.openChecksumInput(Directory.java:113)
 at org.apache.lucene.index.SegmentInfos.read(SegmentInfos.java:341)
 at org.apache.lucene.index.StandardDirectoryReader$1.doBody(StandardDirectoryReader.java:57)
 at org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:923)
 at org.apache.lucene.index.StandardDirectoryReader.open(StandardDirectoryReader.java:53)
 at org.apache.lucene.index.DirectoryReader.open(DirectoryReader.java:67)
 at org.hibernate.search.indexes.impl.SharingBufferReaderProvider.readerFactory(SharingBufferReaderProvider.java:131)
 at org.hibernate.search.indexes.impl.SharingBufferReaderProvider$PerDirectoryLatestReader.<init>(SharingBufferReaderProvider.java:206)
 at org.hibernate.search.indexes.impl.SharingBufferReaderProvider.createReader(SharingBufferReaderProvider.java:108)
 ... 24 more

我的infinispan配置文件是: infinispan-config.xml

代码语言:javascript
运行
复制
<?xml version="1.0" encoding="UTF-8"?> <infinispan
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="urn:infinispan:config:7.2 http://www.infinispan.org/schemas/infinispan-config-7.2.xsd
        urn:infinispan:config:store:jdbc:7.2 http://www.infinispan.org/schemas/infinispan-cachestore-jdbc-config-7.2.xsd"
        xmlns="urn:infinispan:config:7.2"
        xmlns:jdbc="urn:infinispan:config:store:jdbc:7.2">

    <!-- *************************** -->
    <!-- System-wide global settings -->
    <!-- *************************** -->
    <jgroups>
        <!-- Note that the JGroups transport uses sensible defaults if no configuration
            property is defined. See the JGroupsTransport javadocs for more flags.
            jgroups-udp.xml is the default stack bundled in the Infinispan core jar: integration
            and tuning are tested by Infinispan. -->
        <stack-file name="default-jgroups-tcp" path="my-jgroupstcp.xml"/>
    </jgroups>

    <cache-container name="HibernateSearch" default-cache="default" statistics="false" shutdown-hook="DONT_REGISTER">

        <transport stack="default-jgroups-tcp"/>

        <!-- Duplicate domains are allowed so that multiple deployments with default configuration
            of Hibernate Search applications work - if possible it would be better to use JNDI to share
            the CacheManager across applications -->
        <jmx duplicate-domains="true"/>

        <!-- *************************************** -->
        <!--  Cache to store Lucene's file metadata  -->
        <!-- *************************************** -->
        <replicated-cache name="LuceneIndexesMetadata" mode="ASYNC" async-marshalling="true">
            <locking striping="false" acquire-timeout="10000" concurrency-level="500" write-skew="false"/>
            <transaction mode="NONE" />
            <eviction max-entries="-1" strategy="NONE"/>
            <expiration max-idle="-1"/>
            <persistence passivation="false">
                <jdbc:string-keyed-jdbc-store preload="true" fetch-state="true" read-only="false" purge="false">
                    <write-behind />
                    <property name="key2StringMapper">org.infinispan.lucene.LuceneKey2StringMapper</property>
                    <jdbc:connection-pool connection-url="jdbc:mysql://localhost:3306/hsearch"
                                          driver="com.mysql.jdbc.Driver" username="my-username"
                                          password="my-password"></jdbc:connection-pool>
                    <jdbc:string-keyed-table drop-on-exit="false" create-on-start="true" prefix="ISPN_STRING_TABLE">
                        <jdbc:id-column name="ID" type="VARCHAR(255)"/>
                        <jdbc:data-column name="DATA" type="MEDIUMBLOB"/>
                        <jdbc:timestamp-column name="TIMESTAMP" type="BIGINT"/>
                    </jdbc:string-keyed-table>
                </jdbc:string-keyed-jdbc-store>
            </persistence>
            <indexing index="ALL"/>
        <state-transfer enabled="true" timeout="480000" await-initial-transfer="true"/>
        </replicated-cache>




        <!-- **************************** -->
        <!--  Cache to store Lucene data  -->
        <!-- **************************** -->
        <distributed-cache name="LuceneIndexesData" mode="ASYNC" async-marshalling="true">
            <locking striping="false" acquire-timeout="10000" concurrency-level="500" write-skew="false"/>
            <transaction mode="NONE"/>
            <eviction max-entries="-1" strategy="NONE"/>
            <expiration max-idle="-1"/>
            <persistence passivation="false">
                <jdbc:string-keyed-jdbc-store preload="true" fetch-state="true" read-only="false" purge="false">
                    <write-behind />
                    <property name="key2StringMapper">org.infinispan.lucene.LuceneKey2StringMapper</property>
                    <jdbc:connection-pool connection-url="jdbc:mysql://localhost:3306/hsearch"
                                          driver="com.mysql.jdbc.Driver" username="my-username"
                                          password="my-password"></jdbc:connection-pool>
                    <jdbc:string-keyed-table drop-on-exit="false" create-on-start="true" prefix="ISPN_STRING_TABLE">
                        <jdbc:id-column name="ID" type="VARCHAR(255)"/>
                        <jdbc:data-column name="DATA" type="MEDIUMBLOB"/>
                        <jdbc:timestamp-column name="TIMESTAMP" type="BIGINT"/>
                    </jdbc:string-keyed-table>
                </jdbc:string-keyed-jdbc-store>
            </persistence>
            <indexing index="NONE"/>
            <state-transfer enabled="true" timeout="480000" await-initial-transfer="true"/>
        </distributed-cache>

        <!-- ***************************** -->
        <!--  Cache to store Lucene locks  -->
        <!-- ***************************** -->
        <replicated-cache name="LuceneIndexesLocking" mode="ASYNC" async-marshalling="true">
            <locking striping="false" acquire-timeout="10000" concurrency-level="500" write-skew="false"/>
            <transaction mode="NONE"/>
            <eviction max-entries="-1" strategy="NONE"/>
            <expiration max-idle="-1"/>
            <indexing index="NONE"/>
            <state-transfer enabled="true" timeout="480000" await-initial-transfer="true"/>
        </replicated-cache>
    </cache-container>

</infinispan>

我的jgroup配置文件是my-jgroup.xml

代码语言:javascript
运行
复制
<config xmlns="urn:org:jgroups"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="urn:org:jgroups http://www.jgroups.org/schema/JGroups-3.6.xsd">
<TCP bind_addr="${jgroups.tcp.address:192.168.1.48}"
     bind_port="${jgroups.tcp.port:7800}"
     enable_diagnostics="false"
     thread_naming_pattern="pl"
     send_buf_size="640k"
     sock_conn_timeout="300"

     thread_pool.min_threads="${jgroups.thread_pool.min_threads:2}"
     thread_pool.max_threads="${jgroups.thread_pool.max_threads:30}"
     thread_pool.keep_alive_time="60000"
     thread_pool.queue_enabled="false"

     internal_thread_pool.min_threads="${jgroups.internal_thread_pool.min_threads:5}"
     internal_thread_pool.max_threads="${jgroups.internal_thread_pool.max_threads:20}"
     internal_thread_pool.keep_alive_time="60000"
     internal_thread_pool.queue_enabled="true"
     internal_thread_pool.queue_max_size="500"

     oob_thread_pool.min_threads="${jgroups.oob_thread_pool.min_threads:20}"
     oob_thread_pool.max_threads="${jgroups.oob_thread_pool.max_threads:200}"
     oob_thread_pool.keep_alive_time="60000"
     oob_thread_pool.queue_enabled="false"
/>
<MPING bind_addr="${jgroups.tcp.address:192.168.1.48}"
       mcast_addr="${jgroups.mping.mcast_addr:228.2.4.6}"
       mcast_port="${jgroups.mping.mcast_port:43366}"
       ip_ttl="${jgroups.udp.ip_ttl:2}"
/>
<MERGE3 min_interval="10000"
        max_interval="30000"
/>
<FD_SOCK />
<FD_ALL timeout="60000"
        interval="15000"
        timeout_check_interval="5000"
/>
<VERIFY_SUSPECT timeout="5000" />
<pbcast.NAKACK2 use_mcast_xmit="false"
                xmit_interval="1000"
                xmit_table_num_rows="50"
                xmit_table_msgs_per_row="1024"
                xmit_table_max_compaction_time="30000"
                max_msg_batch_size="100"
                resend_last_seqno="true"
/>
<UNICAST3 xmit_interval="500"
          xmit_table_num_rows="50"
          xmit_table_msgs_per_row="1024"
          xmit_table_max_compaction_time="30000"
          max_msg_batch_size="100"
          conn_expiry_timeout="0"
/>
<pbcast.STABLE stability_delay="500"
               desired_avg_gossip="5000"
               max_bytes="1M"
/>
<pbcast.GMS print_local_addr="false"
            join_timeout="15000"
/>
<MFC max_credits="2m"
     min_threshold="0.40"
/>
<FRAG2 />

我的persistence.xml是

代码语言:javascript
运行
复制
<?xml version="1.0" encoding="UTF-8" ?>

代码语言:javascript
运行
复制
<persistence-unit name="IC" transaction-type="RESOURCE_LOCAL">
    <class>com.csgsol.model.Course</class>
    <properties>
        <property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/>
        <property name="javax.persistence.jdbc.url" value="jdbc:mysql://192.168.1.99:3306/sampleDb"/>
        <property name="javax.persistence.jdbc.user" value="my-username"/>
        <property name="javax.persistence.jdbc.password" value="my-password"/>

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

        <property name="hibernate.search.default.directory_provider" value="infinispan"/>
        <property name="hibernate.search.default.indexmanager" value="org.infinispan.query.indexmanager.InfinispanIndexManager"/>

        <property name="hibernate.search.default.indexmanager" value="near-real-time"/>
        <property name="hibernate.search.default.exclusive_index_use" value="false"/>
        <property name="hibernate.search.default.worker.execution" value = "async"/>
        <property name="hibernate.search.lucene_version" value="LUCENE_4_10_4"/>
        <property name="hibernate.search.infinispan.configuration_resourcename" value="infinispan-config.xml"/>

                </properties>
            </persistence-unit>
        </persistence>

我使用的版本是Infinispan -7.2.0。using - 4.10.4

EN

回答 1

Stack Overflow用户

发布于 2018-01-04 18:55:15

您不应该将mode="ASYNC“用于索引缓存。自Infinispan8.2.x (https://issues.jboss.org/browse/ISPN-4065)以来,此配置被禁止

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/48075691

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档