java - GemFire 8.2.0 cluster using static server list in cache.xml -


how can make gemfire 8.2.0 p2p cluster of gemfire servers using statically defined server list in cache.xml configuration file?

i cannot use multicast. not want use separate locator process.

my cache.xml server nodes

<!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> 

i have read in documentation can have static list of servers in pool, see on client side, style of configuration works. , clients connect list of servers. gemfire server / peer peer clustering using static cluster configuration not working me.

i using servercache = new cachefactory().set("cache-xml-file", "server-cache.xml").set("mcast-port", "0") .set("start-locator","localhost[13489]").set("locators", "localhost[13489]").create();

in logs of jmv see

``` [info 2016/02/08 15:47:34.922 utc tid=0x1] starting peer location distribution locator on localhost/127.0.0.1[13489]

[info 2016/02/08 15:47:34.925 utc tid=0x1] starting distribution locator on localhost/127.0.0.1[13489]

[info 2016/02/08 15:47:48.093 utc tid=0x1] starting server location distribution locator on localhost/127.0.0.1[13489] ```

on 2nd box use

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 contact locator service. operation either timed out or locator not exist. configured list of locators "[ip-of-1stbox(null)<v0>:13489]". @ com.gemstone.org.jgroups.protocols.tcpgossip.sendgetmembersrequest(tcpgossip.java:222) @ com.gemstone.org.jgroups.protocols.pingsender.run(pingsender.java:85) @ java.lang.thread.run(thread.java:745) exception in thread "main" com.gemstone.gemfire.gemfireconfigexception: unable contact locator service. operation either timed out or locator not exist. configured list of locators "[54.173.123.102(null)<v0>:13489]". @ com.gemstone.org.jgroups.protocols.tcpgossip.sendgetmembersrequest(tcpgossip.java:222) @ com.gemstone.org.jgroups.protocols.pingsender.run(pingsender.java:85) @ java.lang.thread.run(thread.java:745)

i have port 13489 open

i can see 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

port 13489 in use on first box

when did them connected found this

[warn 2016/02/08 16:38:12.688 utc <locator request thread[1]> tid=0x20] expected 1 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] received configurationrequest groups : cluster[cluster]

there mixup in cache.xml. need 2 sets of cache.xml, 1 server , 1 client. on server cache.xml, define port on server listen client communication, defines regions etc. following:

<?xml version="1.0" encoding="utf-8"?> <cache     xmlns="http://schema.pivotal.io/gemfire/cache"     xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"     xsi:schemalocation="http://schema.pivotal.io/gemfire/cache http://schema.pivotal.io/gemfire/cache/cache-8.1.xsd"     version="8.1"> <cache-server port="40404" /> <region name="myregion" refid="partition" /> </cache> 

to start embedded locator , point server other running servers in system, can

cachefactory cf = new cachefactory(); cf.set("cache-xml-file", "server-cache1.xml"); cf.set("mcast-port", "0"); cf.set("start-locator", "12345"); cf.set("locators","localhost[12345],localhost[6789]"); 

in second process, use exact same locators property, , use 6789 start-locator port.

for client cache.xml, define connection pool , provide list of running servers:

<?xml version="1.0" encoding="utf-8"?> <client-cache     xmlns="http://schema.pivotal.io/gemfire/cache"     xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"     xsi:schemalocation="http://schema.pivotal.io/gemfire/cache http://schema.pivotal.io/gemfire/cache/cache-8.1.xsd"     version="8.1"> <pool name="serverpool">   <server host="localhost" port="40404" />   <server host="localhost" port="40405" /> </pool> <region name="myregion" refid="caching_proxy"/> </client-cache> 

for client application, should create clientcache using above cache.xml so:

clientcachefactory ccf = new clientcachefactory(); ccf.set("cache-xml-file", "client.xml"); clientcache clientcache = ccf.create(); region r = clientcache.getregion("myregion"); r.put("1", "one"); 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -