Redis的安装

1.首先安装一个 wget 软件包

[root@Glory001 home]# yum install wget
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * extras: mirrors.ustc.edu.cn
 * updates: mirrors.ustc.edu.cn
软件包 wget-1.14-18.el7_6.1.x86_64 已安装并且是最新版本
无须任何处理
[root@Glory001 home]# 

2.随便建一个目录,专门用来装各种软件

[root@Glory001 home]# mkdir soft
[root@Glory001 home]# ls
huanghaitao  soft
[root@Glory001 home]# cd soft
[root@Glory001 soft]# 

3.访问Redis官网,,获取 链接地址

在这里插入图片描述
在这里插入图片描述

在这里插入图片描述

4.使用命令 下载安装包

[root@Glory001 soft]# wget https://download.redis.io/releases/redis-5.0.13.tar.gz
--2021-09-13 18:08:55--  https://download.redis.io/releases/redis-5.0.13.tar.gz
正在解析主机 download.redis.io (download.redis.io)... 45.60.125.1
正在连接 download.redis.io (download.redis.io)|45.60.125.1|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:1995566 (1.9M) [application/octet-stream]
正在保存至: “redis-5.0.13.tar.gz”

100%[====================================================================>] 1,995,566   2.29MB/s 用时 0.8s   

2021-09-13 18:08:56 (2.29 MB/s) - 已保存 “redis-5.0.13.tar.gz” [1995566/1995566])

[root@Glory001 soft]# ll
总用量 1952
-rw-r--r--. 1 root root 1995566 722 02:39 redis-5.0.13.tar.gz
[root@Glory001 soft]# 

可以看到我们已经下好包了

命令 tar xf redis-5.0.13.tar.gz 解压安装包

[root@Glory001 soft]# tar xf redis-5.0.13.tar.gz 
[root@Glory001 soft]# ls
redis-5.0.13  redis-5.0.13.tar.gz
[root@Glory001 soft]# cd redis-5.0.13/
[root@Glory001 redis-5.0.13]# ll
总用量 280
-rw-rw-r--.  1 root root 125833 722 02:07 00-RELEASENOTES
-rw-rw-r--.  1 root root     53 722 02:07 BUGS
-rw-rw-r--.  1 root root   2381 722 02:07 CONTRIBUTING
-rw-rw-r--.  1 root root   1487 722 02:07 COPYING
drwxrwxr-x.  6 root root    124 722 02:07 deps
-rw-rw-r--.  1 root root     11 722 02:07 INSTALL
-rw-rw-r--.  1 root root    151 722 02:07 Makefile
-rw-rw-r--.  1 root root   6888 722 02:07 MANIFESTO
-rw-rw-r--.  1 root root  20555 722 02:07 README.md
-rw-rw-r--.  1 root root  63088 722 02:07 redis.conf
-rwxrwxr-x.  1 root root    275 722 02:07 runtest
-rwxrwxr-x.  1 root root    280 722 02:07 runtest-cluster
-rwxrwxr-x.  1 root root    373 722 02:07 runtest-moduleapi
-rwxrwxr-x.  1 root root    281 722 02:07 runtest-sentinel
-rw-rw-r--.  1 root root   9710 722 02:07 sentinel.conf
drwxrwxr-x.  3 root root   4096 722 02:07 src
drwxrwxr-x. 11 root root    182 722 02:07 tests
drwxrwxr-x.  8 root root   4096 722 02:07 utils
[root@Glory001 redis-5.0.13]# 

执行 make 命令,,会发现报错,因为 Redis是 C语言写的,,C语言 编译器 没有

[root@Glory001 redis-5.0.13]# make
cd src && make all
make[1]: 进入目录“/home/soft/redis-5.0.13/src”
    CC Makefile.dep
