redis安装

官网

wget http://download.redis.io/releases/redis-3.2.3.tar.gz tar -zxvf redis-3.2.3.tar.gz

mv redis-3.2.3 redis cd redis yum install gcc tcl make test make MALLOC=libc && make install cd utils/ ./install_server.sh

配置自启动

cp /opt/redis-3.2.3/utils/redis_init_script /etc/init.d/redisd

在启动脚本开头添加如下两行注释以修改其运行级别:

1
2
3
4
#!/bin/sh
# chkconfig: 2345 90 10
# description: Redis is a persistent key-value database
#

命令

  • 设置为开机自启动服务器
    • chkconfig redisd on
  • 打开服务
    • service redisd start
  • 关闭服务
    • service redisd stop
    • /usr/sbin/redis-server /etc/redis.conf