I am working with ES 0.8.0.
I have cluster with two nodes
Node1 – ES server - data not client
Node2 - Java application with embedded ES node – client, no data
Discovery mechanism working fine (master switch and nodes restart) when I configure both nodes to work with JGROUP UDP discovery.
When I try to work with ZEN or JGROUP TCP “master” switch does not work.
My scenario was:
Start Node1 first.
Now I can start/stop Node2 and it will connect to master as well as first time each time and no any problem.
I stopped Node1, Node2 got “Master”.
Start again Node1 then:
Jgroup TCP discovery:
Node1 was started as master without connection to Node2 . I got two masters.
Zen discovery:
I got the following error
[22:04:31,679][INFO ][node ] [Everyman] {ElasticSearch/0.8.0}[6264]: Initializing ...
[22:04:31,688][INFO ][plugins ] [Everyman] Loaded [discovery-jgroups]
[22:04:32,292][INFO ][node ] [Everyman] {ElasticSearch/0.8.0}[6264]: Initialized
[22:04:32,292][INFO ][node ] [Everyman] {ElasticSearch/0.8.0}[6264]: Starting ...
[22:04:32,457][INFO ][transport ] [Everyman] bound_address[inet[/0.0.0.0:9300]], publish_address[inet[/192.168.0.175:9300]]
[22:04:35,611][WARN ][discovery.zen ] [Everyman] Failed to send join request to master [[Smythe, Alistair][9999fa3d-c91b-4426-97a6-3a067d5fd51f][inet[/192.168.0.175:9300]]], retrying...
org.elasticsearch.transport.RemoteTransportException: [Everyman][inet[/192.168.0.175:9300]][discovery/zen/join]
Caused by: org.elasticsearch.ElasticSearchIllegalStateException: Node [[Everyman][7f245178-8d30-4448-9dc9-8092a7c01372][inet[/192.168.0.175:9300]]] not master for join request from [[Everyman][7f245178-8d30-4
:9300]]]
at org.elasticsearch.discovery.zen.ZenDiscovery.handleJoinRequest(ZenDiscovery.java:386)
at org.elasticsearch.discovery.zen.ZenDiscovery.access$900(ZenDiscovery.java:58)
at org.elasticsearch.discovery.zen.ZenDiscovery$MembershipListener.onJoin(ZenDiscovery.java:450)
at org.elasticsearch.discovery.zen.membership.MembershipAction$JoinRequestRequestHandler.messageReceived(MembershipAction.java:113)
at org.elasticsearch.discovery.zen.membership.MembershipAction$JoinRequestRequestHandler.messageReceived(MembershipAction.java:104)
at org.elasticsearch.transport.netty.MessageChannelHandler$3.run(MessageChannelHandler.java:175)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
[22:04:38,631][WARN ][discovery.zen ] [Everyman] Failed to send join request to master [[Smythe, Alistair][9999fa3d-c91b-4426-97a6-3a067d5fd51f][inet[/192.168.0.175:9300]]], retrying...
org.elasticsearch.transport.RemoteTransportException: [Everyman][inet[/192.168.0.175:9300]][discovery/zen/join]
Caused by: org.elasticsearch.ElasticSearchIllegalStateException: Node [[Everyman][7f245178-8d30-4448-9dc9-8092a7c01372][inet[/192.168.0.175:9300]]] not master for join request from [[Everyman][7f245178-8d30-4
:9300]]]
My configuration file
cluster:
name:
transport:
netty:
reuse_address: false
discovery:
type: zen or jgroups
jgroups:
config: tcp
bind_port: 7800
bind_addr:
tcpping:
initial_hosts: [7800]
Client node configuration
// General settings
Properties props = System.getProperties();
props.setProperty("java.net.preferIPv4Stack", "true");
props.setProperty("transport.netty.reuse_address", "false");
System.setProperties(props);
//Create settings builder
ImmutableSettings.Builder builder = ImmutableSettings.settingsBuilder();
if (discoveryType.equals(DISCOVERY_JGROUP_TCP)){
logger.info("Jgroups " + DISCOVERY_JGROUP_TCP + " discovery will start");
builder.put("discovery.type", "jgroups");
builder.put("discovery.jgroups.config", "tcp");
builder.put("discovery.jgroups.bind_port", JGROUP_TCP_PORT);
builder.put("discovery.jgroups.bind_addr", hostName);
builder.put("discovery.jgroups.tcpping.initial_hosts", hostName + "["+ JGROUP_TCP_PORT +"]");
}else if (discoveryType.equals(DISCOVERY_JGROUP_UDP)){
logger.info("Jgroups " + DISCOVERY_JGROUP_UDP + "discovery will start");
builder.put("discovery.type", "jgroups");
builder.put("discovery.jgroups.config", "udp");
}else{
//Set discovery to DISCOVERY_ZEN default
logger.info("Default " + DISCOVERY_ZEN + "discovery will start");
builder.put("discovery.type", "zen");
}
I try to get cluster nodes status with
curl -XGET 'http://localhost:9200/_cluster/nodes'
So, when only Node1 running I got node status . When Node2 was connected to cluster I got
repose like
{"error":"JsonGenerationException[Can not write a field name, expecting a value]"}
Thanks
Lena