【问题标题】:Redis running on Docker shuts down after some time在 Docker 上运行的 Redis 在一段时间后关闭
【发布时间】:2019-08-31 13:47:49
【问题描述】:

我有一个在 Docker 上使用 Redis 的非常简单的环境,在我将堆栈移至 Digital Ocean 之前,它曾经运行良好。我的应用程序停止工作,然后我必须重新启动它。它工作了几个小时(不到一天),然后又停止了。

当我打印出容器的日志时,这是我得到的:

1:S 30 Aug 2019 22:07:17.573 * Connecting to MASTER x.x.x.x:38606
1:S 30 Aug 2019 22:07:17.574 * MASTER <-> REPLICA sync started
1:S 30 Aug 2019 22:07:17.655 # Error condition on socket for SYNC: Connection refused
1:S 30 Aug 2019 22:07:18.577 * Connecting to MASTER x.x.x.x:38606
1:S 30 Aug 2019 22:07:18.578 * MASTER <-> REPLICA sync started
1:S 30 Aug 2019 22:07:18.660 # Error condition on socket for SYNC: Connection refused
1:S 30 Aug 2019 22:07:19.582 * Connecting to MASTER x.x.x.x:38606
1:S 30 Aug 2019 22:07:19.582 * MASTER <-> REPLICA sync started
1:S 30 Aug 2019 22:07:19.664 * Non blocking connect for SYNC fired the event.
1:S 30 Aug 2019 22:07:19.746 * Master replied to PING, replication can continue...
1:S 30 Aug 2019 22:07:19.910 * Trying a partial resynchronization (request a3f877d059813e333a734a91b16e8ebf822e3d20:1).
1:S 30 Aug 2019 22:07:19.993 * Full resync from master: ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ:0
1:S 30 Aug 2019 22:07:19.994 * Discarding previously cached master state.
1:S 30 Aug 2019 22:07:19.994 * MASTER <-> REPLICA sync: receiving 42680 bytes from master
1:S 30 Aug 2019 22:07:20.075 * MASTER <-> REPLICA sync: Flushing old data
1:S 30 Aug 2019 22:07:20.076 * MASTER <-> REPLICA sync: Loading DB in memory
1:S 30 Aug 2019 22:07:20.076 # Wrong signature trying to load DB from file
1:S 30 Aug 2019 22:07:20.077 # Failed trying to load the MASTER synchronization DB from disk
1:S 30 Aug 2019 22:07:20.584 * Connecting to MASTER x.x.x.x:38606
1:S 30 Aug 2019 22:07:20.585 * MASTER <-> REPLICA sync started
1:S 30 Aug 2019 22:07:20.664 * Non blocking connect for SYNC fired the event.
1:S 30 Aug 2019 22:07:21.996 * Module 'system' loaded from /tmp/exp_lin.so
1:S 30 Aug 2019 22:07:22.076 # Error condition on socket for SYNC: Connection reset by peer
1:M 30 Aug 2019 22:07:22.078 # Setting secondary replication ID to a3f877d059813e333a734a91b16e8ebf822e3d20, valid up to offset: 1. New replication ID is e4c7f742ac612d2fdc2124c73a14f68641f1c61e
1:M 30 Aug 2019 22:07:22.078 * MASTER MODE enabled (user request from 'id=8 addr=x.x.x.x:43490 fd=9 name= age=5 idle=0 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=34 qbuf-free=32734 obl=0 oll=0 omem=0 events=r cmd=slaveof')
sh: 1: killall: not found
./xmrig-notls: unrecognized option '--max-cpu-usage'

我没有添加任何特殊配置来复制数据、主、从或类似的东西。这是我的作文

version: '3'
services:      
  server:
    image: server
    build: .
    ports:
     - "8091:8091"
    container_name: server
    environment:
      - NODE_ENV=production
    external_links: 
      - redis

  redis:
    image: redis:5.0.5
    ports:
      - "6379:6379"
    container_name: redis

有人知道发生了什么吗?没有发生

【问题讨论】:

    标签: docker redis docker-compose digital-ocean


    【解决方案1】:

    您的 Redis 可以从 Internet 上获取并且已被黑客入侵。通过删除redis服务中的ports部分来关闭端口:

        ports:
          - "6379:6379"
    

    进一步,移除容器 docker-compose rm 并再次向上。

    This post可以解释发生了什么

    【讨论】:

    • 哇,这个答案应该作为公共服务公告播出!谢谢尤里!
    猜你喜欢
    • 2021-04-29
    • 2019-01-16
    • 1970-01-01
    • 2017-03-31
    • 2023-03-21
    • 2019-04-01
    • 1970-01-01
    • 2015-07-25
    • 1970-01-01
    相关资源
    最近更新 更多