Elasticsearch集羣配置

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 http://192.168.81.128:9200

{

  "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 http://192.168.81.129:9200

{

  "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)模式。

配置參考鏈接:

http://www.cnblogs.com/muzhiye/p/elasticsearch_set_cluster.html

  

Over!!


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章