make[1]: 离开目录“/home/soft/redis-5.0.13/src”
make[1]: 进入目录“/home/soft/redis-5.0.13/src”
rm -rf redis-server redis-sentinel redis-cli redis-benchmark redis-check-rdb redis-check-aof *.o *.gcda *.gcno *.gcov redis.info lcov-html Makefile.dep dict-benchmark
(cd ../deps && make distclean)
make[2]: 进入目录“/home/soft/redis-5.0.13/deps”
(cd hiredis && make clean) > /dev/null || true
(cd linenoise && make clean) > /dev/null || true
(cd lua && make clean) > /dev/null || true
(cd jemalloc && [ -f Makefile ] && make distclean) > /dev/null || true
(rm -f .make-*)
make[2]: 离开目录“/home/soft/redis-5.0.13/deps”
(rm -f .make-*)
echo STD=-std=c99 -pedantic -DREDIS_STATIC='' >> .make-settings
echo WARN=-Wall -W -Wno-missing-field-initializers >> .make-settings
echo OPT=-O2 >> .make-settings
echo MALLOC=jemalloc >> .make-settings
echo CFLAGS= >> .make-settings
echo LDFLAGS= >> .make-settings
echo REDIS_CFLAGS= >> .make-settings
echo REDIS_LDFLAGS= >> .make-settings
echo PREV_FINAL_CFLAGS=-std=c99 -pedantic -DREDIS_STATIC='' -Wall -W -Wno-missing-field-initializers -O2 -g -ggdb   -I../deps/hiredis -I../deps/linenoise -I../deps/lua/src -DUSE_JEMALLOC -I../deps/jemalloc/include >> .make-settings
echo PREV_FINAL_LDFLAGS=  -g -ggdb -rdynamic >> .make-settings
(cd ../deps && make hiredis linenoise lua jemalloc)
make[2]: 进入目录“/home/soft/redis-5.0.13/deps”
(cd hiredis && make clean) > /dev/null || true
(cd linenoise && make clean) > /dev/null || true
(cd lua && make clean) > /dev/null || true
(cd jemalloc && [ -f Makefile ] && make distclean) > /dev/null || true
(rm -f .make-*)
(echo "" > .make-cflags)
(echo "" > .make-ldflags)
MAKE hiredis
cd hiredis && make static
make[3]: 进入目录“/home/soft/redis-5.0.13/deps/hiredis”
gcc -std=c99 -pedantic -c -O3 -fPIC  -Wall -W -Wstrict-prototypes -Wwrite-strings -g -ggdb  net.c
make[3]: gcc:命令未找到
make[3]: *** [net.o] 错误 127
make[3]: 离开目录“/home/soft/redis-5.0.13/deps/hiredis”
make[2]: *** [hiredis] 错误 2
make[2]: 离开目录“/home/soft/redis-5.0.13/deps”
make[1]: [persist-settings] 错误 2 (忽略)
    CC adlist.o
/bin/sh: cc: 未找到命令
make[1]: *** [adlist.o] 错误 127
make[1]: 离开目录“/home/soft/redis-5.0.13/src”
make: *** [all] 错误 2
[root@Glory001 redis-5.0.13]# 

主要是不认识 cc 命令 倒数第4行

/bin/sh: cc: 未找到命令

这是需要我们安装一个 gcc 安装编译环境

命令 yum install gcc

[root@Glory001 redis-5.0.13]# yum install gcc
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.163.com
 * extras: mirrors.ustc.edu.cn
 * updates: mirrors.ustc.edu.cn
