安裝步驟(CentOS7.5安裝Redis5.0(tar.gz))
- 下載redis安裝包到指定目錄
wget http://221.180.170.26/cache/download.redis.io/releases/redis-5.0.4.tar.gz?ich_args2=129-10234207025837_5461eefd1ae1de1982edb3ff74280d08_10001002_9c89612bd2c3f3d8923c518939a83798_37983210af4ed9c1da3498e3bb7c448f
- 安裝gcc依賴
yum install gcc
- 編譯安裝
make MALLOC=libc
- 將當前目錄/src下的文件加到/usr/local/bin目錄
cd src && make install
- 修改redis.conf文件
daemonize no → daemonize yes
守護進程requirepass XXX
密碼bind 127.0.0.1
註釋掉即可讓所有ip訪問,若想指定ip訪問,使用"bind ip"指定即可
- 啓動redis服務
cd src
./redis-server /opt/DevTools/Redis/redis-5.0.3/redis.conf
- 登錄
redis-cli -p 6379
- 認證密碼
auth 123456
- 關閉redis服務
ps -aux | grep redis
kill -9 PID
其他命令
- 獲取密碼
config get requirepass
解決問題
- 問題:
org.springframework.data.redis.RedisSystemException: Error in execution; nested exception is io.lettuce.core.RedisCommandExecutionException: MISCONF Redis is configured to save RDB snapshots, but it is currently not able to persist on disk. Commands that may modify the data set are disabled, because this instance is configured to report errors during writes if RDB snapshotting fails (stop-writes-on-bgsave-error option). Please check the Redis logs for details about the RDB error.
- 解答:
config set stop-writes-on-bgsave-error no
- 解答: