求救 关于实现缓存同步的问题

杜申 发布于 2011/12/31 13:01
阅读 2K+
收藏 1

<cacheManagerPeerProviderFactory

        class="net.sf.ehcache.distribution.jgroups.JGroupsCacheManagerPeerProviderFactory"
        properties="connect=UDP(mcast_addr=231.12.21.132;mcast_port=45566;ip_ttl=32;
        mcast_send_buf_size=150000;mcast_recv_buf_size=80000):
        PING(timeout=2000;num_initial_members=6):
        MERGE2(min_interval=5000;max_interval=10000):
        FD_SOCK:VERIFY_SUSPECT(timeout=1500):
        pbcast.NAKACK(gc_lag=10;retransmit_timeout=3000):
        UNICAST(timeout=5000):
        pbcast.STABLE(desired_avg_gossip=20000):
        FRAG:
        pbcast.GMS(join_timeout=5000;join_retry_timeout=2000;
        shun=false;print_local_addr=true)"
         propertySeparator="::"

     />

求解释下这段代码的意思 关键是(  properties="connect=UDP(mcast_addr=231.12.21.132;mcast_port=45566;ip_ttl=32;
        mcast_send_buf_size=150000;mcast_recv_buf_size=80000):) 的 另外有Ehcache 在集群下做分布式的缓存可以做到缓存同步吗?  求高手给解释下, 我刚学习 谢谢

加载中
0
红薯
红薯
这是ehcache通过多播方式将数据发给其他节点
0
杜申

帅哥

 能加你QQ吗?

 我像详细请教下~~

0
杜申
那这里配置的mcast_addr=231.12.21.132;mcast_port=45566;ip_ttl=32 中的mcast_addr mcast_port ip_ttl 这三个属性都是什么意思啊
0
老盖
老盖
帅哥,这么简单的英文都看不懂?分别是多播的ip地址、端口、生存时间。
0
杜申

多播的ip地址和端口是从哪获取的?

对这个很白~~~

0
老盖
老盖
encache没怎么研究过,但是很明显,你上面这个文件就相当于是配置文件,填写的参数就是告诉encache往哪发同步命令,这些ip、端口就是需要你自己添的。建议还是看下ehcache的文档吧
0
杜申
properties="connect=UDP(mcast_addr=172.16.64.145;mcast_port=7800;ip_ttl=32;
我改成这种还是报以下异常~~~
 
org.jgroups.ChannelException: failed to start protocol stack
at org.jgroups.JChannel.startStack(JChannel.java:1763)
at org.jgroups.JChannel.connect(JChannel.java:405)
at org.jgroups.JChannel.connect(JChannel.java:380)
at org.jgroups.blocks.NotificationBus.start(NotificationBus.java:128)
at net.sf.ehcache.distribution.jgroups.JGroupManager.<init>(JGroupManager.java:70)
at net.sf.ehcache.distribution.jgroups.JGroupsCacheManagerPeerProviderFactory.createCachePeerProvider(JGroupsCacheManagerPeerProviderFactory.java:52)
at net.sf.ehcache.config.ConfigurationHelper.createCachePeerProviders(ConfigurationHelper.java:128)
at net.sf.ehcache.CacheManager.configure(CacheManager.java:537)
at net.sf.ehcache.CacheManager.init(CacheManager.java:320)
at net.sf.ehcache.CacheManager.<init>(CacheManager.java:276)
at com.ldcchina.tester.ehcache.MyCacheManager.main(MyCacheManager.java:30)
Caused by: java.lang.Exception: problem creating sockets (bind_addr=/172.16.64.146, mcast_addr=172.16.64.145:7800)
at org.jgroups.protocols.UDP.start(UDP.java:218)
at org.jgroups.stack.ProtocolStack.startStack(ProtocolStack.java:745)
at org.jgroups.JChannel.startStack(JChannel.java:1760)
... 10 more
Caused by: java.net.SocketException: Not a multicast address
at java.net.MulticastSocket.joinGroup(MulticastSocket.java:273)
at org.jgroups.protocols.UDP.createSockets(UDP.java:377)
at org.jgroups.protocols.UDP.start(UDP.java:214)
... 12 more
0
李力
李力

引用来自“杜申”的答案

properties="connect=UDP(mcast_addr=172.16.64.145;mcast_port=7800;ip_ttl=32;
我改成这种还是报以下异常~~~
 