正在解决依赖关系
--> 正在检查事务
---> 软件包 gcc.x86_64.0.4.8.5-44.el7 将被 安装
--> 正在处理依赖关系 cpp = 4.8.5-44.el7,它被软件包 gcc-4.8.5-44.el7.x86_64 需要
--> 正在处理依赖关系 glibc-devel >= 2.2.90-12,它被软件包 gcc-4.8.5-44.el7.x86_64 需要
--> 正在检查事务
---> 软件包 cpp.x86_64.0.4.8.5-44.el7 将被 安装
---> 软件包 glibc-devel.x86_64.0.2.17-324.el7_9 将被 安装
--> 正在处理依赖关系 glibc-headers = 2.17-324.el7_9,它被软件包 glibc-devel-2.17-324.el7_9.x86_64 需要
--> 正在处理依赖关系 glibc = 2.17-324.el7_9,它被软件包 glibc-devel-2.17-324.el7_9.x86_64 需要
--> 正在处理依赖关系 glibc-headers,它被软件包 glibc-devel-2.17-324.el7_9.x86_64 需要
--> 正在检查事务
---> 软件包 glibc.x86_64.0.2.17-317.el7 将被 升级
--> 正在处理依赖关系 glibc = 2.17-317.el7,它被软件包 glibc-common-2.17-317.el7.x86_64 需要
---> 软件包 glibc.x86_64.0.2.17-324.el7_9 将被 更新
---> 软件包 glibc-headers.x86_64.0.2.17-324.el7_9 将被 安装
--> 正在处理依赖关系 kernel-headers >= 2.2.1,它被软件包 glibc-headers-2.17-324.el7_9.x86_64 需要
--> 正在处理依赖关系 kernel-headers,它被软件包 glibc-headers-2.17-324.el7_9.x86_64 需要
--> 正在检查事务
---> 软件包 glibc-common.x86_64.0.2.17-317.el7 将被 升级
---> 软件包 glibc-common.x86_64.0.2.17-324.el7_9 将被 更新
---> 软件包 kernel-headers.x86_64.0.3.10.0-1160.42.2.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决

============================================================================================================================================================================
 Package                                    架构                               版本                                               源                                   大小
============================================================================================================================================================================
正在安装:
 gcc                                        x86_64                             4.8.5-44.el7                                       base                                 16 M
为依赖而安装:
 cpp                                        x86_64                             4.8.5-44.el7                                       base                                5.9 M
 glibc-devel                                x86_64                             2.17-324.el7_9                                     updates                             1.1 M
 glibc-headers                              x86_64                             2.17-324.el7_9                                     updates                             691 k
 kernel-headers                             x86_64                             3.10.0-1160.42.2.el7                               updates                             9.0 M
为依赖而更新:
 glibc                                      x86_64                             2.17-324.el7_9                                     updates                             3.6 M
 glibc-common                               x86_64                             2.17-324.el7_9                                     updates                              12 M

事务概要
============================================================================================================================================================================
安装  1 软件包 (+4 依赖软件包)
升级           ( 2 依赖软件包)

总计:48 M
总下载量:33 M
Is this ok [y/d/N]: y

安装时 选择y就对了

总计:48 M
总下载量:33 M
Is this ok [y/d/N]: y
Downloading packages:
警告:/var/cache/yum/x86_64/7/updates/packages/glibc-devel-2.17-324.el7_9.x86_64.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID f4a80eb5: NOKEY  ] 1.4 MB/s | 2.0 MB  00:00:22 ETA 
glibc-devel-2.17-324.el7_9.x86_64.rpm 的公钥尚未安装
(1/5): glibc-devel-2.17-324.el7_9.x86_64.rpm                                                                                                         | 1.1 MB  00:00:01     
(2/5): glibc-headers-2.17-324.el7_9.x86_64.rpm                                                                                                       | 691 kB  00:00:02     
cpp-4.8.5-44.el7.x86_64.rpm 的公钥尚未安装                              51% [===============================                              ] 2.6 MB/s |  17 MB  00:00:06 ETA 
(3/5): cpp-4.8.5-44.el7.x86_64.rpm                                                                                                                   | 5.9 MB  00:00:06     
(4/5): kernel-headers-3.10.0-1160.42.2.el7.x86_64.rpm                                                                                                | 9.0 MB  00:00:04     
(5/5): gcc-4.8.5-44.el7.x86_64.rpm                                                                                                                   |  16 MB  00:00:11     
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
总计                                                                                                                                        2.8 MB/s |  33 MB  00:00:11     
从 file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 检索密钥
导入 GPG key 0xF4A80EB5:
 用户ID     : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
 指纹       : 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
 软件包     : centos-release-7-9.2009.0.el7.centos.x86_64 (@anaconda)
 来自       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
