CentOS7下Redis的安装

来源:互联网 发布:暴走漫画官方淘宝 编辑:程序博客网 时间:2024/05/19 12:18

第一步,安装EPEL,直接第二步会报错

Loaded plugins: fastestmirrorLoading mirror speeds from cached hostfile* base: centos.sonn.com* extras: mirror.supremebytes.com* updates: mirrors.cat.pdx.eduSetting up Install ProcessNo package redis available.Error: Nothing to do

所以先下载https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm后安装

第二步,安装Redis

在CLI用su提权

执行yum -y install redis

过程有点漫长,不知为啥最初链接到国外服务器了,反正最后还是完成了

Running transaction  Installing : jemalloc-3.6.0-1.el7.x86_64                                  1/2   Installing : redis-2.8.19-2.el7.x86_64                                    2/2   Verifying  : redis-2.8.19-2.el7.x86_64                                    1/2   Verifying  : jemalloc-3.6.0-1.el7.x86_64                                  2/2 Installed:  redis.x86_64 0:2.8.19-2.el7                                                   Dependency Installed:  jemalloc.x86_64 0:3.6.0-1.el7                                                 Complete!
调用
systemctl start redis.service
把redis启动起来

调用

systemctl enable redis.service

把redis做成服务.


第四步,允许外网访问

当然,我们要打开防火墙6379端口

然后vi /etc/redis.conf修改一下bind,最简单的做法就是注释掉这样大家都能访问了


最后给出redis相关的命令

Now start the redis server after this.
systemctl start redis.service
Check the running status of redis server
systemctl status redis.service
To test the installation of Redis, use below given command
redis-cli ping
If the response output is PONG, it means installation is completed successfully.
[root@localhost ~]# redis-cli ping
PONG
[root@localhost ~]#
Start/Stop/Restart/Status and Enable redis server
To start redis server
systemctl start redis.service
To stop redis server
systemctl stop redis.service
To restart redis server
systemctl restart redis.service
To get running status of redis server
systemctl status redis.service
To enable redis server at system’s booting time.
systemctl enable redis.service
To disable redis server at system’s booting time.
systemctl disable redis.service
Listening Port Of Redis Server
Redis Server listens by default at port number 6379. Use below given ss command. (To learn more about ss command)
[root@localhost ~]# ss -nlp|grep redis
tcp    LISTEN     0      128            127.0.0.1:6379                  *:*      users:(("redis-server",19706,4))

0 0
原创粉丝点击