Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change redis db location

Tags:

redis

To change the location of redis on ubuntu 14 is just copy the db to another path and create a symlink or need another aproach to this?

dir /var/lib/redis
like image 317
nakapaka1 Avatar asked Jan 04 '23 06:01

nakapaka1


2 Answers

You can do it by sending Redis CONFIG SET dir /new/path, and making the same change in the configuration file or issuing CONFIG REWRITE. The next dump file, e.g. created with BGSAVE, will use the new path.

like image 139
Itamar Haber Avatar answered Jan 06 '23 21:01

Itamar Haber


You solution is valid if you can afford downtime on your system during this change in order to maintain data consistency.

Another solution is to setup second Redis instance on different port on the same machine that will replicate from the first instance and you application will working with second instance. After a while you will delete your first instance.

like image 34
gsone Avatar answered Jan 06 '23 21:01

gsone