资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

centos7.6安装redis5.0.4单机-创新互联

centos7.6 安装redis5.0.4

成都创新互联,为您提供网站建设网站制作、网站营销推广、网站开发设计,对服务成都建筑动画等多个行业拥有丰富的网站建设及推广经验。成都创新互联网站建设公司成立于2013年,提供专业网站制作报价服务,我们深知市场的竞争激烈,认真对待每位客户,为客户提供赏心悦目的作品。 与客户共同发展进步,是我们永远的责任!

查看列表
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]#

另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


当前文章:centos7.6安装redis5.0.4单机-创新互联
文章起源:http://cdkjz.cn/article/dgecih.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220