CentOS7安装redis,并设置开机自启动(Redis安装、Redis自启动、Redis设置开机自启动)

来源:互联网 发布:亚洲人头大 知乎 编辑:程序博客网 时间:2024/06/05 03:14

1、下载 redis

https://redis.io/download

 

2、解压安装

  1. tar -zxvf redis-3.2.9.tar.gz
  2. cd redis-3.2.9
  3. make
  4. make install

3、安装为服务

  1. #确保在redis-3.2.9目录中
  2. utils/install_server.sh


注意:上面看到6379端口绑定了127.0.0.1地址,可以在 /etc/redis/6379.conf 文件中修改为 0.0.0.0 来允许外部访问!



4、启动/停止

刚才安装的时候,可看到在 /etc/init.d 下放了 redis_6379 这个文件,

那么,服务名是 redis_6379,所以相关的启动/停止等命令如下:
  1. #开机不启动
  2. chkconfig redis_6379 off
  3. #开机启动
  4. chkconfig redis_6379 on
  5. #停止
  6. service redis_6379 stop
  7. #启动
  8. service redis_6379 start


 
(完)













原创粉丝点击