org.jgroups.ChannelException: failed to start protocol stack
at org.jgroups.JChannel.startStack(JChannel.java:1763)
at org.jgroups.JChannel.connect(JChannel.java:405)
at org.jgroups.JChannel.connect(JChannel.java:380)
at org.jgroups.blocks.NotificationBus.start(NotificationBus.java:128)
at net.sf.ehcache.distribution.jgroups.JGroupManager.<init>(JGroupManager.java:70)
at net.sf.ehcache.distribution.jgroups.JGroupsCacheManagerPeerProviderFactory.createCachePeerProvider(JGroupsCacheManagerPeerProviderFactory.java:52)
at net.sf.ehcache.config.ConfigurationHelper.createCachePeerProviders(ConfigurationHelper.java:128)
at net.sf.ehcache.CacheManager.configure(CacheManager.java:537)
at net.sf.ehcache.CacheManager.init(CacheManager.java:320)
at net.sf.ehcache.CacheManager.<init>(CacheManager.java:276)
at com.ldcchina.tester.ehcache.MyCacheManager.main(MyCacheManager.java:30)
Caused by: java.lang.Exception: problem creating sockets (bind_addr=/172.16.64.146, mcast_addr=172.16.64.145:7800)
at org.jgroups.protocols.UDP.start(UDP.java:218)
at org.jgroups.stack.ProtocolStack.startStack(ProtocolStack.java:745)
at org.jgroups.JChannel.startStack(JChannel.java:1760)
... 10 more
Caused by: java.net.SocketException: Not a multicast address
at java.net.MulticastSocket.joinGroup(MulticastSocket.java:273)
at org.jgroups.protocols.UDP.createSockets(UDP.java:377)
at org.jgroups.protocols.UDP.start(UDP.java:214)
... 12 more
注意下你这段标点符号,分隔符号。我也是遇到这错误。重新调整下就可以了。
0
a
alex1161596325

红薯,您好,我两台小机AIX上运行时,报如下错误,帮忙看看怎么解决呀?谢谢!


[5/29/13 11:20:42:237 GMT+08:00] 00001fc3 JChannel      I org.jgroups.JChannel init JGroups version: 2.4.1 SP-4
[5/29/13 11:20:42:608 GMT+08:00] 00001fee UDP           I org.jgroups.protocols.UDP createSockets sockets will use interface 10.91.234.23
[5/29/13 11:20:42:634 GMT+08:00] 00001fc3 JGroupManager E   failed to start protocol stack
                                 org.jgroups.ChannelException: failed to start protocol stack
    at org.jgroups.JChannel.connect(JChannel.java:389)
    at org.jgroups.blocks.NotificationBus.start(NotificationBus.java:127)
    at net.sf.ehcache.distribution.jgroups.JGroupManager.<init>(JGroupManager.java:70)
    at net.sf.ehcache.distribution.jgroups.JGroupsCacheManagerPeerProviderFactory.createCachePeerProvider(JGroupsCacheManagerPeerProviderFactory.java:52)
    at net.sf.ehcache.config.ConfigurationHelper.createCachePeerProviders(ConfigurationHelper.java:128)
    at net.sf.ehcache.CacheManager.configure(CacheManager.java:537)
    at net.sf.ehcache.CacheManager.init(CacheManager.java:320)
    at net.sf.ehcache.CacheManager.<init>(CacheManager.java:276)
    at com.ldcchina.tester.ehcache.MyCacheManager.contextInitialized(MyCacheManager.java:18)
    at com.ibm.ws.wswebcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:653)
    at com.ibm.ws.webcontainer.webapp.WebApp.commonInitializationFinish(WebApp.java:370)
    at com.ibm.ws.wswebcontainer.webapp.WebApp.initialize(WebApp.java:293)
    at com.ibm.ws.wswebcontainer.webapp.WebGroup.addWebApplication(WebGroup.java:93)
    at com.ibm.ws.wswebcontainer.VirtualHost.addWebApplication(VirtualHost.java:162)
    at com.ibm.ws.wswebcontainer.WebContainer.addWebApp(WebContainer.java:673)
    at com.ibm.ws.wswebcontainer.WebContainer.addWebApplication(WebContainer.java:626)
    at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:335)
    at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:551)
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1250)
    at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1140)
    at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:569)
    at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:819)
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:921)
    at com.ibm.ws.runtime.component.ApplicationMgrImpl$1.run(ApplicationMgrImpl.java:1437)
    at com.ibm.ws.security.auth.ContextManagerImpl.runAs(ContextManagerImpl.java:4157)
    at com.ibm.ws.security.auth.ContextManagerImpl.runAsSystem(ContextManagerImpl.java:4254)
    at com.ibm.ws.security.core.SecurityContext.runAsSystem(SecurityContext.java:245)
    at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:1442)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:618)
    at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:68)
    at sun.reflect.GeneratedMethodAccessor103.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:618)
    at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:271)
    at javax.management.modelmbean.RequiredModelMBean.invokeMethod(RequiredModelMBean.java:1092)
    at javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:973)
    at com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke(DynamicMetaDataImpl.java:231)
    at com.sun.jmx.mbeanserver.MetaDataImpl.invoke(MetaDataImpl.java:238)
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:833)
    at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:802)
    at com.ibm.ws.management.AdminServiceImpl$1.run(AdminServiceImpl.java:1139)
    at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118)
    at com.ibm.ws.management.AdminServiceImpl.invoke(AdminServiceImpl.java:1032)
    at com.ibm.ws.management.connector.AdminServiceDelegator.invoke(AdminServiceDelegator.java:139)
    at sun.reflect.GeneratedMethodAccessor6180.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:618)
    at com.ibm.ws.management.connector.soap.SOAPConnector.invoke(SOAPConnector.java:361)
    at com.ibm.ws.management.connector.soap.SOAPConnector.service(SOAPConnector.java:215)
    at com.ibm.ws.management.connector.soap.SOAPConnection.handleRequest(SOAPConnection.java:64)
    at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:742)
    at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:528)
    at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1497)
