簡體   English   中英

使用 docker、ansible 和身份驗證部署的 Elasticsearch 集群

[英]Elasticsearch Cluster deployed with docker, ansible, and authentication

這將是一個奇怪的帖子,它是多么基本,但我被卡住了。 我已經把這個 docker-compose 文件變成了一個可以啟動集群的 ansible 工作:

version: '2.2'
services:
  es01:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.9.2
    container_name: es01
    environment:
      - node.name=es01
      - cluster.name=es-docker-cluster
      - discovery.seed_hosts=es02,es03
      - cluster.initial_master_nodes=es01,es02,es03
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - data01:/usr/share/elasticsearch/data
    ports:
      - 9200:9200
    networks:
      - elastic
  es02:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.9.2
    container_name: es02
    environment:
      - node.name=es02
      - cluster.name=es-docker-cluster
      - discovery.seed_hosts=es01,es03
      - cluster.initial_master_nodes=es01,es02,es03
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - data02:/usr/share/elasticsearch/data
    networks:
      - elastic
  es03:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.9.2
    container_name: es03
    environment:
      - node.name=es03
      - cluster.name=es-docker-cluster
      - discovery.seed_hosts=es01,es02
      - cluster.initial_master_nodes=es01,es02,es03
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - data03:/usr/share/elasticsearch/data
    networks:
      - elastic

volumes:
  data01:
    driver: local
  data02:
    driver: local
  data03:
    driver: local

networks:
  elastic:
    driver: bridge

問題是當我向集群添加安全性時,集群會返回一個 master_not_discovered_exception。 我要向 es01 添加額外的是xpack.security.enabled: trueELASTIC_PASSWORD: "password"xpack.security.transport.ssl.enabled: true

知道從這里去哪里嗎?

添加

xpack.security.transport.ssl.enabled: true

要求您首先生成證書並將其添加到服務中,以便對節點間通信進行加密。 有幾個步驟要走:

  1. 獲取一些證書,至少自己生成SSL證書
  2. 通過卷向所有節點分發證書
  3. 通過密鑰庫配置證書和密碼

請查看加密通信的一般文檔,然后查看您需要執行的docker 相關步驟

僅在您不想加密節點間通信而是加密 http 端點(rest-api)的情況下,這就是

xpack.security.http.ssl.enabled: true

是為。 使此工作的過程與前一個非常相似,並包含在所提到的文檔中。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM