正常安装步骤如下:
1.注意redis是c编写的,所以依赖gcc环境,安装之前先yum安装gcc环境
[root@hadoop01 app]# yum install gcc
2.解压
[root@hadoop01 app]# tar -zxvf redis-6.0.5.tar.gz(提前用xftp上传)
3.安装
[root@hadoop01 app]# cd redis-6.0.5/
[root@hadoop01 app]# make
[root@hadoop01 redis-6.0.5]# cd src/
[root@hadoop01 redis-6.0.5]# make PREFIX=/usr/local/redis install
4.配置redis为后台启动
vim redis.conf
将daemonize no 改成daemonize yes
5.开启redis
[root@hadoop01 redis-6.0.5]# cp redis.conf /usr/local/bin/myconf/
[root@hadoop01 bin]# ./redis-server myconf/redis.conf
[root@hadoop01 bin]# ./redis-server myconf/redis.conf
6655:C 06 Jul 2020 20:41:16.462 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
6655:C 06 Jul 2020 20:41:16.462 # Redis version=6.0.5, bits=64, commit=00000000, modified=0, pid=6655, just started
6655:C 06 Jul 2020 20:41:16.462 # Configuration loaded
6.检测后台进程是否存在
[root@hadoop01 redis-6.0.5]# ps -ef|grep redis
root 6656 1 0 20:41 ? 00:00:00 ./redis-server 127.0.0.1:6379
root 6679 5609 0 20:43 pts/0 00:00:00 grep --color=auto redis
7.登录cli
[root@hadoop01 bin]# ./redis-cli
8.验证
127.0.0.1:6379> ping
PONG
127.0.0.1:6379> set name fx
OK
127.0.0.1:6379> get name
"fx"
127.0.0.1:6379>
9.关闭redis服务器
127.0.0.1:6379> shutdown
not connected> exit
[root@hadoop01 bin]#
10.验证进程是否关闭
[root@hadoop01 redis-6.0.5]# ps -ef|grep redis
root 6766 5609 0 20:53 pts/0 00:00:00 grep --color=auto redis
实在进程没关了,就用
11.因为Redis可以妥善处理SIGTERM信号,所以直接kill -9也是可以的
kill -9 PID(参数必须是进程或任务 ID)