redis-dump备份恢复

  运维

安装 node npm

cd /root
wget https://nodejs.org/dist/v6.11.3/node-v6.11.3-linux-x64.tar.xz
tar -xvf node-v6.11.3-linux-x64.tar.xz
cd /opt/
mv /root/node-v6.11.3-linux-x64 .
ln -s /opt/node-v6.11.3-linux-x64/bin/node /usr/local/bin/node
ln -s /opt/node-v6.11.3-linux-x64/bin/npm /usr/local/bin/npm

验证:

node -v
npm -v

安装redis-dump

npm install redis-dump -g
ln -s /opt/node-v6.11.3-linux-x64/bin/redis-dump /usr/local/bin/redis-dump

备份
可以直接dump整个数据库

redis-dump -h your_ip -p your_port -a your_password > 1.json
恢复
< db_full.json redis-load -u :your_password@your_ip:your_password

LEAVE A COMMENT

Captcha Code