docker - 如何在Docker Swarm中替换对IP的引用

标签 docker elasticsearch docker-swarm

我正在尝试以Docker Swarm模式安装ELK。

然后,我需要告诉filebeat将日志发送到logstash。

这是我的文件拍配置文件:

#=========================== Filebeat prospectors =============================
## Each - is a prospector. Most options can be set at the prospector level, so
## you can use different prospectors for various configurations.
## Below are the prospector specific configurations.
filebeat.prospectors:
- input_type: log
  enabled: true
  paths:
{% for log in in_filebeat_dict.filebeat.logs | default([]) %}
    - {{ log }}
{% endfor %}

#================================ Outputs =====================================
# Configure what output to use when sending the data collected by the beat.
output.logstash:
  hosts: ["{{ in_filebeat_dict.filebeat.output.logstash }}:{{ in_filebeat_dict.filebeat.output.port}}"]

但是in_filebeat_dict.filebeat.output.logstash是IP,在Swarm模式下,Swarm不会决定将容器安装在哪里,所以我有点卡在这里...

有任何想法吗 ???

最佳答案

在群模式下,发现适用于ne --name参数。因此,当您使用--name logstash部署logstash时,其他服务可以通过调用名称logstash来访问它。但是请记住,它们必须位于非入口的同一网络中。如果尚未创建新的覆盖网络,请为其分配所有服务。

关于docker - 如何在Docker Swarm中替换对IP的引用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47659311/

相关文章:

bash - Docker Alpine 以另一个用户身份执行命令

docker - Docker-您可以在没有服务的情况下在集群中的节点上创建容器吗?

ssl - Kibana 未与 elasticsearch shield SSL 连接

spring - Spring Elastic Search存储库将不存储数据

ruby-on-rails - FORBIDDEN/12/index read-only/allow delete (api) 问题

Docker共享公共(public)bins和libs?

docker 创建服务与 docker 部署堆栈

docker - MacOS 14 上 docker 镜像中的 Elasticsearch vm.max_map_count 错误

sockets - 具有共享 X11 套接字的 Docker : Why can it "start" Firefox outside of the container?

javascript - 陷入永恒循环