卸载
查看redis进程关闭服务
[root@CentOS-003 src]# ps -ef | grep redis
root 1420426 1 0 10:18 ? 00:00:00 ./redis-server *:6379
root 1420476 1392800 0 10:18 pts/0 00:00:00 grep --color=auto redis
[root@CentOS-003 src]# pkill redis-server
[root@CentOS-003 src]#
查找相关目录文件
[root@CentOS-003 /]# find /opt/ -path "*redis*"
/opt/redis-6.2.6.tar.gz
/opt/redis-6.2.6
/opt/redis-6.2.6/.github
/opt/redis-6.2.6/.github/ISSUE_TEMPLATE
/opt/redis-6.2.6/.github/ISSUE_TEMPLATE/bug_report.md
[root@CentOS-003 /]# find / -name redis
/var/lib/selinux/targeted/active/modules/100/redis
/usr/share/selinux/targeted/default/active/modules/100/redis
[root@CentOS-003 /]#
删除相关目录文件
[root@CentOS-003 /]# rm -rf /opt/redis*
安装
1.上传文件并解压
[root@CentOS-004 ~]# cd /opt/
[root@CentOS-004 opt]# tar xzf redis-6.2.6.tar.gz
2.安装并复制配置文件
[root@CentOS-003 opt]# cd redis-6.2.6/
[root@CentOS-003 redis-6.2.6]# make
[root@CentOS-003 redis-6.2.6]# make PREFIX=/usr/local/redis install
[root@CentOS-003 redis-6.2.6]# cp redis.conf /usr/local/redis/
[root@CentOS-003 redis]# /usr/local/redis/bin/redis-server /usr/local/redis/redis.conf
[root@CentOS-003 redis]# ln -s /usr/local/redis/bin/redis-server /usr/bin/redis-server
3.本地启动
[root@CentOS-003 redis-6.2.6]# cd /usr/local/redis
[root@CentOS-003 redis]# ./bin/redis-server
4.后台启动
修改redis配置文件将daemonize设置为yes
[root@CentOS-003 redis]# cd /usr/local/redis
[root@CentOS-003 redis]# vi redis.conf
# By default Redis does not run as a daemon. Use 'yes' if you need it.
# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
# When Redis is supervised by upstart or systemd, this parameter has no impact. daemonize no
设置密码登录
# IF YOU ARE SURE YOU WANT YOUR INSTANCE TO LISTEN TO ALL THE INTERFACES # JUST COMMENT OUT THE FOLLOWING LINE.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#bind 127.0.0.1 -::1
# The requirepass is not compatable with aclfile option and the ACL LOAD
# command, these will cause requirepass to be ignored.
#
requirepass 123456
启动
[root@CentOS-003 redis]# redis-server /usr/local/redis
查看进程
ps -ef | grep -i redis