下載
下載到/etc/yum.repos.d/
···
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
···
安裝redis
···
sudo yum install redis
···
啟動(dòng)redis
···
systemctl start redis.service
···
設(shè)置redis開機(jī)啟動(dòng)
···
systemctl enable redis.service
···
高級設(shè)置
設(shè)置redis密碼
sudo vi /etc/redis.conf
,找到# foobared跨嘉,去掉注釋,把foobared改成自己密碼猎提。
刪除當(dāng)前數(shù)據(jù)庫
Flushdb
選擇某個(gè)數(shù)據(jù)庫
select 0
獲取當(dāng)前數(shù)據(jù)庫所有鍵
keys *
zset
key為 tttttest
查看該key下的value
Zrange tttttest 0 -1
連接遠(yuǎn)程redis
- 配置 *
cd /etc/redis/redis.conf
# bind 127.0.0.1 改為 bind 0.0.0.0
把 protected 什么的 關(guān)掉
重啟服務(wù)器巴比!$ sudo redis-server /etc/redis/redis.conf
連接
輸入遠(yuǎn)程的 host port