docker-compose重新启动连接池已满 [英] docker-compose restart connection pool full

查看:300
本文介绍了docker-compose重新启动连接池已满的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我和我的团队正在使用docker-compose将我们的一些基础架构转换为docker。一切似乎都很好,我唯一的问题是重新启动,这给了我一个连接池已满的错误。我试图弄清楚是什么原因造成的。如果我删除了2个容器或(完成了1个完整的安装程序)工作正常。

My team and I are converting some of our infrastructure to docker using docker-compose. Everything appears to be working great the only issue I have is doing a restart it gives me a connection pool is full error. I am trying to figure out what is causing this. If I remove 2 containers or (1 complete setup) it works fine.

关于我要做什么的一些背景知识。这是一个Ruby on Rails应用程序,正在为组织内的不同团队使用多种不同的配置来运行。服务器总共运行14个不同的容器。主机服务器操作系统为CentOS,正在从同一网络上的MacBook Pro运行compose命令。我也使用了具有相同结果的boot2docker虚拟机进行了尝试。

A little background on what I am trying to do. This is a Ruby on Rails application that is being ran with multiple different configurations for different teams within an organization. In total the server is running 14 different containers. The host server OS is CentOS, and the compose command is being ran from a MacBook Pro on the same network. I have also tried this with a boot2docker VM with the same result.

这是命令的详细输出(使用boot2docker vm)
https://gist.github.com/rebelweb/5e6dfe34ec3e8dbb8f02c0755991ef11

Here is the verbose output from the command (using the boot2docker vm) https://gist.github.com/rebelweb/5e6dfe34ec3e8dbb8f02c0755991ef11

感谢任何帮助或指针。

推荐答案

我一直在为这个错误消息以及开发环境而苦苦挣扎使用通过 docker-compose 执行的十多个容器。

I have been struggling with this error message as well with my development environment that uses more than ten containers executed through docker-compose.

WARNING: Connection pool is full, discarding connection: localhost

我想我已经找到了根本原因问题。 python库 requests 维护一个HTTP连接池, docker 库用于与Docker API进行通信,并且大概,容器本身。我的假设是,只有我们这些使用docker-compose并具有超过10个容器的人才会看到这种情况。问题是双重的。

I think I've discovered the root cause of this issue. The python library requests maintains a pool of HTTP connections that the docker library uses to talk to the docker API and, presumably, the containers themselves. It's my hypothesis that only those of us that use docker-compose with more than 10 containers will ever see this. The problem is twofold.


  • 请求默认其连接池大小为10,并且

  • 似乎没有办法从 docker-compose docker 库

  • requests defaults its connection pool size to 10, and
  • there doesn't appear to be any way to inject a bigger pool size from the docker-compose or docker libraries

我破解了一个解决方案。我的请求库位于〜/ .local / lib / python2.7 / site-packages 中。我发现 requests / adapters.py 并将 DEFAULT_POOLSIZE 从10更改为1000。

I hacked together a solution. My libraries for requests were located in ~/.local/lib/python2.7/site-packages. I found requests/adapters.py and changed DEFAULT_POOLSIZE from 10 to 1000.

这不是生产解决方案,相当晦涩,无法在软件包升级中幸免。

This is not a production solution, is pretty obscure, and will not survive a package upgrade.

这篇关于docker-compose重新启动连接池已满的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