设置elasticsearch
两台机器:
master ip 192.168.31.106
slave ip 192.168.31.162
master elasticsearch.yml
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
node.name: node-1
node.master: true
node.data: true
network.bind_host: 192.168.31.106
network.publish_host: 192.168.1.106
network.host: 0.0.0.0
http.max_content_length: 1024mb
discovery.zen.ping.unicast.hosts: ["192.168.31.162"]
http.cors.enabled: true
http.cors.allow-origin: "*"
discovery.zen.ping_timeout: 10s
discovery.zen.minimum_master_nodes: 2
discovery.zen.fd.ping_timeout: 10000s
discovery.zen.fd.ping_retries: 10
The discovery.zen.ping_timeout
(which defaults to 3s
) determines how long the node will wait before deciding on starting an election or joining an existing cluster.
discovery.zen.fd:
| How long to wait for a ping response, defaults to |
ES在大量插入数据时会产生gc overhead 错误,在gc overhead 过程中会进入stop-the-world状态,导致ping不通,因此调整ping的时间长度
slave elasticsearch.yml
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
node.name: node-2
node.master: true
node.data: true
network.bind_host: 192.168.31.162
network.publish_host: 192.168.1.162
network.host: 0.0.0.0
http.max_content_length: 1024mb
discovery.zen.ping.unicast.hosts: ["192.168.31.106"]
http.cors.enabled: true
http.cors.allow-origin: "*"
discovery.zen.ping_timeout: 10s
discovery.zen.minimum_master_nodes: 2
discovery.zen.fd.ping_timeout: 10000s
discovery.zen.fd.ping_retries: 10
设置node.master: true ,两台机器哪个先启动,哪个就是master。
设置kibana
server.host: "0.0.0.0"
elasticsearch.url: "http://192.168.1.162:9200"
设置ElasticSearh-head
cd /path/to/elasticsearch-head
npm install -g grunt-cli
npm install
grunt server
http://localhost:9100/