本文介绍了泊坞码头之后的理由构成“链接”订购的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我有一个Redis-Elasticsearch - Logstash - 在码头工厂的Kibana堆栈,我在编排使用码头组合。 Redis将从远程位置收到日志,并将其转发给Logstash,然后将其转换为常规的Elasticsearch,Kibana。 在docker-compose.yml ,我对链接的顺序感到困惑 弹性搜索链接到没有人,而logstash链接到redis和elasticsearch elasticsearch: redis: logstash: links: - elasticsearch - redis kibana:链接: - 弹性搜索 这个订单是否正确?选择连接方向的理由是什么? 为什么我们不说弹性搜索链接到logstash?解决方案而不是使用Legacy容器链接方法您可以使用Docker用户定义的网络。基本上,您可以为服务定义一个网络,然后在docker-compose文件中指出您希望容器在该网络上运行。如果您的容器都运行在同一个网络上,他们可以通过其容器名称进行访问(DNS记录自动添加)。 1):创建用户定义的网络 docker network create pocnet 2):更新docker - 您要将容器添加到您刚创建的网络中。您的docker-compose文件将显示以下内容: 版本:'2' 服务: elasticsearch: image:elasticsearch container_name:elasticsearch ports: - {your:ports} networks: - pocnet redis: image:redis container_name:redis ports: - {your:ports} networks : - pocnet logstash: image:logstash container_name:logstash ports: - {your:ports}网络: - pocnet kibana: image:kibana container_name:kibana ports: - 5601:5601 网络: - pocnet 网络: pocnet:外部:真 3):启动服务 docker-compose up 注意:你可能想要打开一个新的shell窗口运行步骤4。 4):测试 进入Kibana容器看看你是否可以ping弹性搜索容器。 your__Machine:/ docker exec -it kibana bash kibana @ 123456:/#ping elasticsearch I have a Redis - Elasticsearch - Logstash - Kibana stack in docker which I am orchestrating using docker compose.Redis will receive the logs from a remote location, will forward them to Logstash, and then the customary Elasticsearch, Kibana.In the docker-compose.yml, I am confused about the order of "links"Elasticsearch links to no one while logstash links to both redis and elasticsearchelasticsearch:redis:logstash: links: - elasticsearch - rediskibana: links: - elasticsearchIs this order correct? What is the rational behind choosing the "link" direction.Why don't we say, elasticsearch is linked to logstash? 解决方案 Instead of using the Legacy container linking method, you could instead use Docker user defined networks. Basically you can define a network for your services and then indicate in the docker-compose file that you want the container to run on that network. If your containers all run on the same network they can access each other via their container name (DNS records are added automatically).1) : Create User Defined Networkdocker network create pocnet2) : Update docker-compose fileYou want to add your containers to the network you just created. Your docker-compose file would look something along the lines of this : version: '2'services: elasticsearch: image: elasticsearch container_name: elasticsearch ports: - "{your:ports}" networks: - pocnet redis: image: redis container_name: redis ports: - "{your:ports}" networks: - pocnet logstash: image: logstash container_name: logstash ports: - "{your:ports}" networks: - pocnet kibana: image: kibana container_name: kibana ports: - "5601:5601" networks: - pocnetnetworks: pocnet: external: true3) : Start Servicesdocker-compose upnote : you might want to open a new shell window to run step 4.4) : TestGo into the Kibana container and see if you can ping the elasticsearch container.your__Machine:/ docker exec -it kibana bashkibana@123456:/# ping elasticsearch 这篇关于泊坞码头之后的理由构成“链接”订购的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-28 19:55