1煞躬、yum install redis ? ? ?--查看是否有redis ? yum 源
[root@localhost ~]# yum install redis 已加載插件:fastestmirror
base | 3.6 kB 00:00
docker-ce-edge | 2.9 kB 00:00
docker-ce-stable | 2.9 kB 00:00
extras | 3.4 kB 00:00
updates | 3.4 kB 00:00
extras/7/x86_64/primary_db | 145 kB 00:00
Loading mirror speeds from cached hostfile* base: mirrors.sohu.com* extras: mirrors.sohu.com* updates: mirrors.sohu.com
沒有可用軟件包 redis畸裳。
錯(cuò)誤:無須任何處理
2湃鹊、yum install epel-release ? ?--下載fedora的epel倉(cāng)庫(kù)
[root@localhost ~]# yum install epel-release已加載插件:fastestmirror
Loading mirror speeds from cached hostfile* base: mirrors.sohu.com* extras: mirrors.sohu.com* updates: mirrors.sohu.com
正在解決依賴關(guān)系--> 正在檢查事務(wù)---> 軟件包 epel-release.noarch.0.7-9 將被 安裝--> 解決依賴關(guān)系完成
依賴關(guān)系解決=====================================================================Package 架構(gòu) 版本 源 大小=====================================================================正在安裝:
epel-release noarch 7-9 extras 14 k
事務(wù)概要=====================================================================安裝 1 軟件包
總下載量:14 k
安裝大兴寥摹:24 k
Is this ok [y/d/N]: y
Downloading packages:
epel-release-7-9.noarch.rpm | 14 kB 00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安裝 : epel-release-7-9.noarch 1/1
驗(yàn)證中 : epel-release-7-9.noarch 1/1已安裝:
epel-release.noarch 0:7-9完畢骇吭!
3惑申、yum install redis ? ?-- 安裝redis數(shù)據(jù)庫(kù)
[root@localhost ~]# yum install redis 已加載插件:fastestmirror
epel/x86_64/metalink | 7.9 kB 00:00
epel | 4.7 kB 00:00
(1/3): epel/x86_64/updateinfo | 857 kB 00:00
(2/3): epel/x86_64/group_gz | 266 kB 00:01
(3/3): epel/x86_64/primary_db | 6.1 MB 00:05
Loading mirror speeds from cached hostfile* base: mirrors.sohu.com* epel: mirrors.ustc.edu.cn* extras: mirrors.sohu.com* updates: mirrors.sohu.com
正在解決依賴關(guān)系--> 正在檢查事務(wù)---> 軟件包 redis.x86_64.0.3.2.10-2.el7 將被 安裝--> 正在處理依賴關(guān)系 libjemalloc.so.1()(64bit)候学,它被軟件包 redis-3.2.10-2.el7.x86_64 需要--> 正在檢查事務(wù)---> 軟件包 jemalloc.x86_64.0.3.6.0-1.el7 將被 安裝--> 解決依賴關(guān)系完成
依賴關(guān)系解決=====================================================================Package 架構(gòu) 版本 源 大小=====================================================================正在安裝:
redis x86_64 3.2.10-2.el7 epel 545 k
為依賴而安裝:
jemalloc x86_64 3.6.0-1.el7 epel 105 k
事務(wù)概要=====================================================================安裝 1 軟件包 (+1 依賴軟件包)
總下載量:650 k
安裝大信航睢:1.7 M
Is this ok [y/d/N]: y
Downloading packages:
警告:/var/cache/yum/x86_64/7/epel/packages/jemalloc-3.6.0-1.el7.x86_64.rpm: 頭V3 RSA/SHA256 Signature, 密鑰 ID 352c64e5: NOKEY
jemalloc-3.6.0-1.el7.x86_64.rpm 的公鑰尚未安裝
(1/2): jemalloc-3.6.0-1.el7.x86_64.rpm | 105 kB 00:00
(2/2): redis-3.2.10-2.el7.x86_64.rpm | 545 kB 00:01 ---------------------------------------------------------------------總計(jì) 385 kB/s | 650 kB 00:01
從 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 檢索密鑰
導(dǎo)入 GPG key 0x352C64E5:
用戶ID : "Fedora EPEL (7) <epel@fedoraproject.org>"指紋 : 91e9 7d7c 4a5e 96f1 7f3e 888f 6a2f aea2 352c 64e5軟件包 : epel-release-7-9.noarch (@extras)
來自 : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7是否繼續(xù)?[y/N]:y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安裝 : jemalloc-3.6.0-1.el7.x86_64 1/2
正在安裝 : redis-3.2.10-2.el7.x86_64 2/2
驗(yàn)證中 : redis-3.2.10-2.el7.x86_64 1/2
驗(yàn)證中 : jemalloc-3.6.0-1.el7.x86_64 2/2已安裝:
redis.x86_64 0:3.2.10-2.el7
作為依賴被安裝:
jemalloc.x86_64 0:3.6.0-1.el7
完畢梳码!
4隐圾、service redis start??
? systemctl start redis.service ? --開啟redis服務(wù)
? redis-server /etc/redis.conf ? --開啟方式二
[root@localhost ~]# service redis startRedirecting to /bin/systemctl start redis.service
5、ps -ef | grep redis ? -- 查看redis是否開啟
[root@localhost ~]# systemctl start redis.service[root@localhost ~]# ps -ef|grep redisredis? ? 5024? ? 1? 0 07:58 ?? ? ? ? 00:00:00 /usr/bin/redis-server 127.0.0.1:6379root? ? ? 5054? 4497? 0 08:00 pts/0? ? 00:00:00 grep --color=auto redis
6掰茶、redis-cli ? ? ? -- 進(jìn)入redis服務(wù)
[root@localhost ~]# redis-cli 127.0.0.1:6379> ?redis-cli 3.2.10To get help about Redis commands type:
? ? ? "help @<group>"to get a list of commandsin"help <command>"forhelp on "help <tab>" to get a list of possible help topics
? ? ? "quit" to exit
To set redis-cli perferences:
? ? ? ":set hints" enable online hints
? ? ? ":set nohints" disable online hints
Set your preferences in~/.redisclirc127.0.0.1:6379> get
(error) ERR wrong number of arguments for 'get' command127.0.0.1:6379> get key
(nil)127.0.0.1:6379> get key abc
(error) ERR wrong number of arguments for 'get' command127.0.0.1:6379> set key abc
OK127.0.0.1:6379> get key abc
(error) ERR wrong number of arguments for 'get' command127.0.0.1:6379> get key "abc"127.0.0.1:6379>
7暇藏、redis-cli ?shutdown ? ? ?--關(guān)閉服務(wù)
[root@localhost ~]# redis-cli127.0.0.1:6379> shutdown
not connected>
not connected>
[root@localhost ~]# ps -ef |grep redisroot? ? ? 5127? 4497? 0 08:34 pts/0? ? 00:00:00 grep --color=auto redis
[root@localhost ~]# systemctl start redis.service[root@localhost ~]# ps -ef |grep redisredis? ? 5134? ? 1? 0 08:34 ?? ? ? ? 00:00:00 /usr/bin/redis-server 127.0.0.1:6379root? ? ? 5138? 4497? 0 08:35 pts/0? ? 00:00:00 grep --color=auto redis
[root@localhost ~]#
8、開放端口6379濒蒋、6380的防火墻
/sbin/iptables -I INPUT -p tcp --dport 6379 ?-j ACCEPT ? 開啟6379
/sbin/iptables -I INPUT -p tcp --dport 6380 -j ACCEPT ?開啟6380
[root@localhost ~]# /sbin/iptables -I INPUT -p tcp --dport 6379 -j ACCEPT[root@localhost ~]# /sbin/iptables -I INPUT -p tcp --dport 6380 -j ACCEPT
9盐碱、使用redis ?desktop manager連接redis
轉(zhuǎn)載自博客園:https://www.cnblogs.com/qianxiaoruofeng/p/8046570.html