安裝Redis的操作步驟:
1奔则、wget http://download.redis.io/releases/redis-5.0.5.tar.gz
2、cd /opt/software/
3益眉、tar zxf redis-5.0.5.tar.gz -C /usr/local/src
4、cd /usr/local/src/redis-5.0.5
5、make && make install
6郭脂、ln -s /usr/local/src/redis-5.0.5 /usr/local/redis
7年碘、vim /usr/local/redis/redis.conf
vim /usr/local/redis/redis.conf
#修改內(nèi)容如下:
daemonize yes #開(kāi)啟后臺(tái)運(yùn)行
timeout 120 #超時(shí)時(shí)間
bind 0.0.0.0 #任何地址IP都可以登錄redis
requirepass 123456 #redis密碼123456
8、cd /usr/local/redis/src
9展鸡、./redis-server /usr/local/redis/redis.conf
10屿衅、redis-cli -h 127.0.0.1 -p 6379 -a 123456
11、127.0.0.1:6379> KEYS * (empty list or set)
127.0.0.1:6379> set user ray
OK
127.0.0.1:6379> KEYS *
1) "user"
常見(jiàn)問(wèn)題:
1莹弊、redis不能遠(yuǎn)程連接時(shí)涤久,可能是防火墻的問(wèn)題:
firewall-cmd --query-port=6379/tcp
firewall-cmd --add-port=6379/tcp
firewall-cmd --query-port=6379/tcp 顯示yes為打開(kāi)