summaryrefslogtreecommitdiff
path: root/migrate_redis_to_valkey.sh
blob: 949c31b13868177e67898bbec8e05cd844dce878 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/sh
if [ -f /etc/redis/redis.conf ]; then
  cp /etc/redis/redis.conf /etc/valkey/valkey.conf
  mv /etc/redis/redis.conf /etc/redis/redis.conf.rpmsave
  sed -i 's|^dir\s.*|dir /var/lib/valkey|g' /etc/valkey/valkey.conf
  echo "/etc/redis/redis.conf has been copied to /etc/valkey/valkey.conf.  pidfile, logfile, and dir are overridden by the config at /etc/sysconfig/valkey.  Manual review of valkey.conf is strongly suggested especially if you had modified redis.conf."
fi
if [ -f /etc/redis/sentinel.conf ]; then
  cp /etc/redis/sentinel.conf /etc/valkey/sentinel.conf
  mv /etc/redis/sentinel.conf /etc/redis/sentinel.conf.rpmsave
  echo "/etc/redis/sentinel.conf has been copied to /etc/valkey/sentinel.conf.  pidfile, logfile, and dir are overridden by the config at /etc/sysconfig/valkey-sentinel.  Manual review of sentinel.conf is strongly suggested especially if you had modified sentinel.conf."
fi
if [ -d /var/lib/redis ]; then
  cp -r /var/lib/redis/* /var/lib/valkey/
  chown -R valkey. /var/lib/valkey
  mv /var/lib/redis /var/lib/redis.bak
  echo "On-disk redis dumps copied from /var/lib/redis/ to /var/lib/valkey"
fi