Redis docker starts/restarts 多次?
Redis in docker starts/restarts multiple times?
我正在尝试 运行 使用 docker 容器中的 redis docker-compose
:
docker-compose.yml:
redis:
image: redis:3.0.4
命令:
$ docker-compose up
输出:
Starting test_redis_1...
Attaching to test_redis_1
redis_1 | 1:C 06 Oct 15:16:13.265 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
redis_1 | _._
redis_1 | _.-``__ ''-._
redis_1 | _.-`` `. `_. ''-._ Redis 3.0.4 (00000000/0) 64 bit
redis_1 | .-`` .-```. ```\/ _.,_ ''-._
redis_1 | ( ' , .-` | `, ) Running in standalone mode
redis_1 | |`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
redis_1 | | `-._ `._ / _.-' | PID: 1
redis_1 | `-._ `-._ `-./ _.-' _.-'
redis_1 | |`-._`-._ `-.__.-' _.-'_.-'|
redis_1 | | `-._`-._ _.-'_.-' | http://redis.io
redis_1 | `-._ `-._`-.__.-'_.-' _.-'
redis_1 | |`-._`-._ `-.__.-' _.-'_.-'|
redis_1 | | `-._`-._ _.-'_.-' |
redis_1 | `-._ `-._`-.__.-'_.-' _.-'
redis_1 | `-._ `-.__.-' _.-'
redis_1 | `-._ _.-'
redis_1 | `-.__.-'
redis_1 |
redis_1 | 1:M 06 Oct 15:16:13.268 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
redis_1 | 1:M 06 Oct 15:16:13.268 # Server started, Redis version 3.0.4
redis_1 | 1:M 06 Oct 15:16:13.268 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
redis_1 | 1:M 06 Oct 15:16:13.268 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
redis_1 | 1:M 06 Oct 15:16:13.268 * DB loaded from disk: 0.000 seconds
redis_1 | 1:M 06 Oct 15:16:13.268 * The server is now ready to accept connections on port 6379
redis_1 | 1:signal-handler (1444144583) Received SIGTERM scheduling shutdown...
redis_1 | 1:M 06 Oct 15:16:23.761 # User requested shutdown...
redis_1 | 1:M 06 Oct 15:16:23.761 * Saving the final RDB snapshot before exiting.
redis_1 | 1:M 06 Oct 15:16:23.770 * DB saved on disk
redis_1 | 1:M 06 Oct 15:16:23.770 # Redis is now ready to exit, bye bye...
redis_1 | 1:C 06 Oct 15:16:32.194 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
redis_1 | _._
redis_1 | _.-``__ ''-._
redis_1 | _.-`` `. `_. ''-._ Redis 3.0.4 (00000000/0) 64 bit
redis_1 | .-`` .-```. ```\/ _.,_ ''-._
redis_1 | ( ' , .-` | `, ) Running in standalone mode
redis_1 | |`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
redis_1 | | `-._ `._ / _.-' | PID: 1
redis_1 | `-._ `-._ `-./ _.-' _.-'
redis_1 | |`-._`-._ `-.__.-' _.-'_.-'|
redis_1 | | `-._`-._ _.-'_.-' | http://redis.io
redis_1 | `-._ `-._`-.__.-'_.-' _.-'
redis_1 | |`-._`-._ `-.__.-' _.-'_.-'|
redis_1 | | `-._`-._ _.-'_.-' |
redis_1 | `-._ `-._`-.__.-'_.-' _.-'
redis_1 | `-._ `-.__.-' _.-'
redis_1 | `-._ _.-'
redis_1 | `-.__.-'
redis_1 |
redis_1 | 1:M 06 Oct 15:16:32.195 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
redis_1 | 1:M 06 Oct 15:16:32.195 # Server started, Redis version 3.0.4
redis_1 | 1:M 06 Oct 15:16:32.195 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
redis_1 | 1:M 06 Oct 15:16:32.195 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
redis_1 | 1:M 06 Oct 15:16:32.195 * DB loaded from disk: 0.000 seconds
redis_1 | 1:M 06 Oct 15:16:32.195 * The server is now ready to accept connections on port 6379
redis_1 | 1:signal-handler (1444144597) Received SIGTERM scheduling shutdown...
redis_1 | 1:M 06 Oct 15:16:37.141 # User requested shutdown...
redis_1 | 1:M 06 Oct 15:16:37.141 * Saving the final RDB snapshot before exiting.
redis_1 | 1:M 06 Oct 15:16:37.144 * DB saved on disk
redis_1 | 1:M 06 Oct 15:16:37.144 # Redis is now ready to exit, bye bye...
redis_1 | 1:C 06 Oct 15:17:19.085 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
redis_1 | _._
redis_1 | _.-``__ ''-._
redis_1 | _.-`` `. `_. ''-._ Redis 3.0.4 (00000000/0) 64 bit
redis_1 | .-`` .-```. ```\/ _.,_ ''-._
redis_1 | ( ' , .-` | `, ) Running in standalone mode
redis_1 | |`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
redis_1 | | `-._ `._ / _.-' | PID: 1
redis_1 | `-._ `-._ `-./ _.-' _.-'
redis_1 | |`-._`-._ `-.__.-' _.-'_.-'|
redis_1 | | `-._`-._ _.-'_.-' | http://redis.io
redis_1 | `-._ `-._`-.__.-'_.-' _.-'
redis_1 | |`-._`-._ `-.__.-' _.-'_.-'|
redis_1 | | `-._`-._ _.-'_.-' |
redis_1 | `-._ `-._`-.__.-'_.-' _.-'
redis_1 | `-._ `-.__.-' _.-'
redis_1 | `-._ _.-'
redis_1 | `-.__.-'
redis_1 |
redis_1 | 1:M 06 Oct 15:17:19.086 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
redis_1 | 1:M 06 Oct 15:17:19.086 # Server started, Redis version 3.0.4
redis_1 | 1:M 06 Oct 15:17:19.086 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
redis_1 | 1:M 06 Oct 15:17:19.086 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
redis_1 | 1:M 06 Oct 15:17:19.086 * DB loaded from disk: 0.000 seconds
redis_1 | 1:M 06 Oct 15:17:19.086 * The server is now ready to accept connections on port 6379
redis_1 | 1:signal-handler (1444144647) Received SIGTERM scheduling shutdown...
redis_1 | 1:M 06 Oct 15:17:27.247 # User requested shutdown...
redis_1 | 1:M 06 Oct 15:17:27.247 * Saving the final RDB snapshot before exiting.
redis_1 | 1:M 06 Oct 15:17:27.256 * DB saved on disk
redis_1 | 1:M 06 Oct 15:17:27.256 # Redis is now ready to exit, bye bye...
出于某种原因,redis 启动多次,有时只启动一次(这是随机的)。在日志中有很多喜欢:
redis_1 | 1:signal-handler (1444144597) Received SIGTERM scheduling shutdown...
环境:
docker-compose version: 1.4.0
Docker version 1.8.0, build 0d03096
docker-machine version 0.4.0 (9d0dc7a)
edit:只有在使用 docker-compose 时才会发生。虽然 运行ning redis 与 docker run redis:304
它工作正常。
这里讨论了类似的问题:https://github.com/docker/compose/issues/2148
将 --force-recreate
添加到 docker-compose
命令似乎可以阻止它。
我正在尝试 运行 使用 docker 容器中的 redis docker-compose
:
docker-compose.yml:
redis:
image: redis:3.0.4
命令:
$ docker-compose up
输出:
Starting test_redis_1...
Attaching to test_redis_1
redis_1 | 1:C 06 Oct 15:16:13.265 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
redis_1 | _._
redis_1 | _.-``__ ''-._
redis_1 | _.-`` `. `_. ''-._ Redis 3.0.4 (00000000/0) 64 bit
redis_1 | .-`` .-```. ```\/ _.,_ ''-._
redis_1 | ( ' , .-` | `, ) Running in standalone mode
redis_1 | |`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
redis_1 | | `-._ `._ / _.-' | PID: 1
redis_1 | `-._ `-._ `-./ _.-' _.-'
redis_1 | |`-._`-._ `-.__.-' _.-'_.-'|
redis_1 | | `-._`-._ _.-'_.-' | http://redis.io
redis_1 | `-._ `-._`-.__.-'_.-' _.-'
redis_1 | |`-._`-._ `-.__.-' _.-'_.-'|
redis_1 | | `-._`-._ _.-'_.-' |
redis_1 | `-._ `-._`-.__.-'_.-' _.-'
redis_1 | `-._ `-.__.-' _.-'
redis_1 | `-._ _.-'
redis_1 | `-.__.-'
redis_1 |
redis_1 | 1:M 06 Oct 15:16:13.268 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
redis_1 | 1:M 06 Oct 15:16:13.268 # Server started, Redis version 3.0.4
redis_1 | 1:M 06 Oct 15:16:13.268 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
redis_1 | 1:M 06 Oct 15:16:13.268 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
redis_1 | 1:M 06 Oct 15:16:13.268 * DB loaded from disk: 0.000 seconds
redis_1 | 1:M 06 Oct 15:16:13.268 * The server is now ready to accept connections on port 6379
redis_1 | 1:signal-handler (1444144583) Received SIGTERM scheduling shutdown...
redis_1 | 1:M 06 Oct 15:16:23.761 # User requested shutdown...
redis_1 | 1:M 06 Oct 15:16:23.761 * Saving the final RDB snapshot before exiting.
redis_1 | 1:M 06 Oct 15:16:23.770 * DB saved on disk
redis_1 | 1:M 06 Oct 15:16:23.770 # Redis is now ready to exit, bye bye...
redis_1 | 1:C 06 Oct 15:16:32.194 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
redis_1 | _._
redis_1 | _.-``__ ''-._
redis_1 | _.-`` `. `_. ''-._ Redis 3.0.4 (00000000/0) 64 bit
redis_1 | .-`` .-```. ```\/ _.,_ ''-._
redis_1 | ( ' , .-` | `, ) Running in standalone mode
redis_1 | |`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
redis_1 | | `-._ `._ / _.-' | PID: 1
redis_1 | `-._ `-._ `-./ _.-' _.-'
redis_1 | |`-._`-._ `-.__.-' _.-'_.-'|
redis_1 | | `-._`-._ _.-'_.-' | http://redis.io
redis_1 | `-._ `-._`-.__.-'_.-' _.-'
redis_1 | |`-._`-._ `-.__.-' _.-'_.-'|
redis_1 | | `-._`-._ _.-'_.-' |
redis_1 | `-._ `-._`-.__.-'_.-' _.-'
redis_1 | `-._ `-.__.-' _.-'
redis_1 | `-._ _.-'
redis_1 | `-.__.-'
redis_1 |
redis_1 | 1:M 06 Oct 15:16:32.195 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
redis_1 | 1:M 06 Oct 15:16:32.195 # Server started, Redis version 3.0.4
redis_1 | 1:M 06 Oct 15:16:32.195 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
redis_1 | 1:M 06 Oct 15:16:32.195 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
redis_1 | 1:M 06 Oct 15:16:32.195 * DB loaded from disk: 0.000 seconds
redis_1 | 1:M 06 Oct 15:16:32.195 * The server is now ready to accept connections on port 6379
redis_1 | 1:signal-handler (1444144597) Received SIGTERM scheduling shutdown...
redis_1 | 1:M 06 Oct 15:16:37.141 # User requested shutdown...
redis_1 | 1:M 06 Oct 15:16:37.141 * Saving the final RDB snapshot before exiting.
redis_1 | 1:M 06 Oct 15:16:37.144 * DB saved on disk
redis_1 | 1:M 06 Oct 15:16:37.144 # Redis is now ready to exit, bye bye...
redis_1 | 1:C 06 Oct 15:17:19.085 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
redis_1 | _._
redis_1 | _.-``__ ''-._
redis_1 | _.-`` `. `_. ''-._ Redis 3.0.4 (00000000/0) 64 bit
redis_1 | .-`` .-```. ```\/ _.,_ ''-._
redis_1 | ( ' , .-` | `, ) Running in standalone mode
redis_1 | |`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
redis_1 | | `-._ `._ / _.-' | PID: 1
redis_1 | `-._ `-._ `-./ _.-' _.-'
redis_1 | |`-._`-._ `-.__.-' _.-'_.-'|
redis_1 | | `-._`-._ _.-'_.-' | http://redis.io
redis_1 | `-._ `-._`-.__.-'_.-' _.-'
redis_1 | |`-._`-._ `-.__.-' _.-'_.-'|
redis_1 | | `-._`-._ _.-'_.-' |
redis_1 | `-._ `-._`-.__.-'_.-' _.-'
redis_1 | `-._ `-.__.-' _.-'
redis_1 | `-._ _.-'
redis_1 | `-.__.-'
redis_1 |
redis_1 | 1:M 06 Oct 15:17:19.086 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
redis_1 | 1:M 06 Oct 15:17:19.086 # Server started, Redis version 3.0.4
redis_1 | 1:M 06 Oct 15:17:19.086 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
redis_1 | 1:M 06 Oct 15:17:19.086 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
redis_1 | 1:M 06 Oct 15:17:19.086 * DB loaded from disk: 0.000 seconds
redis_1 | 1:M 06 Oct 15:17:19.086 * The server is now ready to accept connections on port 6379
redis_1 | 1:signal-handler (1444144647) Received SIGTERM scheduling shutdown...
redis_1 | 1:M 06 Oct 15:17:27.247 # User requested shutdown...
redis_1 | 1:M 06 Oct 15:17:27.247 * Saving the final RDB snapshot before exiting.
redis_1 | 1:M 06 Oct 15:17:27.256 * DB saved on disk
redis_1 | 1:M 06 Oct 15:17:27.256 # Redis is now ready to exit, bye bye...
出于某种原因,redis 启动多次,有时只启动一次(这是随机的)。在日志中有很多喜欢:
redis_1 | 1:signal-handler (1444144597) Received SIGTERM scheduling shutdown...
环境:
docker-compose version: 1.4.0
Docker version 1.8.0, build 0d03096
docker-machine version 0.4.0 (9d0dc7a)
edit:只有在使用 docker-compose 时才会发生。虽然 运行ning redis 与 docker run redis:304
它工作正常。
这里讨论了类似的问题:https://github.com/docker/compose/issues/2148
将 --force-recreate
添加到 docker-compose
命令似乎可以阻止它。