我为了在部署多克尔Elasticsearch集群(版本5.4.0)使用多克17.04.0-CE和撰写1.12.0在Windows中 。 到目前为止,我已经做了以下内容:
1)我已经通过撰写创建了单个Elasticsearch节点具有以下配置
elasticsearch1:
build: elasticsearch/
container_name: es_1
cap_add:
- IPC_LOCK
environment:
- cluster.name=cp-es-cluster
- node.name=cloud1
- node.master=true
- http.cors.enabled=true
- http.cors.allow-origin="*"
- bootstrap.memory_lock=true
- discovery.zen.minimum_master_nodes=1
- xpack.security.enabled=false
- xpack.monitoring.enabled=false
- "ES_JAVA_OPTS=-Xms1g -Xmx1g"
ulimits:
memlock:
soft: -1
hard: -1
nofile:
soft: 65536
hard: 65536
volumes:
- esdata1:/usr/share/elasticsearch/data
ports:
- 9200:9200
- 9300:9300
networks:
docker_elk:
aliases:
- elasticsearch
这导致在节点部署,但它不是从星火访问。 我写数据
JavaEsSparkSQL.saveToEs(aggregators.toDF(), collectionName +"/record");
我碰到下面的错误,虽然节点运行
I/O exception (java.net.ConnectException) caught when processing request: Connection timed out: connect
2)我发现,如果我在节点配置中添加下列行这个问题就解决了
- network.publish_host=${ENV_IP}
3)然后我创建类似的构造为2个作为附加节点
elasticsearch1:
build: elasticsearch/
container_name: es_1
cap_add:
- IPC_LOCK
environment:
- cluster.name=cp-es-cluster
- node.name=cloud1
- node.master=true
- http.cors.enabled=true
- http.cors.allow-origin="*"
- bootstrap.memory_lock=true
- discovery.zen.minimum_master_nodes=1
- xpack.security.enabled=false
- xpack.monitoring.enabled=false
- "ES_JAVA_OPTS=-Xms1g -Xmx1g"
- network.publish_host=${ENV_IP}
ulimits:
memlock:
soft: -1
hard: -1
nofile:
soft: 65536
hard: 65536
volumes:
- esdata1:/usr/share/elasticsearch/data
ports:
- 9200:9200
- 9300:9300
networks:
docker_elk:
aliases:
- elasticsearch
elasticsearch2:
build: elasticsearch/
container_name: es_2
cap_add:
- IPC_LOCK
environment:
- cluster.name=cp-es-cluster
- node.name=cloud2
- http.cors.enabled=true
- http.cors.allow-origin="*"
- bootstrap.memory_lock=true
- discovery.zen.minimum_master_nodes=2
- xpack.security.enabled=false
- xpack.monitoring.enabled=false
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- "discovery.zen.ping.unicast.hosts=elasticsearch1"
- node.master=false
ulimits:
memlock:
soft: -1
hard: -1
nofile:
soft: 65536
hard: 65536
volumes:
- esdata2:/usr/share/elasticsearch/data
ports:
- 9201:9200
- 9301:9300
networks:
- docker_elk
elasticsearch3:
build: elasticsearch/
container_name: es_3
cap_add:
- IPC_LOCK
environment:
- cluster.name=cp-es-cluster
- node.name=cloud3
- http.cors.enabled=true
- http.cors.allow-origin="*"
- bootstrap.memory_lock=true
- discovery.zen.minimum_master_nodes=2
- xpack.security.enabled=false
- xpack.monitoring.enabled=false
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- "discovery.zen.ping.unicast.hosts=elasticsearch1"
- node.master=false
ulimits:
memlock:
soft: -1
hard: -1
nofile:
soft: 65536
hard: 65536
volumes:
- esdata3:/usr/share/elasticsearch/data
ports:
- 9202:9200
- 9302:9300
networks:
- docker_elk
此结果在3个节点的集群被成功创建。 然而,在星火再次出现相同的错误和数据不能被写入到集群。 我得到即使我添加相同的行为network.publish_host
到所有节点。
关于星火,我用elasticsearch-火花20_2.11版本5.4.0(同ES版)。 任何想法如何解决这个问题呢?