Elasticsearch节点1进行如下简单配置

cluster.name: es_cluster

node.name: "es1" 

node.master: true 

node.data: true

network.host: 192.168.81.128

discovery.zen.minimum_master_nodes: 2

discovery.zen.ping.unicast.hosts: ["192.168.81.128","192.168.81.129"]

 

启动elasticsearch服务

[elasticsearch@test opt]$ ./elasticsearch-2.3.4/bin/elasticsearch -d

 

Elasticsearch节点2进行如下简单配置

cluster.name: es_cluster

node.name: "es2"

node.master: true

node.data: true

network.host: 192.168.81.129

discovery.zen.minimum_master_nodes: 2

discovery.zen.ping.unicast.hosts: ["192.168.81.128","192.168.81.129"]

 

启动elasticsearch服务

[elasticsearch@test opt]$ ./elasticsearch-2.3.4/bin/elasticsearch -d

 

简单测试

[root@test opt]# curl -XGET

{

  "name" : "es1",

  "cluster_name" : "es_cluster",

  "version" : {

    "number" : "2.3.4",

    "build_hash" : "e455fd0c13dceca8dbbdbb1665d068ae55dabe3f",

    "build_timestamp" : "2016-06-30T11:24:31Z",

    "build_snapshot" : false,

    "lucene_version" : "5.5.0"

  },

  "tagline" : "You Know, for Search"

}

[root@test opt]# curl -XGET

{

  "name" : "es2",

  "cluster_name" : "es_cluster",

  "version" : {

    "number" : "2.3.4",

    "build_hash" : "e455fd0c13dceca8dbbdbb1665d068ae55dabe3f",

    "build_timestamp" : "2016-06-30T11:24:31Z",

    "build_snapshot" : false,

    "lucene_version" : "5.5.0"

  },

  "tagline" : "You Know, for Search"

}

[root@test opt]#

 

注意

1.集群只有两台elasticsearch的话,要保证discovery.zen.minimum_master_nodes: 1或者2,否则无法组成一个集群

2.es1.0 版本的集群的discovery默认采用的是组播(multicast)模式,但是在es2.0版本以上已去除该模式,虽然提供了multicast的插件,但是官方说不建议采用multicast的模式,故我们只能采用单播(unicast)模式。

配置参考链接:

  

Over!!