Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redis running on Docker shuts down after some time

I got a very simple environment that uses Redis on Docker and it used to work pretty well until I moved my stack to Digital Ocean. My application stops working and then I have to restart it. It works for several hours (less than a day) and then it stops again.

When I print out the logs of the container this is what I got:

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'

I didnt add any special configuration to replicate data, master, slave or anything like that. This is my compose

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

Anyone knows what is going on? It didnt happen

like image 385
Victor Ferreira Avatar asked Nov 15 '25 18:11

Victor Ferreira


1 Answers

Your Redis is available from the Internet and been hacked. Close the port by removing ports section in redis service:

    ports:
      - "6379:6379"

Further, remove container docker-compose rm and up it again.

This post can explain what happened

like image 80
Yuriy Dyachenko Avatar answered Nov 17 '25 07:11

Yuriy Dyachenko



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!