I have created two instance of elasticsearch in two different machine, both instance have same cluster name but still no.of nodes is one, but i want two node

this is the output i am getting after using
curl -X GET "localhost:9200/_nodes"
{"_nodes":{"total":1,"successful":1,"failed":0},"cluster_name":"ElasticsearchStagging","nodes":{"eLSFczi5TFOotlGdB9kpsw":{"name":"node-1","transport_address":"10.128.0.23:9300","host":"10.128.0.23","ip":"10.128.0.23","version":"6.5.4","build_flavor":"default","build_type":"deb","build_hash":"d2ef93d","total_indexing_buffer":106502553,"roles":["master","data","ingest"],"attributes":{"ml.machine_memory":"3872563200","xpack.installed":"true","ml.max_open_jobs":"20","ml.enabled":"true"},"settings":{"pidfile":"/var/run/elasticsearch/elasticsearch.pid","cluster":{"name":"ElasticsearchStagging"},"node":{"attr":{"xpack":{"installed":"true"},"ml":{"machine_memory":"3872563200","max_open_jobs":"20","enabled":"true"}},"name":"node-1"},"path":{"data":["/usr/local/elasticsearch/data"],"logs":"/var/log/elasticsearch","home":"/usr/share/elasticsearch"},"client":{"type":"node"},"http":{"type":"security4","port":"9200","type.default":"netty4"},"transport":{"type":"security4","features":{"x-pack":"true"},"type.default":"netty4"},"network":{"host":"0.0.0.0"}},"os":{"refresh_interval_in_millis":1000,"name":"Linux","arch":"amd64","version":"4.15.0-1037-gcp","available_processors":1,"allocated_processors":1},"process":{"refresh_interval_in_millis":1000,"id":1781,"mlockall":false},"jvm":{"pid":1781,"version":"1.8.0_212","vm_name":"OpenJDK 64-Bit Server VM","vm_version":"25.212-b03","vm_vendor":"Oracle Corporation","start_time_in_millis":1564052291534,"mem":{"heap_init_in_bytes":1073741824,"heap_max_in_bytes":1065025536,"non_heap_init_in_bytes":2555904,"non_heap_max_in_bytes":0,"direct_max_in_bytes":1065025536},"gc_collectors":["ParNew","ConcurrentMarkSweep"],"memory_pools":["Code Cache","Metaspace","Compressed Class Space","Par Eden Space","Par Survivor Space","CMS Old Gen"],"using_compressed_ordinary_object_pointers":"true","input_arguments":["-Xms1g","-Xmx1g","-XX:+UseConcMarkSweepGC","-XX:CMSInitiatingOccupancyFraction=75","-XX:+UseCMSInitiatingOccupancyOnly","-XX:+AlwaysPreTouch","-Xss1m","-Djava.awt.headless=true","-Dfile.encoding=UTF-8","-Djna.nosys=true","-XX:-OmitStackTraceInFastThrow","-Dio.netty.noUnsafe=true","-Dio.netty.noKeySetOptimization=true","-Dio.netty.recycler.maxCapacityPerThread=0","-Dlog4j.shutdownHookEnabled=false","-Dlog4j2.disable.jmx=true","-Djava.io.tmpdir=/tmp/elasticsearch.ytvj2hNl","-XX:+HeapDumpOnOutOfMemoryError","-XX:HeapDumpPath=/var/lib/elasticsearch","-XX:ErrorFile=/var/log/elasticsearch/hs_err_pid%p.log","-XX:+PrintGCDetails","-XX:+PrintGCDateStamps","-XX:+PrintTenuringDistribution","-XX:+PrintGCApplicationStoppedTime","-Xloggc:/var/log/elasticsearch/gc.log","-XX:+UseGCLogFileRotation","-XX:NumberOfGCLogFiles=32","-XX:GCLogFileSize=64m","-Des.path.home=/usr/share/elasticsearch","-Des.path.conf=/usr/local/elasticsearch/config","-Des.distribution.flavor=default","-Des.distribution.type=deb"]},"thread_pool":{"watcher":{"type":"fixed","min":5,"max":5,"queue_size":1000},"force_merge":{"type":"fixed","min":1,"max":1,"queue_size":-1},"security-token-key":{"type":"fixed","min":1,"max":1,"queue_size":1000},"ml_datafeed":{"type":"fixed","min":20,"max":20,"queue_size":200},"fetch_shard_started":{"type":"scaling","min":1,"max":2,"keep_alive":"5m","queue_size":-1},"listener":{"type":"fixed","min":1,"max":1,"queue_size":-1},"ml_autodetect":{"type":"fixed","min":80,"max":80,"queue_size":80},"index":{"type":"fixed","min":1,"max":1,"queue_size":200},"refresh":{"type":"scaling","min":1,"max":1,"keep_alive":"5m","queue_size":-1},"generic":{"type":"scaling","min":4,"max":128,"keep_alive":"30s","queue_size":-1},"rollup_indexing":{"type":"fixed","min":4,"max":4,"queue_size":4},"warmer":{"type":"scaling","min":1,"max":1,"keep_alive":"5m","queue_size":-1},"search":{"type":"fixed_auto_queue_size","min":2,"max":2,"queue_size":1000},"ccr":{"type":"fixed","min":32,"max":32,"queue_siz

When Elasticsearch is running on two different machines, they need a way to discover each other. The output of your curl command indicates that you're running Elasticsearch 6.5. In that version, the setting for node discovery is discovery.zen.ping.unicast.hosts.

I would recommend adding the following setting to the elasticsearch.yml file on both nodes:

discovery.zen.ping.unicast.hosts:
    - 10.128.0.23

This will tell the second node to look for a node on the first node's server.

Note that the name of the discovery setting has changed to discovery.seed_hosts in Elasticsearch 7.x.

1 Like

Also, vitally, in 6.5.4 you must set discovery.zen.minimum_master_nodes to 2 if you have two master-eligible nodes. If you do not then your two-node cluster could split into two one-node clusters at a later date.

2 Likes

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.