Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documenation update execution in swarm #538

Closed
vigilanz opened this issue Dec 23, 2018 · 0 comments
Closed

Documenation update execution in swarm #538

vigilanz opened this issue Dec 23, 2018 · 0 comments
Labels
Request Request for image modification or feature

Comments

@vigilanz
Copy link

When run in a swarm (not: standalone container), idle connections to the database get dropped after 900 seconds. Hitting all applications that have long-idling connections.

To try out:

  • Start database container in swarm, expose port
  • Connect via psql from the host
  • Do nothing for > 900 seconds
  • Send some query. Will fail due to broken connection.

This is a timeout in the system drivers below vip endpoint_mode. It goes away in endpoint_mode of dnsrr, but that does not work with exposed ports. One fix is to setup net.ipv4.tcp_keepalive_time on the host to something below 900 seconds. But not everyone can do that.

One other fix that seems to work is to replace the default launch command to something like this:

(docker-compose.yml):

mydb:
image: ...
command: postgres -c tcp_keepalives_idle=600 -c tcp_keepalives_interval=60 -c tcp_keepalives_count=60

Maybe add this note to documentation. It is annoying for someone new to postgres in docker.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Request Request for image modification or feature
Projects
None yet
Development

No branches or pull requests

2 participants