1. Download and extract to a local elasticsearch
Download: https://www.elastic.co/cn/downloads/elasticsearch
After unpacking two copies, node1 as the primary node, node2, node3 as slave nodes
2, the master node configuration file modified
And we only need to modify elasticsearch.yml file in the / config directory
node-1:
#集群名字
cluster.name: elasticsearch-cluster
# 节点名字
node.name: node-1
#是否作为主机
node.master: true
#是否作为数据节点
node.data: false
network.host: 127.0.0.1
http.port: 9200
transport.tcp.port: 9300
# --------------------------------- 发现 ----------------------------------
# 其他节点的地址端口号,注意端口号为 节点通信端口
discovery.zen.ping.unicast.hosts: ["127.0.0.1:9300","127.0.0.1:9301", "127.0.0.1:9302"]
# 有资格作为master的节点的最小数量
discovery.zen.minimum_master_nodes: 1
# 节点将会等待响应多久后超时
discovery.zen.fd.ping_timeout: 30s
# 跨域
http.cors.enabled: true
http.cors.allow-origin: "*"
node-2:
#集群名字
cluster.name: elasticsearch-cluster
# 节点名字
node.name: node-2
#是否作为主机
node.master: true
#是否作为数据节点
node.data: false
network.host: 127.0.0.1
http.port: 9201
transport.tcp.port: 9301
# --------------------------------- 发现 ----------------------------------
# 其他节点的地址端口号,注意端口号为 节点通信端口
discovery.zen.ping.unicast.hosts: ["127.0.0.1:9300","127.0.0.1:9301", "127.0.0.1:9302"]
# 有资格作为master的节点的最小数量
discovery.zen.minimum_master_nodes: 1
# 节点将会等待响应多久后超时
discovery.zen.fd.ping_timeout: 30s
# 跨域
http.cors.enabled: true
http.cors.allow-origin: "*"
node-3:
#集群名字
cluster.name: elasticsearch-cluster
# 节点名字
node.name: node-3
#是否作为主机
node.master: true
#是否作为数据节点
node.data: false
network.host: 127.0.0.1
http.port: 9202
transport.tcp.port: 9302
# --------------------------------- 发现 ----------------------------------
# 其他节点的地址端口号,注意端口号为 节点通信端口
discovery.zen.ping.unicast.hosts: ["127.0.0.1:9300","127.0.0.1:9301", "127.0.0.1:9302"]
# 有资格作为master的节点的最小数量
discovery.zen.minimum_master_nodes: 1
# 节点将会等待响应多久后超时
discovery.zen.fd.ping_timeout: 30s
# 跨域
http.cors.enabled: true
http.cors.allow-origin: "*"
supplement:
Es need to modify the configuration information required to modify elasticsearch.yml file
you need to modify configuration information related to jvm lvm.options need to modify the file
you need to modify configuration information related es need to modify the file log4j2.properties
3. Start es
Double-click the file to run /bin/elasticsearch.bat run, pay attention, here try to run the file in the directory in turn three.
Started successfully as follows:
Browser running the following links:
http://127.0.0.1:9200/_cat/nodes?v
The results are as follows:
4, mounting head plug
Download link: https: //github.com/mobz/elasticsearch-head
After the download, unzip, enter the directory to start:
grunt server
Browser to access: http: //127.0.0.1: 9100
Note that, grunt installation instructions need to rely npm
installation instructions: npm install -g grunt-cli