ElasticSearch-单机多节点部署方式Centos-72

44次阅读

共计 1044 个字符,预计需要花费 3 分钟才能阅读完成。

  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

正文完
 0