1
  1. 下载ES安装包 wget https://artifacts.elastic.co/...
  2. 解压缩 tar -zxvf elasticsearch-7.8.0-linux-x86_64.tar.gz
  3. 将解压后的文件夹复制多份(这里复制三份,分别为node1, node2, node3)
  4. 分别进入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: "*"
  5. 分别执行node1 node2 node2 中 bin/elasticseach 启动三个节点, -d 为后台启动
./bin/elasticseach -d
  1. 访问 http://ip:9200/ 即可查看到es实例信息

ps: 节点内相互访问:

http.cors.enabled: true
http.cors.allow-origin: "*

配置外网访问:

network.host: 0.0.0.0

max_tian
11 声望0 粉丝