是否继续?[y/N]:y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在更新    : glibc-common-2.17-324.el7_9.x86_64                                                                                                                      1/9 
  正在更新    : glibc-2.17-324.el7_9.x86_64                                                                                                                             2/9 
  正在安装    : cpp-4.8.5-44.el7.x86_64                                                                                                                                 3/9 
  正在安装    : kernel-headers-3.10.0-1160.42.2.el7.x86_64                                                                                                              4/9 
  正在安装    : glibc-headers-2.17-324.el7_9.x86_64                                                                                                                     5/9 
  正在安装    : glibc-devel-2.17-324.el7_9.x86_64                                                                                                                       6/9 
  正在安装    : gcc-4.8.5-44.el7.x86_64                                                                                                                                 7/9 
  清理        : glibc-common-2.17-317.el7.x86_64                                                                                                                        8/9 
  清理        : glibc-2.17-317.el7.x86_64                                                                                                                               9/9 
  验证中      : kernel-headers-3.10.0-1160.42.2.el7.x86_64                                                                                                              1/9 
  验证中      : glibc-2.17-324.el7_9.x86_64                                                                                                                             2/9 
  验证中      : glibc-headers-2.17-324.el7_9.x86_64                                                                                                                     3/9 
  验证中      : cpp-4.8.5-44.el7.x86_64                                                                                                                                 4/9 
  验证中      : glibc-devel-2.17-324.el7_9.x86_64                                                                                                                       5/9 
  验证中      : gcc-4.8.5-44.el7.x86_64                                                                                                                                 6/9 
  验证中      : glibc-common-2.17-324.el7_9.x86_64                                                                                                                      7/9 
  验证中      : glibc-2.17-317.el7.x86_64                                                                                                                               8/9 
  验证中      : glibc-common-2.17-317.el7.x86_64                                                                                                                        9/9 

已安装:
  gcc.x86_64 0:4.8.5-44.el7                                                                                                                                                 

作为依赖被安装:
  cpp.x86_64 0:4.8.5-44.el7       glibc-devel.x86_64 0:2.17-324.el7_9       glibc-headers.x86_64 0:2.17-324.el7_9       kernel-headers.x86_64 0:3.10.0-1160.42.2.el7      

作为依赖被升级:
  glibc.x86_64 0:2.17-324.el7_9                                                     glibc-common.x86_64 0:2.17-324.el7_9                                                    

完毕!
[root@Glory001 redis-5.0.13]# 

gcc安装完毕

再一次 执行 编译命令 make

[root@Glory001 redis-5.0.13]# ll
总用量 280
-rw-rw-r--.  1 root root 125833 722 02:07 00-RELEASENOTES
-rw-rw-r--.  1 root root     53 722 02:07 BUGS
-rw-rw-r--.  1 root root   2381 722 02:07 CONTRIBUTING
-rw-rw-r--.  1 root root   1487 722 02:07 COPYING
drwxrwxr-x.  6 root root    192 913 18:21 deps
-rw-rw-r--.  1 root root     11 722 02:07 INSTALL
-rw-rw-r--.  1 root root    151 722 02:07 Makefile
-rw-rw-r--.  1 root root   6888 722 02:07 MANIFESTO
-rw-rw-r--.  1 root root  20555 722 02:07 README.md
-rw-rw-r--.  1 root root  63088 722 02:07 redis.conf
-rwxrwxr-x.  1 root root    275 722 02:07 runtest
-rwxrwxr-x.  1 root root    280 722 02:07 runtest-cluster
-rwxrwxr-x.  1 root root    373 722 02:07 runtest-moduleapi
-rwxrwxr-x.  1 root root    281 722 02:07 runtest-sentinel
-rw-rw-r--.  1 root root   9710 722 02:07 sentinel.conf
drwxrwxr-x.  3 root root   4096 913 18:21 src
drwxrwxr-x. 11 root root    182 722 02:07 tests
drwxrwxr-x.  8 root root   4096 722 02:07 utils
[root@Glory001 redis-5.0.13]# make
cd src && make all
make[1]: 进入目录“/home/soft/redis-5.0.13/src”
    CC Makefile.dep