Caused by: java.lang.Exception: exception caused by UDP.start()
    at org.jgroups.stack.Protocol.handleSpecialDownEvent(Protocol.java:582)
    at org.jgroups.stack.DownHandler.run(Protocol.java:118)
Caused by: java.lang.Exception: problem creating sockets (bind_addr=/10.91.234.23, mcast_addr=231.12.21.132:45566)
    at org.jgroups.protocols.UDP.start(UDP.java:372)
    at org.jgroups.stack.Protocol.handleSpecialDownEvent(Protocol.java:571)
    ... 1 more
Caused by: java.net.SocketException: The socket name is not available on this system.
    at java.net.PlainDatagramSocketImpl.setOption(PlainDatagramSocketImpl.java:442)
    at java.net.MulticastSocket.setInterface(MulticastSocket.java:443)
    at org.jgroups.protocols.UDP.createSockets(UDP.java:475)
    at org.jgroups.protocols.UDP.start(UDP.java:367)
    ... 2 more

[5/29/13 11:20:42:770 GMT+08:00] 00001fc3 SystemOut     O test coming.....

0
hzxwf
hzxwf

引用来自“杜申”的答案

properties="connect=UDP(mcast_addr=172.16.64.145;mcast_port=7800;ip_ttl=32;
我改成这种还是报以下异常~~~
 
org.jgroups.ChannelException: failed to start protocol stack
at org.jgroups.JChannel.startStack(JChannel.java:1763)
at org.jgroups.JChannel.connect(JChannel.java:405)
at org.jgroups.JChannel.connect(JChannel.java:380)
at org.jgroups.blocks.NotificationBus.start(NotificationBus.java:128)
at net.sf.ehcache.distribution.jgroups.JGroupManager.<init>(JGroupManager.java:70)
at net.sf.ehcache.distribution.jgroups.JGroupsCacheManagerPeerProviderFactory.createCachePeerProvider(JGroupsCacheManagerPeerProviderFactory.java:52)
at net.sf.ehcache.config.ConfigurationHelper.createCachePeerProviders(ConfigurationHelper.java:128)
at net.sf.ehcache.CacheManager.configure(CacheManager.java:537)
at net.sf.ehcache.CacheManager.init(CacheManager.java:320)
at net.sf.ehcache.CacheManager.<init>(CacheManager.java:276)
at com.ldcchina.tester.ehcache.MyCacheManager.main(MyCacheManager.java:30)
Caused by: java.lang.Exception: problem creating sockets (bind_addr=/172.16.64.146, mcast_addr=172.16.64.145:7800)
at org.jgroups.protocols.UDP.start(UDP.java:218)
at org.jgroups.stack.ProtocolStack.startStack(ProtocolStack.java:745)
at org.jgroups.JChannel.startStack(JChannel.java:1760)
... 10 more
Caused by: java.net.SocketException: Not a multicast address
at java.net.MulticastSocket.joinGroup(MulticastSocket.java:273)
at org.jgroups.protocols.UDP.createSockets(UDP.java:377)
at org.jgroups.protocols.UDP.start(UDP.java:214)
... 12 more
你这个只要把他写到独立的xml中就可以了。
返回顶部
顶部