centos安装redis记录

centos安装redis教程:https://www.cnblogs.com/heqiuyong/p/10463334.html 或参考狂神说
以下主要记录一些重要的点:

  1. redis默认安装路径:/usr/local/bin
    在这里插入图片描述

  2. 将配置文件redis.conf复制到安装路径下,这样可以保证原有配置文件仍然存在
    一般会把自己下载的安装文件放到opt目录下去

cd /usr/local/bin
mkdir redis-config
cp /opt/redis-5.0.3/redis.conf redis-config/
  1. redis默认不是后台启动的,修改配置文件:daemonize改为yes
    在这里插入图片描述
    如果不改配置文件,直接使用redis-server命令启动:终端会被阻塞

  2. 通过指定配置文件启动:redis-server /usr/local/bin/redis-config/redis.conf
    在这里插入图片描述在这里插入图片描述

  3. 关闭redis服务
    在这里插入图片描述
    在这里插入图片描述

  4. 使用shell更方便:

[root@localhost ~]# mkdir shell-cmd
[root@localhost ~]# touch redis-start.sh
[root@localhost ~]# echo redis-server /usr/local/bin/redis-config/redis.conf >> redis-start.sh 
[root@localhost ~]# cat redis-start.sh 
redis-server /usr/local/bin/redis-config/redis.conf
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# sh redis-start.sh 
8358:C 01 Dec 2020 11:10:44.336 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
8358:C 01 Dec 2020 11:10:44.337 # Redis version=5.0.3, bits=64, commit=00000000, modified=0, pid=8358, just started
8358:C 01 Dec 2020 11:10:44.337 # Configuration loaded
[root@localhost ~]# ps -ef | grep redis
root       8359      1  0 11:10 ?        00:00:00 redis-server 127.0.0.1:6379
root       8382   6703  0 11:11 pts/1    00:00:00 grep --color=auto redis
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值