make[1]: 离开目录“/home/soft/redis-5.0.13/src”
make[1]: 进入目录“/home/soft/redis-5.0.13/src”
    CC adlist.o
In file included from adlist.c:34:0:
zmalloc.h:50:31: 致命错误:jemalloc/jemalloc.h:没有那个文件或目录
 #include <jemalloc/jemalloc.h>
                               ^
编译中断。
make[1]: *** [adlist.o] 错误 1
make[1]: 离开目录“/home/soft/redis-5.0.13/src”
make: *** [all] 错误 2
[root@Glory001 redis-5.0.13]# 

安装报错 因为之前 安装一次报错 ,所以需要我们 清理一下 之前安装报错的临时文件

命令 make distclean

[root@Glory001 redis-5.0.13]# make distclean
cd src && make distclean
make[1]: 进入目录“/home/soft/redis-5.0.13/src”
rm -rf redis-server redis-sentinel redis-cli redis-benchmark redis-check-rdb redis-check-aof *.o *.gcda *.gcno *.gcov redis.info lcov-html Makefile.dep dict-benchmark
(cd ../deps && make distclean)
make[2]: 进入目录“/home/soft/redis-5.0.13/deps”
(cd hiredis && make clean) > /dev/null || true
(cd linenoise && make clean) > /dev/null || true
(cd lua && make clean) > /dev/null || true
(cd jemalloc && [ -f Makefile ] && make distclean) > /dev/null || true
(rm -f .make-*)
make[2]: 离开目录“/home/soft/redis-5.0.13/deps”
(rm -f .make-*)
make[1]: 离开目录“/home/soft/redis-5.0.13/src”
[root@Glory001 redis-5.0.13]# 

再一次 执行 编译命令 make

[root@Glory001 redis-5.0.13]# make

最后看到编译完成的页面
在这里插入图片描述
在这里插入图片描述
接下来安装命令
PREFIX=/opt/devEnvironment/redis5 加上这个 回会把Redis安装到我们指定的目录

[root@Glory001 src]# make install PREFIX=/opt/devEnvironment/redis5

安装完成

[root@Glory001 src]# make install PREFIX=/opt/devEnvironment/redis5
    CC Makefile.dep

Hint: It's a good idea to run 'make test' ;)

    INSTALL install
    INSTALL install
    INSTALL install
    INSTALL install
    INSTALL install
[root@Glory001 src]# 

切换目录

[root@Glory001 src]# cd /opt/devEnvironment/
[root@Glory001 devEnvironment]# ls
redis5
[root@Glory001 devEnvironment]# cd redis5/
[root@Glory001 redis5]# ls
bin
[root@Glory001 redis5]# cd bin/
[root@Glory001 bin]# ls
redis-benchmark  redis-check-aof  redis-check-rdb  redis-cli  redis-sentinel  redis-server
[root@Glory001 bin]# 

启动 Redis

[root@Glory001 bin]# service redis start
Redirecting to /bin/systemctl start redis.service
Failed to start redis.service: Unit not found.
[root@Glory001 bin]# 

发现报错 命令不支持 是因为找不到命令所在的目录
这时需要我们配置环境变量

获取Redis的安装路径 复制

[root@Glory001 bin]# cd ..
[root@Glory001 redis5]# pwd
/opt/devEnvironment/redis5
[root@Glory001 redis5]# 

在配置文件最下面添加 redis环境变量

