我的想法是专门将endpoint_mode设置为dnsrr,希望服务中的每个弹性搜索任务在启动发现种子进程时都能获得一个随机的IP地址。这不起作用。会发生什么,它在播种时进入一个循环,永远不会决定一个大师我特别想找到一些优雅的配置,将其部署在每个不包括静态配置文件或组合文件中多个服务声明的节点上。
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.9.3
environment:
- cluster.name=es-cluster
- discovery.type=zen
- discovery.seed_hosts=elasticsearch
- cluster.initial_master_nodes=elasticsearch
- bootstrap.memory_lock=false
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- network.host=0.0.0.0
volumes:
- elasticsearch_data:/usr/share/elasticsearch/data
networks:
- elasticsearch
deploy:
mode: global
endpoint_mode: dnsrr
volumes:
...
elasticsearch_data:
networks:
...
elasticsearch:
部署后,我只是在日志中重复看到这一点(对于每个任务(:
web-services_elasticsearch.0.a6ilzu8ev6sp@dsnode3.<redacted> | {"type": "server",
"timestamp": "2020- 11-10T21:47:38,443Z", "level": "WARN", "component":
"o.e.c.c.ClusterFormationFailureHelper", "cluster.name": "es-cluster", "node.name":
"718a5740c014", "message": "master not discovered yet, this node has not previously
joined a bootstrapped (v7+) cluster, and this node must discover master-eligible
nodes [elasticsearch] to bootstrap a cluster: have discovered [{718a5740c014}
{wMUW_UyQSzSxJDaz5jYVUw} {iBXmoZqHSp24fKSEUvuUpw}{10.0.46.129}{10.0.46.129:9300}
{dilmrt} {ml.machine_memory=67428794368, xpack.installed=true, transform.node=true,
ml.max_open_jobs=20}, {99680d51349a}{BBqgO_1wRamiJZGibrhVTw}{WH6Oy5gOR1Cqs-2LUzu9Mw}
{10.0.46.123} {10.0.46.123:9300}{dilmrt}{ml.machine_memory=67424575488,
ml.max_open_jobs=20, xpack.installed=true, transform.node=true}, {27bf85fa9967}
{Fm9r8aX4Rr-xa8AF_dUaLQ} {LsL5cXghTayDtXtLeWGV3Q}{10.0.46.126}{10.0.46.126:9300}
{dilmrt} {ml.machine_memory=67424575488, ml.max_open_jobs=20, xpack.installed=true,
transform.node=true}, {fc2900a7227a}{FUztkTZQQuWqi3lyuOOfSQ}{JzACTEvzSnepc9RGXBXCzw}
{10.0.46.131} {10.0.46.131:9300}{dilmrt}{ml.machine_memory=67428794368,
ml.max_open_jobs=20, xpack.installed=true, transform.node=true}, {7b23784db269}
{Dn472Qx5RyekUMY2jeLjIA}{w- m1g1BtS6SzZkttZEidnA}{10.0.46.122}{10.0.46.122:9300}
{dilmrt}{ml.machine_memory=67424575488, ml.max_open_jobs=20, xpack.installed=true,
transform.node=true}, {7d41b0583448} {1pj_6kJZQu6n39waIzcvQQ}{xwNHOG15Q_6jwY20BbBuyQ}
{10.0.46.125}{10.0.46.125:9300}{dilmrt} {ml.machine_memory=67428794368,
ml.max_open_jobs=20, xpack.installed=true, transform.node=true}]; discovery will
continue using [10.0.46.123:9300, 10.0.46.126:9300, 10.0.46.131:9300,
10.0.46.122:9300, 10.0.46.125:9300] from hosts providers and [{718a5740c014}
{wMUW_UyQSzSxJDaz5jYVUw} {iBXmoZqHSp24fKSEUvuUpw}{10.0.46.129}{10.0.46.129:9300}
{dilmrt} {ml.machine_memory=67428794368, xpack.installed=true, transform.node=true,
ml.max_open_jobs=20}] from last-known cluster state; node term 0, last-accepted
version 0 in term 0" }
我觉得这只是node.name与主机名不匹配之类的问题,但主机名设置正确。示例:
# docker exec -it web-services_elasticsearch.e3eaakkldj7pa3ygwkqwxts4i.7gjyxyjfjscve6rw41of7fyld hostname
fc2900a7227a
任何想法都将不胜感激。
必须将主机名和node.name设置为"{{.Node.Hostname}}";然后列出CCD_ 1环境中所有可能的主机名。";{{.Node.Hostname}}";将是docker群节点的主机名。
以下工作。
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.9.3
hostname: "{{.Node.Hostname}}"
environment:
- node.name={{.Node.Hostname}}
- cluster.name=ds-cluster
- "ES_JAVA_OPTS=-Xms10g -Xmx10g"
- discovery.seed_hosts=elasticsearch
- cluster.initial_master_nodes=fqdn1.domainname.com,fqdn2.domainname.com,fqdn3.domainname.com,fqdn4.domainname.com,fqdn5.domainname.com,fqdn6.domainname.com
- node.ml=false
- xpack.ml.enabled=true
- xpack.monitoring.enabled=true
- xpack.monitoring.collection.enabled=true
- xpack.security.enabled=false
- xpack.watcher.enabled=true
- bootstrap.memory_lock=false
networks:
- backend
volumes:
- elasticsearch_data:/usr/share/elasticsearch/data
deploy:
mode: global
endpoint_mode: dnsrr
resources:
limits:
memory: 20G