1

The Redis process suddenly disappeared.

I tried to restart it, but was killed again(See following):

/usr/local/bin/redis-server /etc/redis.conf
Killed

And following is the log content, no any exception.

> [19724] 26 Nov 10:45:29.457 # Server started, Redis version 2.6.16
> [19724] 26 Nov 10:46:13.172 * DB loaded from disk: 43.715 seconds
> [19724] 26 Nov 10:46:13.182 * The server is now ready to accept
> connections on port 6379

The dump.rdb file is 1.5GB, and there is ~5GB free RAM(Which is enough i think).

I notcied the free RAM reduced from 5GB to 0 when Redis was loading DB. After it was killed the free RAM became 5GB again.

Why 1.5GB dump.rdb needs 5GB RAM, is it a bug? How to solve this problem? I don't want to remove the current dump.rdp, there is some important data.

OS Version: Ubuntu 12.04.1 LTS 64bit

Redis Version: 2.6.16

1 Answer 1

4

The size of the dump.rdb is not 1:1 with the RAM usage. See Why a 500MB Redis dump.rdb file takes about 5.0GB memory?.

Redis seems to have been killed by the OOM.

It is the job of the linux 'oom killer' to sacrifice one or more processes in order to free up memory for the system when all else fails. It will also kill any process sharing the same mm_struct as the selected process, for obvious reasons.

If your Redis dataset is bigger than the available RAM, in your case, the OOM will try to free up memory and kill it. You can either disable the OOM on Redis:

Any particular process leader may be immunized against the oom killer if the value of its /proc//oomadj is set to the constant OOM_DISABLE (currently defined as -17).

...see How to Configure the Linux Out-of-Memory Killer but your server will start to swap if not enough free memory is available.

So you may want to use tools like redis-rdb-tool or rdb2csv to analyze and export valuable data or to use a server with more memory.

5
  • Thanks a lot! Can we set the max RAM size the Redis server can use? e.g. 4GB. If the dataset is bigger than 4GB, then save the new data into Disk. Redis is known as RAM + Disk, could it be that disk is just for storing dump data?
    – redice
    Nov 26, 2013 at 17:23
  • Yes you can set the max RAM sie with the maxmemory ` maxmemory-policy` parameters in redis configuration file.
    – FGRibreau
    Nov 26, 2013 at 17:30
  • "Redis is known as RAM + Disk" not exactly, Redis is memory database only (all the dataset must live in memory), disk is only used for persistence.
    – FGRibreau
    Nov 26, 2013 at 17:31
  • Can i use Swap to avoid such problem?
    – redice
    Nov 28, 2013 at 2:05
  • Humm that's really not a good idea, swapping will make your system really really slow (if not unstable).
    – FGRibreau
    Nov 28, 2013 at 10:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.