,但get(key)返回NULL我有以下拓撲: Infinispan集羣處於Invalidation模式,puts在一個節點上執行並在其他節點上執行。 當羣集只包含兩個節點時,一切正常:當key/value插入到一個節點時,另一個當被問及第一次時,查詢該節點並從那裏獲取值。如果密鑰更新/刪除,則發送失效消息。Invalidation模式下的Infinispan集羣 - 儘管某些節點的值爲
當羣集中有兩個以上的節點時,問題就開始了:將密鑰插入到一個節點後,當另一個節點被要求輸入密鑰及其值時,它有時會返回該值,有時會返回NULL 。
從某些角度來看,這是有道理的,因爲節點查詢其鄰居,其中一些具有價值,其他則不具備價值。無論哪一個首先回答,都會定義響應是否應爲NULL或實際值。
儘管有道理,但這種行爲使得這種操作模式毫無用處,這導致我認爲也許我錯過了一些東西。 這裏是我的配置:
<infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:infinispan:config:7.0 http://www.infinispan.org/schemas/infinispan-config-7.0.xsd" xmlns="urn:infinispan:config:7.0">
<jgroups>
<stack-file name="tcp" path="jgroups-tcp.xml" />
</jgroups>
<cache-container name="SampleCacheManager" statistics="true" default-cache="invalidatedWithClusterCacheLoaderCache" shutdown-hook="DEFAULT">
<transport stack="tcp" cluster="clustered" node-name="NodeA"/>
<serialization marshaller="org.infinispan.marshall.core.VersionAwareMarshaller" version="1.0">
</serialization>
<jmx domain="org.infinispan" />
<invalidation-cache name="invalidatedWithClusterCacheLoaderCache" mode="SYNC" remote-timeout="20000" >
<persistence>
<cluster-loader remote-timeout="20000" preload="false" ></cluster-loader>
</persistence>
</invalidation-cache>
</cache-container>
</infinispan>
的JGroups-tcp.xml:
<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.4.xsd">
<TCP bind_port="7800" port_range="10"
recv_buf_size="20000000"
send_buf_size="640000"
loopback="false"
max_bundle_size="64k"
bundler_type="sender-sends-with-timer"
enable_diagnostics="true"
thread_naming_pattern="cl"
timer_type="new"
timer.min_threads="4"
timer.max_threads="10"
timer.keep_alive_time="3000"
timer.queue_max_size="1000"
timer.wheel_size="200"
timer.tick_time="50"
thread_pool.enabled="true"
thread_pool.min_threads="2"
thread_pool.max_threads="8"
thread_pool.keep_alive_time="5000"
thread_pool.queue_enabled="true"
thread_pool.queue_max_size="100000"
thread_pool.rejection_policy="discard"
oob_thread_pool.enabled="true"
oob_thread_pool.min_threads="1"
oob_thread_pool.max_threads="8"
oob_thread_pool.keep_alive_time="5000"
oob_thread_pool.queue_enabled="false"
oob_thread_pool.queue_max_size="100"
oob_thread_pool.rejection_policy="discard"/>
<MPING bind_addr="${jgroups.bind_addr:127.0.0.1}" break_on_coord_rsp="true"
mcast_addr="${jgroups.mping.mcast_addr:228.2.4.6}"
mcast_port="${jgroups.mping.mcast_port:43366}"
ip_ttl="${jgroups.udp.ip_ttl:2}"
num_initial_members="2" timeout="2000"/>
<MERGE3/>
<FD_SOCK/>
<FD_ALL interval="2000" timeout="5000" />
<VERIFY_SUSPECT timeout="500" />
<BARRIER />
<pbcast.NAKACK use_mcast_xmit="false"
retransmit_timeout="100,300,600,1200"
discard_delivered_msgs="true" />
<UNICAST3 conn_expiry_timeout="0"/>
<pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
max_bytes="10m"/>
<pbcast.GMS print_local_addr="true" join_timeout="5000"
max_bundling_time="30"
view_bundling="true"/>
<MFC max_credits="2M"
min_threshold="0.4"/>
<FRAG2 frag_size="60000" />
<pbcast.STATE_TRANSFER />
</config>
總結我的問題:是否應該以這種方式工作或者是配置錯誤在我的情況?
謝謝你迅速和徹底的響應。 – Kikosha
說,有沒有一種方法可以設置某個節點的偏好以獲取高於另一個節點的值? – Kikosha