简体   繁体   English

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

[英]How should I replace a reference to an IP in Docker Swarm

I am trying to install ELK in Docker Swarm mode. 我正在尝试以Docker Swarm模式安装ELK。

Then, I need to tell filebeat to send logs to logstash. 然后,我需要告诉filebeat将日志发送到logstash。

Here is my filebeat config file: 这是我的文件拍配置文件:

#=========================== 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}}"]

but in_filebeat_dict.filebeat.output.logstash is an IP and in Swarm mode, Swarm will not decide where to install containers, so I'm a bit stuck here... 但是in_filebeat_dict.filebeat.output.logstash是IP,在Swarm模式下,Swarm不会决定将容器安装在何处,因此我在这里有点卡住了...

Any ideas ??? 有任何想法吗 ???

In swarm mode discovery works over ne --name parameter. 在群模式下,发现适用于ne --name参数。 So when you deploy logstash with --name logstash other services can access it by calling the name logstash . 因此,当使用--name logstash部署logstash时,其他服务可以通过调用名字logstash来访问它。 But remember, they need to be in the same network which is not ingress. 但是请记住,它们必须位于非入口的同一网络中。 Create a new overlay network if you haven't done it yet and assign all services to that. 如果尚未创建新的覆盖网络,请为其分配所有服务。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM