环境:CentOS release 6.7 (Final)
java version "1.8.0_77"
IP:192.168.98.161、192.168.98.162、192.168.98.163
安装见《简单安装elasticsearch步骤》
配置文件elasticsearch.yml:
192.168.98.161:
cluster.name : LZ
node.name : "lz-1"
path.data : "/tmp/elasticsearch/data"
path.logs : "/tmp/elasticsearch/logs"
network.host : "192.168.98.161"
network.port : "9200"
node.master : true
node.data : true
discovery.zen.ping.unicast.hosts : ["192.168.98.161","192.168.98.162","192.168.98.163"]
192.168.98.162:
cluster.name : LZ
node.name : "lz-2"
path.data : "/tmp/elasticsearch/data"
path.logs : "/tmp/elasticsearch/logs"
network.host : "192.168.98.162"
network.port : "9200"
node.master : false
node.data : true
discovery.zen.ping.unicast.hosts : ["192.168.98.161","192.168.98.162","192.168.98.163"]
192.168.98.163:
cluster.name : LZ
node.name : "lz-3"
path.data : "/tmp/elasticsearch/data"
path.logs : "/tmp/elasticsearch/logs"
network.host : "192.168.98.163"
network.port : "9200"
node.master : false
node.data : true
discovery.zen.ping.unicast.hosts : ["192.168.98.161","192.168.98.162","192.168.98.163"]
./bin/elasticsearch -d ###后台运行elasticsearch
查看集群节点列表:
[[email protected] src]# curl ‘192.168.98.161:9200/_cat/nodes?v‘
host ip heap.percent ram.percent load node.role master name
192.168.98.161 192.168.98.161 7 81 0.38 d * lz-1
192.168.98.162 192.168.98.162 2 92 0.49 d - lz-2
192.168.98.163 192.168.98.163 6 93 0.79 d - lz-3
查看索引信息:
[[email protected] ~]# curl 192.168.98.161:9200/_cat/indices
green open mysql-slowlog-2016.04.12 5 1 14 0 146.5kb 73.2kb
green open .kibana 1 1 5 0 41.1kb 20.5kb
green open tomcat 5 1 30 0 81.9kb 40.9kb
green open mysql-slowlog 5 1 5 0 55kb 27.5kb