export REDIS_HOME=/opt/devEnvironment/redis5
export PATH=$PATH:$REDIS_HOME/bin

在这里插入图片描述

然后我们切换目录 执行命令 ./install_server.sh

[root@Glory001 redis5]# cd /home/soft/redis-5.0.13/
[root@Glory001 redis-5.0.13]# ls
00-RELEASENOTES  CONTRIBUTING  deps     Makefile   README.md   runtest          runtest-moduleapi  sentinel.conf  tests
BUGS             COPYING       INSTALL  MANIFESTO  redis.conf  runtest-cluster  runtest-sentinel   src            utils
[root@Glory001 redis-5.0.13]# cd utils/
[root@Glory001 utils]# ls
build-static-symbols.tcl  create-cluster            hashtable          lru                redis_init_script.tpl  speed-regression.tcl
cluster_fail_time.tcl     generate-command-help.rb  hyperloglog        redis-copy.rb      redis-sha1.rb          whatisdoing.sh
corrupt_rdb.c             graphs                    install_server.sh  redis_init_script  releasetools
[root@Glory001 utils]# ./install_server.sh

作为一个服务端我们就安装成功了 连续Enter
在这里插入图片描述
切换目录 查看配置文件
在这里插入图片描述

Copied /tmp/6379.conf => /etc/init.d/redis_6379
Installing service...
Successfully added to chkconfig!
Successfully added to runlevels 345!
Starting Redis server...
Installation successful!
[root@Glory001 utils]# cd /etc/init.d/
[root@Glory001 init.d]# ls
functions  netconsole  network  README  redis_6379
[root@Glory001 init.d]# vi redis_6379 

注意:/etc/init.d/ 目录下的文件 表示为开机自启动的程序
查看Redis的状态

[root@Glory001 ~]# service redis_6379 status
Redis is running (1183)
[root@Glory001 ~]# 

启动第二个Redis服务

[root@Glory001 ~]# cd /home/soft/redis-5.0.13/
[root@Glory001 redis-5.0.13]# ll
总用量 284
-rw-rw-r--.  1 root root 125833 722 02:07 00-RELEASENOTES
-rw-rw-r--.  1 root root     53 722 02:07 BUGS
-rw-rw-r--.  1 root root   2381 722 02:07 CONTRIBUTING
-rw-rw-r--.  1 root root   1487 722 02:07 COPYING
drwxrwxr-x.  6 root root    192 913 18:41 deps
-rw-rw-r--.  1 root root     11 722 02:07 INSTALL
-rw-rw-r--.  1 root root    151 722 02:07 Makefile
-rw-rw-r--.  1 root root   6888 722 02:07 MANIFESTO
-rw-rw-r--.  1 root root  20555 722 02:07 README.md
-rw-rw-r--.  1 root root  63088 722 02:07 redis.conf
-rwxrwxr-x.  1 root root    275 722 02:07 runtest
-rwxrwxr-x.  1 root root    280 722 02:07 runtest-cluster
-rwxrwxr-x.  1 root root    373 722 02:07 runtest-moduleapi
-rwxrwxr-x.  1 root root    281 722 02:07 runtest-sentinel
-rw-rw-r--.  1 root root   9710 722 02:07 sentinel.conf
drwxrwxr-x.  3 root root   8192 914 09:33 src
drwxrwxr-x. 11 root root    182 722 02:07 tests
drwxrwxr-x.  8 root root   4096 722 02:07 utils
[root@Glory001 redis-5.0.13]# cd utils/
[root@Glory001 utils]# ll
总用量 52
-rw-rw-r--. 1 root root  593 722 02:07 build-static-symbols.tcl
-rw-rw-r--. 1 root root 1303 722 02:07 cluster_fail_time.tcl
-rw-rw-r--. 1 root root 1098 722 02:07 corrupt_rdb.c
drwxrwxr-x. 2 root root   60 722 02:07 create-cluster
-rwxrwxr-x. 1 root root 2149 722 02:07 generate-command-help.rb
drwxrwxr-x. 3 root root   31 722 02:07 graphs
drwxrwxr-x. 2 root root   39 722 02:07 hashtable
drwxrwxr-x. 2 root root   70 722 02:07 hyperloglog
-rwxrwxr-x. 1 root root 9567 722 02:07 install_server.sh
drwxrwxr-x. 2 root root   63 722 02:07 lru
-rw-rw-r--. 1 root root 1277 722 02:07 redis-copy.rb
-rwxrwxr-x. 1 root root 1352 722 02:07 redis_init_script
-rwxrwxr-x. 1 root root 1047 722 02:07 redis_init_script.tpl
-rw-rw-r--. 1 root root 1762 722 02:07 redis-sha1.rb
drwxrwxr-x. 2 root root  135 722 02:07 releasetools
-rwxrwxr-x. 1 root root 3787 722 02:07 speed-regression.tcl
-rwxrwxr-x. 1 root root  693 722 02:07 whatisdoing.sh
[root@Glory001 utils]# ./install_server.sh 

