elasticsearch集群使用docker swarm,三个节点在三个独立的服务器上

9o685dep  于 5个月前  发布在  ElasticSearch
关注(0)|答案(1)|浏览(48)

我想使用docker swarm在三个独立的服务器上设置一个三个节点的elasticsearch集群。但是当我执行docker stack deploy命令时,服务出现了,x1c 0d1x但是我从容器中获得了docker日志,三个都有错误。
node -> ubuntu1

{"@timestamp":"2023-12-09T14:11:54.628Z", "log.level": "WARN", "message":"address [10.0.12.8:9300], node [null], requesting [false] discovery result: [es02][10.0.0.29:9300] connect_exception: Failed execution: io.netty.channel.ConnectTimeoutException: connection timed out: 10.0.0.29/10.0.0.29:9300: connection timed out: 10.0.0.29/10.0.0.29:9300", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"elasticsearch[es03][generic][T#4]","log.logger":"org.elasticsearch.discovery.PeerFinder","elasticsearch.node.name":"es03","elasticsearch.cluster.name":"my-cluster"}
{"@timestamp":"2023-12-09T14:11:58.273Z", "log.level": "WARN", "message":"master not discovered yet, this node has not previously joined a bootstrapped cluster, and this node must discover master-eligible nodes [es01, es02, es03] to bootstrap a cluster: have discovered [{es03}{58joxi_jQPqr8cd0eHxySg}{uIrh9xE3SNGyLtZc6DAUUA}{es03}{10.0.0.25}{10.0.0.25:9300}{cdfhilmrstw}{8.10.4}{7000099-8100499}]; discovery will continue using [10.0.12.5:9300, 10.0.12.8:9300] from hosts providers and [{es03}{58joxi_jQPqr8cd0eHxySg}{uIrh9xE3SNGyLtZc6DAUUA}{es03}{10.0.0.25}{10.0.0.25:9300}{cdfhilmrstw}{8.10.4}{7000099-8100499}] from last-known cluster state; node term 0, last-accepted version 0 in term 0; for troubleshooting guidance, see https://www.elastic.co/guide/en/elasticsearch/reference/8.10/discovery-troubleshooting.html", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"elasticsearch[es03][cluster_coordination][T#1]","log.logger":"org.elasticsearch.cluster.coordination.ClusterFormationFailureHelper","elasticsearch.node.name":"es03","elasticsearch.cluster.name":"my-cluster"}

字符串
node -> ubuntu2

{"@timestamp":"2023-12-09T14:09:23.515Z", "log.level": "WARN", "message":"address [10.0.12.8:9300], node [null], requesting [false] discovery result: [es02][10.0.0.29:9300] connect_exception: Failed execution: io.netty.channel.ConnectTimeoutException: connection timed out: 10.0.0.29/10.0.0.29:9300: connection timed out: 10.0.0.29/10.0.0.29:9300", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"elasticsearch[es01][generic][T#3]","log.logger":"org.elasticsearch.discovery.PeerFinder","elasticsearch.node.name":"es01","elasticsearch.cluster.name":"my-cluster"}
{"@timestamp":"2023-12-09T14:09:26.306Z", "log.level": "WARN", "message":"master not discovered yet, this node has not previously joined a bootstrapped cluster, and this node must discover master-eligible nodes [es01, es02, es03] to bootstrap a cluster: have discovered [{es01}{hlJovsOSSKW7_XcF5Wcw1A}{93k4zmohQEaW1WfH7UjoRA}{es01}{10.0.0.27}{10.0.0.27:9300}{cdfhilmrstw}{8.10.4}{7000099-8100499}]; discovery will continue using [10.0.12.8:9300, 10.0.12.2:9300] from hosts providers and [{es01}{hlJovsOSSKW7_XcF5Wcw1A}{93k4zmohQEaW1WfH7UjoRA}{es01}{10.0.0.27}{10.0.0.27:9300}{cdfhilmrstw}{8.10.4}{7000099-8100499}] from last-known cluster state; node term 0, last-accepted version 0 in term 0; for troubleshooting guidance, see https://www.elastic.co/guide/en/elasticsearch/reference/8.10/discovery-troubleshooting.html", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"elasticsearch[es01][cluster_coordination][T#1]","log.logger":"org.elasticsearch.cluster.coordination.ClusterFormationFailureHelper","elasticsearch.node.name":"es01","elasticsearch.cluster.name":"my-cluster"}


node -> ubuntu3

