配置从节点1
1、vi /elasticsearch/conf/elasticsearch.yml
cluster.name: elastic-cluster
node.name: slave1
path.data: /usr/local/soft/elasticsearch-slave1/data/
path.logs: /usr/local/soft/elasticsearch-slave1/logs/
bootstrap.memory_lock: true
network.host: 192.168.162.72
http.port: 9201
//主节点地址,若有多个,则配置多个
discovery.zen.ping.unicast.hosts: ["192.168.162.72"]
http.cors.enabled: true
http.cors.allow-origin: "*"
2、启动服务 -d 后台启动
./elasticsearch/bin/elasticsearch -d
配置从节点2
1、vi /elasticsearch/conf/elasticsearch.yml
cluster.name: elastic-cluster
node.name: slave2
path.data: /usr/local/soft/elasticsearch-slave2/data/
path.logs: /usr/local/soft/elasticsearch-slave2/logs/
bootstrap.memory_lock: true
network.host: 192.168.162.72
http.port: 9202
//主节点地址,若有多个,则配置多个
discovery.zen.ping.unicast.hosts: ["192.168.162.72"]
http.cors.enabled: true
http.cors.allow-origin: "*"
2、启动服务 -d 后台启动
./elasticsearch/bin/elasticsearch -d
配置jvm.options
默认配置
-Xms2g
-Xmx2g
当系统内存不足时,需要调小这个值。否则启动多个节点时,由于内存不足,om会自动kill掉进程。
-Xms512m
-Xmx512m
配置elasticsearch-head(es可视化界面)
git clone git://github.com/mobz/elasticsearch-head.git
cd elasticsearch-head
npm install
npm run start
open http://localhost:9100/
注意:
当启动主点后,端口9200和9300同时启动
9200作为Http协议,节点和外部通讯,调用restful接口用9200。
9300作为Tcp协议,ES集群节点之间的通讯使用。