2013-07-19 35 views
1

我試圖在一些使用Tomcat服務器的Linux機器上在AWS EC2上使用我的應用程序。以前我在局域網上使用我的應用程序與Infinispan,並使用UDP組播發送JGroups成員。 EC2不支持UDP多播,這是Infinispan用於檢測羣集中運行的節點的默認節點發現方法。我研究了使用S3_PING協議,但我還沒弄明白爲什麼它不起作用。EC2上的Infinispan和JGroups發現

有沒有人有任何想法可能在這裏的問題?

這裏是我的配置文件: 1的applicationContext-cache.xml

<!-- Infinispan cache --> 
<cache:annotation-driven/> 

<import resource="classpath:/applicationContext-dao.xml"/> 


<bean id="cacheManager" class="org.infinispan.spring.provider.SpringEmbeddedCacheManagerFactoryBean"> 
    <property name="configurationFileLocation" value="classpath:/infinispan-replication.xml"/> 
</bean> 

<context:component-scan base-package="com.alex.cache"/> 

2.infinispan-replication.xml

<infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xsi:schemaLocation="urn:infinispan:config:5.1 http://www.infinispan.org/schemas/infinispan-config-5.1.xsd" 
     xmlns="urn:infinispan:config:5.1"> 

<global> 
    <transport transportClass="org.infinispan.remoting.transport.jgroups.JGroupsTransport"> 
     <properties> 
      <property name="configurationFile" value="/home/akasiyanik/dev/projects/myapp/myapp-configs/jgroups.xml"/> 
     </properties> 
    </transport> 
</global> 

<default> 
    <!-- Configure a synchronous replication cache --> 
    <clustering mode="replication"> 
     <sync/> 
     <hash numOwners="2"/> 
    </clustering> 
</default> 
</infinispan> 

3. jgroups.xml

<config> 
    <TCP bind_port="${jgroups.tcp.port:7800}" 
     loopback="true" 
     port_range="30" 
     recv_buf_size="20000000" 
     send_buf_size="640000" 
     discard_incompatible_packets="true" 
     max_bundle_size="64000" 
     max_bundle_timeout="30"   
     enable_bundling="true" 
     use_send_queues="true" 
     sock_conn_timeout="300" 
     enable_diagnostics="false" 
     thread_pool.enabled="true" 
     thread_pool.min_threads="2" 
     thread_pool.max_threads="30" 
     thread_pool.keep_alive_time="60000" 
     thread_pool.queue_enabled="false" 
     thread_pool.queue_max_size="100" 
     thread_pool.rejection_policy="Discard" 

     oob_thread_pool.enabled="true" 
     oob_thread_pool.min_threads="2" 
     oob_thread_pool.max_threads="30" 
     oob_thread_pool.keep_alive_time="60000" 
     oob_thread_pool.queue_enabled="false" 
     oob_thread_pool.queue_max_size="100" 
     oob_thread_pool.rejection_policy="Discard" 
    /> 
    <S3_PING location="r********s" access_key="AK***************SIA" 
     secret_access_key="y*************************************BJ" timeout="2000" num_initial_members="2"/> 
    <MERGE2 max_interval="30000" 
     min_interval="10000"/> 
    <FD_SOCK/> 
    <FD timeout="3000" max_tries="3"/> 
    <VERIFY_SUSPECT timeout="1500"/> 
    <BARRIER /> 
    <pbcast.NAKACK use_mcast_xmit="false" 
       exponential_backoff="500" 
       discard_delivered_msgs="true"/> 
    <UNICAST /> 
    <pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000" 
       max_bytes="4M"/> 
    <pbcast.GMS print_local_addr="true" join_timeout="3000" 
      view_bundling="true"/> 
    <UFC max_credits="2M" 
    min_threshold="0.4"/> 
    <MFC max_credits="2M" 
    min_threshold="0.4"/> 
    <FRAG2 frag_size="60K" /> 
    <pbcast.STATE_TRANSFER/> 
</config> 
+0

很難真正說AWS ......假設你的是,節點不加入問題的JGroups發現協議的實現,我會啓用org.jgroups包上的TRACE日誌記錄,看看發生了什麼。乍一看配置看起來很好...... –

+0

@GalderZamarreño感謝您的建議。但是我需要做的只是使用IPv4而不是IPv6。爲此,我使用指定的JVM參數來選擇IPv4:-Djava.net.preferIPv4Stack = true -Djava.net.preferIPv4Addresses = true。 – dzivak

+0

那麼,那麼工作呢? –

回答