{"@timestamp":"2023-12-09T14:10:26.640Z", "log.level": "WARN", "message":"address [10.0.12.2:9300], node [null], requesting [false] discovery result: [es03][10.0.0.25:9300] connect_timeout[30s]", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"elasticsearch[es02][generic][T#3]","log.logger":"org.elasticsearch.discovery.PeerFinder","elasticsearch.node.name":"es02","elasticsearch.cluster.name":"my-cluster"}
{"@timestamp":"2023-12-09T14:10:30.387Z", "log.level": "WARN", "message":"master not discovered yet, this node has not previously joined a bootstrapped cluster, and this node must discover master-eligible nodes [es01, es02, es03] to bootstrap a cluster: have discovered [{es02}{SdcA-EyrRyujky7n4MliiA}{cwcUzo9WQOGq1so0di2lvQ}{es02}{10.0.0.29}{10.0.0.29:9300}{cdfhilmrstw}{8.10.4}{7000099-8100499}]; discovery will continue using [10.0.12.5:9300, 10.0.12.2:9300] from hosts providers and [{es02}{SdcA-EyrRyujky7n4MliiA}{cwcUzo9WQOGq1so0di2lvQ}{es02}{10.0.0.29}{10.0.0.29:9300}{cdfhilmrstw}{8.10.4}{7000099-8100499}] from last-known cluster state; node term 0, last-accepted version 0 in term 0; for troubleshooting guidance, see https://www.elastic.co/guide/en/elasticsearch/reference/8.10/discovery-troubleshooting.html", "ecs.version": "1.2.0","service.name":"ES_ECS","event.dataset":"elasticsearch.server","process.thread.name":"elasticsearch[es02][cluster_coordination][T#1]","log.logger":"org.elasticsearch.cluster.coordination.ClusterFormationFailureHelper","elasticsearch.node.name":"es02","elasticsearch.cluster.name":"my-cluster"}


配置文件如下所示

version: '3.8'

services:
  es01:
    image: docker.elastic.co/elasticsearch/elasticsearch:8.10.4
    container_name: es01
    environment:
      - node.name=es01
      - discovery.seed_hosts=es02,es03
      - cluster.initial_master_nodes=es01,es02,es03
      - cluster.name=my-cluster
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
      - xpack.security.enabled=false
      - network.host=0.0.0.0
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - esdata01:/usr/share/elasticsearch/data
    ports:
      - 9201:9200
    networks:
      - esnet

  es02:
    image: docker.elastic.co/elasticsearch/elasticsearch:8.10.4
    container_name: es02
    environment:
      - node.name=es02
      - discovery.seed_hosts=es01,es03
      - cluster.initial_master_nodes=es01,es02,es03
      - cluster.name=my-cluster
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
      - xpack.security.enabled=false
      - network.host=0.0.0.0
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - esdata02:/usr/share/elasticsearch/data
    ports:
      - 9202:9200
    networks:
      - esnet

  es03:
    image: docker.elastic.co/elasticsearch/elasticsearch:8.10.4
    container_name: es03
    environment:
      - node.name=es03
      - discovery.seed_hosts=es01,es02
      - cluster.initial_master_nodes=es01,es02,es03
      - cluster.name=my-cluster
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
      - xpack.security.enabled=false
      - network.host=0.0.0.0
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - esdata03:/usr/share/elasticsearch/data
    ports:
      - 9203:9200
    networks:
      - esnet

volumes:
  esdata01:
    driver: local
  esdata02:
    driver: local
  esdata03:
    driver: local
networks:
  esnet:


节点如下:

谢谢你帮我

dxpyg8gm

dxpyg8gm1#

查看错误并在本地重现,似乎每个es* 节点都使用esnet网络来发现其他示例,但在入口网络上搜索其地址。
我不知道如何指定弹性哪个接口具体监听,但删除“端口”删除了入口网桥和它的接口,留下弹性一个单一的选择。
这个部署是我的复制工作:

version: "3.10"

networks:
  esnet:
    attachable: true

volumes:
  esdata:
    name: '{{index .Service.Labels "com.docker.stack.namespace"}}-esdata0{{.Task.Slot}}'

services:
  search:
    image: docker.elastic.co/elasticsearch/elasticsearch:8.10.4
    hostname: es0{{.Task.Slot}}
    environment:
      - node.name=es0{{.Task.Slot}}
      - discovery.seed_hosts=es01,es02,es03
      - cluster.initial_master_nodes=es01,es02,es03
      - cluster.name=my-cluster
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
      - xpack.security.enabled=false
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - esdata:/usr/share/elasticsearch/data
    networks:
      - esnet
    deploy:
      replicas: 3

  proxy:
    image: alpine:latest
    command:
      - /bin/sh
      - -c
      - |
        apk update
        apk add socat
        socat TCP-LISTEN:9200,fork TCP:search:9200
    ports:
      - 9200:9200
    networks:
      - esnet

字符串
当然,弹性的大多数用例可能会看到其他服务连接到esnet以进行读取或写入,在这种情况下,除了诊断之外,允许进入的代理是不必要的。

相关问题