[root@Glory001 utils]# ./install_server.sh 
Welcome to the redis service installer
This script will help you easily set up a running redis server

Please select the redis port for this instance: [6379] 6380
Please select the redis config file name [/etc/redis/6380.conf] 
Selected default - /etc/redis/6380.conf
Please select the redis log file name [/var/log/redis_6380.log] 
Selected default - /var/log/redis_6380.log
Please select the data directory for this instance [/var/lib/redis/6380] 
Selected default - /var/lib/redis/6380
Please select the redis executable path [/opt/devEnvironment/redis5/bin/redis-server] 
Selected config:
Port           : 6380
Config file    : /etc/redis/6380.conf
Log file       : /var/log/redis_6380.log
Data dir       : /var/lib/redis/6380
Executable     : /opt/devEnvironment/redis5/bin/redis-server
Cli Executable : /opt/devEnvironment/redis5/bin/redis-cli
Is this ok? Then press ENTER to go on or Ctrl-C to abort.
Copied /tmp/6380.conf => /etc/init.d/redis_6380
Installing service...
Successfully added to chkconfig!
Successfully added to runlevels 345!
Starting Redis server...
Installation successful!
[root@Glory001 utils]# 

查看状态

[root@Glory001 utils]# service redis_6380 status
Redis is running (2192)
[root@Glory001 utils]# ps -fe | grep redis
root       1183      1  0 10:55 ?        00:00:01 /opt/devEnvironment/redis5/bin/redis-server 127.0.0.1:6379
root       2192      1  0 11:10 ?        00:00:00 /opt/devEnvironment/redis5/bin/redis-server 127.0.0.1:6380
root       2225   1942  0 11:12 pts/0    00:00:00 grep --color=auto redis
[root@Glory001 utils]# 

整个过程

1.yum install wget    
2.cd ~
3.mkdir soft
4.cd soft
5.wget https://download.redis.io/releases/redis-5.0.13.tar.gz
6.tar xf xxx.tar.gz
7.cd redis-src
8.看 README.md
9.make 
  ...yum install gcc 
  ...make distclean
10.make
11.cd src ...生成了可执行程序
12.cd ..
13.make install PREFIX=/opt/devEnvironment/redis5
14.vi /ect/profile
     export 	REDIS_HOME=/opr/decEnvironment/redis5
     export PATH=$PATH:$REDIS_HOME/bin
     source /etc/profile
15.cd utils
16 ./install_service.sh(可以执行一次或多次)
    a)一个物理机中可以有多个redis实例(进程),通过port区分
    b)可执行程序就一份在目录,但是内存中未来的多个实例需要各自的配置文件,持久化目录的资源
    c)  service redis_6379 start/stop/status  >linux  /etc/init.d/****
    d) 脚本还会帮你启动
17.ps -fe|grep redis
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值