- 下载ES安装包 wget https://artifacts.elastic.co/...
- 解压缩 tar -zxvf elasticsearch-7.8.0-linux-x86_64.tar.gz
- 将解压后的文件夹复制多份(这里复制三份,分别为node1, node2, node3)
-
分别进入node1, node2, node3中修改配置文件(省略注释掉的信息)
node1:node.name: node-1 node.master: true network.host: 0.0.0.0 http.port: 9200 transport.tcp.port: 9300 discovery.seed_hosts: ["127.0.0.1:9300", "127.0.0.1:9310", "127.0.0.1:9320"] cluster.initial_master_nodes: ["node-1"] http.cors.enabled: true http.cors.allow-origin: "*"
node2:
node.name: node-2 node.master: false network.host: 0.0.0.0 http.port: 9210 transport.tcp.port: 9310 discovery.seed_hosts: ["127.0.0.1:9300", "127.0.0.1:9310", "127.0.0.1:9320"] http.cors.enabled: true http.cors.allow-origin: "*"
node3:
node.name: node-3 node.master: false network.host: 0.0.0.0 http.port: 9220 transport.tcp.port: 9320 discovery.seed_hosts: ["127.0.0.1:9300", "127.0.0.1:9310", "127.0.0.1:9320"] http.cors.enabled: true http.cors.allow-origin: "*"
- 分别执行node1 node2 node2 中 bin/elasticseach 启动三个节点, -d 为后台启动
./bin/elasticseach -d
- 访问 http://ip:9200/ 即可查看到es实例信息
ps: 节点内相互访问:
http.cors.enabled: true
http.cors.allow-origin: "*
配置外网访问:
network.host: 0.0.0.0
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。