Skip to content

Instantly share code, notes, and snippets.

@holmberd
Created August 27, 2018 03:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save holmberd/ab53eb6fbfedc6eda97a9643e92b5468 to your computer and use it in GitHub Desktop.
Save holmberd/ab53eb6fbfedc6eda97a9643e92b5468 to your computer and use it in GitHub Desktop.
Move Redis data to a separate EBS volume

Move Redis data to new EBS volume (/mnt/data-01)

  • sudo vim /etc/systemd/system/redis.service

  • Set ReadWriteDirectories=-/mnt/data-01

  • sudo mkdir /mnt/data-01/redis

  • Set chown and chmod
    The permissons on /var/lib/redis are 755 and it's owned by redis:redis.
    The permissons on /var/lib/redis/dump.rdb are 644 and it's owned by redis:redis.

  • Switch configurations while redis is running

redis-cli
127.0.0.1:6379> CONFIG SET dir /data/tmp
OK
127.0.0.1:6379> CONFIG SET dbfilename temp.rdb
OK
127.0.0.1:6379> BGSAVE

tail /var/log/redis/redis.cnf

  • Alternative stop redis service and modify values in /etc/redis/redis.cnf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment