国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 數(shù)據(jù)庫 > Redis > 正文

簡(jiǎn)單粗暴的Redis數(shù)據(jù)備份和恢復(fù)方法

2020-03-17 12:40:44
字體:
供稿:網(wǎng)友

示例

目標(biāo):把服務(wù)器CentOS上的redis數(shù)據(jù)復(fù)制到Mac機(jī)上

步驟:

在CentOS上找dump文件位置

vi /etc/redis.confdbfilename dump.rdb dir /var/lib/redis

說明文件在

/var/lib/redis/dump.rdb

在mac上查找dump文件位置

vi /usr/local/etc/redis.confdbfilename dump.rdb dir /usr/local/var/db/redis

拷貝服務(wù)器上的dump.rdb到mac機(jī)器

scp root@dv:/var/lib/redis/dump.rdb ./

在mac上重啟Redis

launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.redis.plist launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis.plist


PS:備份腳本
看如下腳本,

#! /bin/bashPATH=/usr/local/bin:$PATHredis-cli SAVEdate=$(date +"%Y%m%d")cp /var/lib/redis/6379/dump.rdb /data01/cache_backup/$date.rdbecho "done!"

有如上腳本,便可以cron等方式備份redis數(shù)據(jù)文件了。細(xì)節(jié)如下:
首先必須進(jìn)行SAVE, 因?yàn)閞edis的rdb文件并非總是內(nèi)存數(shù)據(jù)的完整鏡像,備份之前必須進(jìn)行SAVE,即向其發(fā)送SAVE命令,其次拷貝走其rdb文件即可。
rdb的具體路徑不一定是如上路徑,可以在redis配置文件中查找, /etc/redis/6379.conf

# The filename where to dump the DBdbfilename dump.rdb# The working directory.## The DB will be written inside this directory, with the filename specified# above using the 'dbfilename' configuration directive.## Also the Append Only File will be created inside this directory.## Note that you must specify a directory here, not a file name.dir /var/lib/redis/6379


注:相關(guān)教程知識(shí)閱讀請(qǐng)移步到Redis頻道。
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 巴林右旗| 屯门区| 神农架林区| 苏尼特左旗| 新和县| 清镇市| 嘉鱼县| 通海县| 新田县| 黔东| 宜丰县| 贵南县| 台中县| 丰台区| 基隆市| 丹寨县| 荥阳市| 庆元县| 吉木萨尔县| 慈利县| 大丰市| 卓尼县| 周口市| 台安县| 石首市| 海口市| 武川县| 丰县| 从化市| 韩城市| 芜湖市| 五寨县| 类乌齐县| 西盟| 曲水县| 大同市| 江口县| 永登县| 伊宁市| 赤峰市| 德钦县|