java GemFire 8.2.0集群使用缓存中的静态服务器列表。xml
如何仅使用cache.xml
配置文件中静态定义的服务器列表创建GemFire 8.2.0 P2P GemFire服务器集群
我不能使用多播。我不想使用单独的定位器进程
服务器节点的Mycache.xml
<!DOCTYPE cache PUBLIC
"-//GemStone Systems, Inc.//GemFire Declarative Caching 8.0//EN"
"http://www.gemstone.com/dtd/cache8_0.dtd">
<cache>
<cache-server port="40404" />
<pool name="serverPool">
<server host="10.0.0.192" port="40404" />
<server host="10.0.0.193" port="40404" />
</pool>
</cache>
我在文档中读到,我可以在池中有一个服务器的静态列表,我在客户端看到,这种配置方式很有效。我的客户端连接到服务器列表。 但仅使用静态集群配置的GemFire服务器/对等集群对我来说不起作用
我现在正在使用
serverCache = new CacheFactory().set("cache-xml-file", "server-cache.xml").set("mcast-port", "0")
.set("start-locator","localhost[13489]").set("locators", "localhost[13489]").create();
在这个jmv的日志中我看到了
``` [信息2016/02/08 15:47:34.922 UTC tid=0x1]正在本地主机上启动分发定位器的对等位置/127.0.0.1[13489]
[信息2016/02/08 15:47:34.925 UTC tid=0x1]正在本地主机上启动分发定位器/127.0.0.1[13489]
[信息2016/02/08 15:47:48.093 UTC tid=0x1]本地主机上分发定位器的启动服务器位置/127.0.0.1[13489] ```
在我使用的第二个盒子上
serverCache = new CacheFactory().set("cache-xml-file", "server-cache.xml").set("mcast-port", "0").set("locators", "IP-of-1stbox[13489]").create();
com.gemstone.gemfire.GemFireConfigException: Unable to contact a Locator service. Operation either timed out or Locator does not exist. Configured list of locators is "[ip-of-1stbox(null)<v0>:13489]".
at com.gemstone.org.jgroups.protocols.TCPGOSSIP.sendGetMembersRequest(TCPGOSSIP.java:222)
at com.gemstone.org.jgroups.protocols.PingSender.run(PingSender.java:85)
at java.lang.Thread.run(Thread.java:745)
Exception in thread "main" com.gemstone.gemfire.GemFireConfigException: Unable to contact a Locator service. Operation either timed out or Locator does not exist. Configured list of locators is "[54.173.123.102(null)<v0>:13489]".
at com.gemstone.org.jgroups.protocols.TCPGOSSIP.sendGetMembersRequest(TCPGOSSIP.java:222)
at com.gemstone.org.jgroups.protocols.PingSender.run(PingSender.java:85)
at java.lang.Thread.run(Thread.java:745)
我打开了13489端口
我看得出来
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN -
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN -
tcp 0 0 ::ffff:127.0.0.1:13489 :::* LISTEN 5137/java
tcp 0 0 :::40404 :::* LISTEN 5137/java
tcp 0 0 :::22 :::* LISTEN -
tcp 0 0 ::ffff:10.0.0.193:21145 :::* LISTEN 5137/java
tcp 0 0 ::ffff:10.0.0.193:65148 :::* LISTEN 5137/java
udp 0 0 0.0.0.0:68 0.0.0.0:* -
udp 0 0 10.0.0.193:123 0.0.0.0:* -
udp 0 0 127.0.0.1:123 0.0.0.0:* -
udp 0 0 0.0.0.0:123 0.0.0.0:* -
udp 0 0 ::ffff:10.0.0.193:2300 :::* 5137/java
端口13489正在第一个盒子上使用
当我把他们联系起来的时候,我发现了这个
[warn 2016/02/08 16:38:12.688 UTC <locator request thread[1]> tid=0x20] Expected one of these: [class com.gemstone.gemfire.cache.client.internal.locator.LocatorListRequest, class com.gemstone.gemfire.management.internal.JmxManagerLocatorRequest, class com.gemstone.gemfire.cache.client.internal.locator.ClientReplacementRequest, class com.gemstone.gemfire.cache.client.internal.locator.QueueConnectionRequest, class com.gemstone.org.jgroups.stack.GossipData, class com.gemstone.gemfire.cache.client.internal.locator.ClientConnectionRequest, class com.gemstone.gemfire.cache.client.internal.locator.LocatorStatusRequest, class com.gemstone.gemfire.cache.client.internal.locator.GetAllServersRequest] but received ConfigurationRequest for groups :
cluster[cluster]
# 1 楼答案
您可以使用
start-locator
GemFire属性以嵌入式模式(即在GemFire服务器进程内)启动定位器一种方法是:
start-locator=address1[port1]
放进火里。属性文件李>使用启动服务器
gfsh>;启动服务器名称=服务器1属性文件=/path/to/gemfire。房产
通过将第二台服务器指向第一台服务器中的定位器端口来启动第二台服务器:
gfsh>;启动服务器名称=服务器2定位器=地址1[port1]
# 2 楼答案
在
cache.xml
中有一个混淆。你需要两组缓存。xml,一个用于服务器,一个用于客户端。在服务器cache.xml
上,定义服务器将在其上侦听客户端通信的端口,定义您的区域等。如下所示:要启动嵌入式定位器并将服务器指向系统中其他正在运行的服务器,可以执行以下操作:
在第二个进程中,使用完全相同的
locators
属性,并使用6789
作为start-locator
端口用于客户端缓存。xml中定义一个连接池,并为其提供一个正在运行的服务器列表:
对于客户端应用程序,应该使用上述缓存创建
ClientCache
。像这样的xml: