setting up Eureka Cluster

1,437 views
Skip to first unread message

eng.h...@gmail.com

unread,
Oct 7, 2015, 12:02:21 PM10/7/15
to eureka_netflix
I am trying to setup a two node cluster where each node knows about the other node. Being DNS setup, how to configure node A to know that node B is also Eureka server and vice versa? I am guessing it is in server.properties. This is not AWS EIP setup. I was trying to follow that same method, but got lost in the configuration files i.e. do I setup the configuration server.properties and build two WAR files? Any help would be appreciated.

eng.h...@gmail.com

unread,
Oct 8, 2015, 10:08:19 AM10/8/15
to eureka_netflix, eng.h...@gmail.com
On Wednesday, October 7, 2015 at 12:02:21 PM UTC-4, eng.h...@gmail.com wrote:
> I am trying to setup a two node cluster where each node knows about the other node. Being DNS setup, how to configure node A to know that node B is also Eureka server and vice versa? I am guessing it is in server.properties. This is not AWS EIP setup. I was trying to follow that same method, but got lost in the configuration files i.e. do I setup the configuration server.properties and build two WAR files? Any help would be appreciated.

Any pointers would be appreciated.

Tomasz Bak

unread,
Oct 8, 2015, 11:25:04 AM10/8/15
to eureka_...@googlegroups.com, eng.h...@gmail.com
If you do not want to use DNS, you should set:
eureka.shouldUseDns=false
eureka.serviceUrl.default=http://<host1>:8080/eureka,http://<host2>:8080/eureka
including explicit URL address for each host as above.
You do not need to separate configuration files/wars. Eureka server will filter out its own address, so the replication does not happen to itself.
/Tomasz


--
You received this message because you are subscribed to the Google Groups "eureka_netflix" group.
To unsubscribe from this group and stop receiving emails from it, send an email to eureka_netfli...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hanufa Begum

unread,
Oct 15, 2015, 1:31:35 PM10/15/15
to Tomasz Bak, eureka_...@googlegroups.com
Thanks for responding. I have two machines: eureka-tst01 and eureka-tst02.
In the eureka-client.properties, I have followed your directions and setup:
eureka.shouldUseDns=true
eureka.serviceUrl.default=http://eureka-tst01:8080/eureka/v2/,http://eureka-tst02:8080/eureka/v2/

I have pinged one machine from another to ensure DNS is enabled. I re-deployed the WAR file on both machines and this is what I am getting in catalina.out:
2015-10-15 17:30:24,852 INFO  org.apache.http.impl.client.DefaultRequestDirector:632 [batcher.chm-eureka02-Heartbeat-process] [tryConnect] Retrying connect to {}->http://eureka-tst02:8080

Similar message on the other machine.

Is there something I am missing ?

--
Thank you for contacting me.

Best regards,
Hanufa Begum

Hanufa Begum

unread,
Oct 15, 2015, 1:43:20 PM10/15/15
to Tomasz Bak, eureka_...@googlegroups.com
This is more detailed log:
2015-10-15 17:40:39,674 ERROR com.netflix.eureka.cluster.ReplicationTaskProcessor:123 [batcher.eureka-tst02-Heartbeat-process] [executeSingle] Network level connection to peer PeerEurekaNode: http://eureka-tst02:8080/eureka/v2apps/:  for task EUREKA/chm-eureka01:Heartbeat@PeerEurekaNode: http://eureka-tst02:8080/eureka/v2apps/: ; retrying after delay
com.sun.jersey.api.client.ClientHandlerException: org.apache.http.conn.ConnectTimeoutException: Connect to eureka-tst02:8080 timed out
    at com.sun.jersey.client.apache4.ApacheHttpClient4Handler.handle(ApacheHttpClient4Handler.java:187)
    at com.netflix.eureka.cluster.DynamicGZIPContentEncodingFilter.handle(DynamicGZIPContentEncodingFilter.java:45)
    at com.netflix.discovery.EurekaIdentityHeaderFilter.handle(EurekaIdentityHeaderFilter.java:28)
    at com.sun.jersey.api.client.Client.handle(Client.java:652)
    at com.sun.jersey.api.client.WebResource.handle(WebResource.java:682)
    at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74)
    at com.sun.jersey.api.client.WebResource$Builder.put(WebResource.java:529)
    at com.netflix.eureka.cluster.JerseyReplicationClient.sendHeartBeat(JerseyReplicationClient.java:110)
    at com.netflix.eureka.cluster.PeerEurekaNode$3.execute(PeerEurekaNode.java:161)
    at com.netflix.eureka.cluster.ReplicationTaskProcessor.executeSingle(ReplicationTaskProcessor.java:101)
    at com.netflix.eureka.cluster.ReplicationTaskProcessor.access$200(ReplicationTaskProcessor.java:26)
    at com.netflix.eureka.cluster.ReplicationTaskProcessor$1.process(ReplicationTaskProcessor.java:71)
    at com.netflix.eureka.util.batcher.MessageBatcher$ProcessMessages.run(MessageBatcher.java:358)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.http.conn.ConnectTimeoutException: Connect to eureka-tst02:8080 timed out
    at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:119)
    at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:177)
    at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:144)
    at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:131)
    at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:611)
    at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:446)
    at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:115)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)
    at com.sun.jersey.client.apache4.ApacheHttpClient4Handler.handle(ApacheHttpClient4Handler.java:173)
    ... 15 more
2015-10-15 17:40:40,377 INFO  org.apache.http.impl.client.DefaultRequestDirector:624 [batcher.eureka-tst02-Register-process] [tryConnect] I/O exception (java.net.NoRouteToHostException) caught when connecting to {}->http://eureka-tst02:8080: No route to host

Tomasz Bak

unread,
Oct 16, 2015, 11:18:04 AM10/16/15
to Hanufa Begum, eureka_...@googlegroups.com
Please, set eureka.shouldUseDns=false
In DNS mode, Eureka expects TXT record with a list of hosts within it. 

Hanufa Begum

unread,
Oct 16, 2015, 11:51:00 AM10/16/15
to Tomasz Bak, eureka_...@googlegroups.com
Tried that but to no avail, this is the error:
Retrying connect to {}->http://eureka-tst02:8080 and vice versa from the other machine.

Tomasz Bak

unread,
Oct 16, 2015, 11:59:26 AM10/16/15
to Hanufa Begum, eureka_...@googlegroups.com
The URL looks fine. Is this host name defined in /etc/hosts or it is a name that you can resolve from DNS? 
Can you swap this name with IP address, and try again?

Hanufa Begum

unread,
Oct 16, 2015, 12:03:00 PM10/16/15
to Tomasz Bak, eureka_...@googlegroups.com
Thank you very much for responding. It was IPTABLES problems.
Reply all
Reply to author
Forward
0 new messages