【发布时间】:2017-02-07 07:13:26
【问题描述】:
我想看看redis-server容器的运行状态。所以我想在redis shell中执行info,看看redis slave是否与远程redis master同步。
我的 docker-compose 文件列出的 redis 如下:
placements-store:
image: redis:3.0
command: redis-server ${REDIS_OPTIONS}
ports:
- "6379:6379"
正在运行docker-compose ps 我可以看到容器已启动并正在运行:
app_placements-store_1 docker-entrypoint.sh redis ... Up 0.0.0.0:6379->6379/tcp
我尝试执行:
docker-compose run --rm redis-cli
得到:
ERROR: No such service: redis-cli
我认为这是可以理解的,因为没有 redis-cli 容器。我正在尝试标记正在运行的 redis-server,但不知道该怎么做。
更新
我可以通过执行查看日志:
docker-compose logs -f --tail 500 placements-store
我确实得到了一些如下信息,但我正在寻找更多信息以及我可以更轻松地从外部控制的信息:
placements-store_1 | 1:S 06 Feb 19:16:35.427 * Connecting to MASTER mo-api.mydomain.com:6379
placements-store_1 | 1:S 06 Feb 19:16:35.589 * MASTER <-> SLAVE sync started
placements-store_1 | 1:S 06 Feb 19:16:35.889 * Non blocking connect for SYNC fired the event.
placements-store_1 | 1:S 06 Feb 19:16:36.189 * Master replied to PING, replication can continue...
placements-store_1 | 1:S 06 Feb 19:16:36.790 * Partial resynchronization not possible (no cached master)
placements-store_1 | 1:S 06 Feb 19:16:37.091 * Full resync from master: 5ada1d8c65fd49d67d931bea66530a169ce83a40:29442
placements-store_1 | 1:S 06 Feb 19:16:37.145 * MASTER <-> SLAVE sync: receiving 60 bytes from master
placements-store_1 | 1:S 06 Feb 19:16:37.145 * MASTER <-> SLAVE sync: Flushing old data
placements-store_1 | 1:S 06 Feb 19:16:37.145 * MASTER <-> SLAVE sync: Loading DB in memory
placements-store_1 | 1:S 06 Feb 19:16:37.145 * MASTER <-> SLAVE sync: Finished with success
【问题讨论】:
标签: redis docker-compose