gpt4 book ai didi

docker - 适用于Liferay 7.1的Dockerized Elasticsearch节点不可用

转载 作者:行者123 更新时间:2023-12-02 18:28:02 25 4
gpt4 key购买 nike

Liferay启动时无法识别我的Elasticsearch群集。这是我的docker-compose配置:

version: '2.2'
services:
es01:
image: docker.elastic.co/elasticsearch/elasticsearch:7.1.1
container_name: es01
environment:
- node.name=es01
- discovery.seed_hosts=es02
- cluster.initial_master_nodes=es01,es02
- cluster.name=liferay-cluster
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- esdata01:/usr/share/elasticsearch/data
ports:
- "9299:9200"
- "9399:9300"
expose:
- "9299"
networks:
- esnet
es02:
image: docker.elastic.co/elasticsearch/elasticsearch:7.1.1
container_name: es02
environment:
- node.name=es02
- discovery.seed_hosts=es01
- cluster.initial_master_nodes=es01,es02
- cluster.name=liferay-cluster2
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
ports:
- "9298:9200"
- "9398:9300"
expose:
- "9298"
volumes:
- esdata02:/usr/share/elasticsearch/data
networks:
- esnet

volumes:
esdata01:
driver: local
esdata02:
driver: local

networks:
esnet:

com.liferay.portal.search.elasticsearch6.configuration.ElasticsearchConfiguration.config文件内容
transportAddresses="127.0.0.1:9299"
logExceptionsOnly="false"
operationMode="REMOTE"
indexNamePrefix="myprefix-"
clusterName="liferay-cluster"

启动docker-compose时,我可以访问以下两个ES集群: http://127.0.0.1:9299/ http://127.0.0.1:9298/

但是,当liferay启动时,它无法访问ES节点:
NoNodeAvailableException[None of the configured nodes are available: [{#transport#-1}{vUNCF_HNRtu_tYUjkqhXvg}{127.0.0.1}{127.0.0.1:9299}]]

有人尝试过这种配置吗?任何帮助,将不胜感激。谢谢 :-)

最佳答案

我找到了解决方案。如果有人尝试这样做,可能会有所帮助。

正如我在对@ibexit的评论中所说的那样,我正在同一台机器(开发模式)上运行两个dockerized ES集群和两个单独的Liferay门户(不在容器中)。

我更改了Liferay OSGi配置文件中的传输地址,因为它必须与运行ES的传输tcp端口匹配:

transportAddresses="127.0.0.1:9301"
logExceptionsOnly="false"
operationMode="REMOTE"
indexNamePrefix="myprefix-"
clusterName="liferay-cluster"

我还在ES群集中​​添加了属性 network.publish_host=127.0.0.1(没有此属性,Liferay无法检测到ES节点)

这是我的 docker-compose.yml :

使用ES 6.1.4
version: '2.2'
services:
es01:
image: docker.elastic.co/elasticsearch/elasticsearch:6.1.4
container_name: es01
environment:
- node.name=es01
- cluster.name=liferay-cluster
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- transport.tcp.port=9301
- network.publish_host=127.0.0.1
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- esdata01:/usr/share/elasticsearch/data
ports:
- "9201:9200"
- "9301:9301"
networks:
- esnet
es02:
image: docker.elastic.co/elasticsearch/elasticsearch:6.1.4
container_name: es02
environment:
- node.name=es02
- cluster.name=liferay-cluster2
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- transport.tcp.port=9302
- network.publish_host=127.0.0.1
ulimits:
memlock:
soft: -1
hard: -1
ports:
- "9202:9200"
- "9302:9302"
volumes:
- esdata02:/usr/share/elasticsearch/data
networks:
- esnet

volumes:
esdata01:
driver: local
esdata02:
driver: local

networks:
esnet:

network.publish_host达到了目的!

关于docker - 适用于Liferay 7.1的Dockerized Elasticsearch节点不可用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56480995/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com