We set up a 3 nodes elasticsearch cluster, 1 Master (data) node, 1 data node, and 1 client node.
Client node elasticsearch.yml file
cluster.name: elkstats
node.name: clientnode
node.master: false
node.data: false
path.data: /data
network.bind_host: 10.100.16.9
network.publish_host: 10.100.16.9
http.port: 9200
http.cors.enabled: true
http.cors.allow-origin: "*"
Master node elasticsearch.yml file
cluster.name: elkstats
node.name: Melasticsearch
node.master: true
node.data: true
discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: ["Melasticsearch","datanode1","clientnode"]
path.data: /data
network.bind_host: 10.100.16.13
network.publish_host: 10.100.16.13
http.cors.enabled: true
http.cors.allow-origin: "*"
http.port: 9200
Data node elasticsearch.yml file
cluster.name: elkstats
node.name: datanode1
node.master: false
node.data: true
path.data: /data
network.bind_host: 10.100.16.11
network.publish_host: 10.100.16.11
http.port: 9200
http.cors.enabled: true
http.cors.allow-origin: "*"
When I am on client node, I can do
curl -XGET clientnode:9200
it shows elasticsearch is running on client
{
"name" : "clientnode",
"cluster_name" : "elkstats",
"version" : {
"number" : "2.3.1",
"build_hash" : "bd980929010aef404e7cb0843e61d0665269fc39",
"build_timestamp" : "2016-04-04T12:25:05Z",
"build_snapshot" : false,
"lucene_version" : "5.5.0"
}
}
I set the following in the /etc/hosts file for all the nodes
10.100.16.13 Melasticsearch
10.100.16.11 datanode1
10.100.16.9 clientnode
When I am on any of the node, I use
curl -XGET 'http://Melasticsearch:9200/_cluster/health?pretty=true'
It shows there are only two nodes
{
"cluster_name" : "elkstats",
"status" : "green",
"timed_out" : false,
"number_of_nodes" : 2,
"number_of_data_nodes" : 2,
"active_primary_shards" : 11,
"active_shards" : 19,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 0,
"delayed_unassigned_shards" : 0,
"number_of_pending_tasks" : 0,
"number_of_in_flight_fetch" : 0,
"task_max_waiting_in_queue_millis" : 0,
"active_shards_percent_as_number" : 100.0
}
When I am on other nodes, and do curl to client
curl -XGET clientnode:9200
The response shows:
curl: (7) Failed connect to clientnode:9200; Connection refused
It looks like client node is not broadcasting its service to other nodes, and the other nodes are not aware of client node.
How do I make the client node join the cluster and recognized by the other nodes?