Redis安装使用教程

1、Redis安装和配置

# wget http://download.redis.io/releases/redis-3.2.8.tar.gz
# tar xzf redis-3.2.8.tar.gz
# cd redis-3.2.8
# yum -y install tcl
# make
# make install
# mkdir -p /etc/redis/
# cp redis.conf /etc/redis/redis.conf
# vim /etc/redis/redis.conf
修改如下:
bind 0.0.0.0
port 6379
daemonize yes
requirepass test001

2、启动、客户端登录、停止

# /usr/local/bin/redis-server /etc/redis/redis.conf ##启动
# ps -ef | grep redis
# redis-cli -p 6379 -a test001  ##登录
# redis-cli -h 127.0.0.1 -p 6379 -a test001 ##登录
# /usr/local/bin/redis-cli -a test001 shutdown ##停止
# ps -ef | grep redis

3、开启启动运行

开机启动

本次使用兼容性处理参考:http://www.centoscn.com/CentosBug/osbug/2015/0209/4670.html
推荐使用处理方式参考:http://www.centoscn.com/CentOS/config/2015/0507/5374.html
chmod +x /etc/rc.d/rc.local
echo  "/usr/local/bin/redis-server /etc/redis/redis.conf"  >> /etc/rc.d/rc.local

猜你喜欢

转载自blog.csdn.net/lsziri/article/details/69389187