成都创新互联网站制作重庆分公司

centos7.6安装redis5.0.4单机

centos7.6 安装redis5.0.4

10年的大宁网站建设经验,针对设计、前端、开发、售后、文案、推广等六对一服务,响应快,48小时及时工作处理。全网营销推广的优势是能够根据用户设备显示端的尺寸不同,自动调整大宁建站的显示方式,使网站能够适用不同显示终端,在浏览器中调整网站的宽度,无论在任何一种浏览器上浏览网站,都能展现优雅布局与设计,从而大程度地提升浏览体验。创新互联公司从事“大宁网站设计”,“大宁网站推广”以来,每个客户项目都认真落实执行。

查看列表
http://download.redis.io/releases/

目前最新版稳定版为5.0.6

[ ] redis-5.0.6.tar.gz

[root@VM_147_31_centos src]# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
[root@VM_147_31_centos src]# uname -a
Linux VM_147_31_centos 3.10.0-957.21.3.el7.x86_64 #1 SMP Tue Jun 18 16:35:19 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
[root@VM_147_31_centos src]#

创建目录
mkdir /home/redis

进入目录
cd /home/redis/

下载redis
wget http://download.redis.io/releases/redis-5.0.4.tar.gz
编译

解压redis:
tar -xvf redis-5.0.4.tar.gz

编译redis(腾讯的试验环境已经安装了GCC所以可以直接编译):
进入redis解压目录
cd redis-5.0.4/

编译
make

安装

用 make 安装 redis
make install PREFIX=/usr/local/mysoft/redis

后面是你自己的安装路径。PREFIX参数指定redis的安装目录。一般软件安装到/usr目录下
[root@VM_147_31_centos redis-5.0.4]# ll /usr/local/mysoft/redis/
total 4
drwxr-xr-x 2 root root 4096 Nov 13 17:53 bin
[root@VM_147_31_centos redis-5.0.4]# ll /usr/local/mysoft/redis/bin/
total 32700
-rwxr-xr-x 1 root root 4366640 Nov 13 17:53 redis-benchmark
-rwxr-xr-x 1 root root 8101312 Nov 13 17:53 redis-check-aof
-rwxr-xr-x 1 root root 8101312 Nov 13 17:53 redis-check-rdb
-rwxr-xr-x 1 root root 4806872 Nov 13 17:53 redis-cli
lrwxrwxrwx 1 root root 12 Nov 13 17:53 redis-sentinel -> redis-server
-rwxr-xr-x 1 root root 8101312 Nov 13 17:53 redis-server
[root@VM_147_31_centos redis-5.0.4]#

修改配置
文件由于安装目录仅仅是二进制文件,不包含配置文件,这里我们要把编译目录的配置文件拷贝过来,我们先进入到安装目录, cd /usr/local/mysoft/redis 拷贝配置文件,顺便命名为 single.conf

cp /home/redis/redis-5.0.4/redis.conf single.conf
修改配置文件,把 redis 启动改成后台启动

编辑 /home/redis/redis-5.0.4/single.conf

键入 ctrl+F 进行搜索,找到 daemonize no,把 no 改为 yes ,键入 ctrl+S 保存即可。

[root@VM_147_31_centos redis-5.0.4]# cp /home/redis/redis-5.0.4/redis.conf single.conf
[root@VM_147_31_centos redis-5.0.4]# vi /home/redis/redis-5.0.4/single.conf
[root@VM_147_31_centos redis-5.0.4]#
[root@VM_147_31_centos redis-5.0.4]# grep daemonize /home/redis/redis-5.0.4/single.conf
#Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
daemonize yes
#When the server runs non daemonized, no pid file is created if none is
#specified in the configuration. When the server is daemonized, the pid file
output for logging but daemonize, logs will be sent to /dev/null
[root@VM_147_31_centos redis-5.0.4]# pwd
/home/redis/redis-5.0.4
[root@VM_147_31_centos redis-5.0.4]#

启动 redis-server
cd src

./redis-server ../single.conf

查看redis是否正常启动
ps aux|grep redis

[root@VM_147_31_centos redis-5.0.4]# cd src
[root@VM_147_31_centos src]# ./redis-server ../single.conf
28677:C 13 Nov 2019 17:56:42.855 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
28677:C 13 Nov 2019 17:56:42.855 # Redis version=5.0.4, bits=64, commit=00000000, modified=0, pid=28677, just started
28677:C 13 Nov 2019 17:56:42.855 # Configuration loaded
[root@VM_147_31_centos src]# ps -ef | grep redis
root 28678 1 0 17:56 ? 00:00:00 ./redis-server 127.0.0.1:6379
root 28700 22792 0 17:56 pts/0 00:00:00 grep --color=auto redis
[root@VM_147_31_centos src]#

测试试验

使用 redis-cli 客户端连接本机 redis
./redis-cli -h 127.0.0.1 -p 6379
设值
set test 123456
获取值
get test

[root@VM_147_31_centos src]# ./redis-cli -h 127.0.0.1 -p 6379
127.0.0.1:6379> set test 123456docker19.3
OK
127.0.0.1:6379> get test
"123456docker19.3"
127.0.0.1:6379> exit
[root@VM_147_31_centos src]#

[root@VM_147_31_centos bin]# pwd
/usr/local/mysoft/redis/bin
[root@VM_147_31_centos bin]# ll
total 32700
-rwxr-xr-x 1 root root 4366640 Nov 13 17:53 redis-benchmark
-rwxr-xr-x 1 root root 8101312 Nov 13 17:53 redis-check-aof
-rwxr-xr-x 1 root root 8101312 Nov 13 17:53 redis-check-rdb
-rwxr-xr-x 1 root root 4806872 Nov 13 17:53 redis-cli
lrwxrwxrwx 1 root root 12 Nov 13 17:53 redis-sentinel -> redis-server
-rwxr-xr-x 1 root root 8101312 Nov 13 17:53 redis-server
[root@VM_147_31_centos bin]# ./redis-cli -v
redis-cli 5.0.4
[root@VM_147_31_centos bin]#


网页名称:centos7.6安装redis5.0.4单机
本文路径:http://cxhlcq.com/article/jdjgeh.html

其他资讯

在线咨询

微信咨询

电话咨询

028-86922220(工作日)

18980820575(7×24)

提交需求

返回顶部