1.先下载JDK ,建议下载JDK11.
2.下载ES Windows安装包
3.下载完成后,在本地解压三份,分别取名 node1,node2,node3
4.若启动一直报端口占用,这修改 每个文件夹下bin/elasticsearch.bat文件,没有则跳过
在大概85行添加
set ES_PATH_CONF=E:\software\ES\elasticsearch-7.11.0-node2\config
具体文件位置按需修改
5.修改每个节点conf下的elasticsearch.yml文件
cluster.name: my-application
node.name: node-3
path.data: E:\software\ES\elasticsearch-7.11.0-node3\data
path.logs: E:\software\ES\elasticsearch-7.11.0-node3\logs
network.host: 127.0.0.1
http.port: 9203
transport.tcp.port: 9303
#允许跨域请求
http.cors.enabled: true
http.cors.allow-origin: "*"
discovery.zen.ping.unicast.hosts: ["127.0.0.1:9300","127.0.0.1:9302","127.0.0.1:9303"]
cluster.initial_master_nodes: ["node-1","node-2","node-3"]
gateway.recover_after_nodes: 2
其中 只需修改 node.name,http.port,transport.tcp.port 即可
6.分别启动每个节点
- 在head插件上即可看见集群有3台机器