1.安装Redis
wget http://download.redis.io/redis-stable.tar.gz tar –zxvf redis-stable.tar.gz cd redis-stable make make install cd /usr/local/bin ls -l /usr/local/bin/redis-server -v
2.配置Redis
创建配置目录 cd /etc/ mkdir redis cd /var/ mkdir redis ls -l cd redis mkdir data log run ls -l 修改配置文件,配置参数 cd /opt/redis-stable cp redis.conf /etc/redis/ ls /etc/redis/ cd /etc/redis/ vi +/port redis.conf #修改端口 vi +/pidfile redis.conf #修改pid的目录为/var/redis/run/redis.pid vi +/Note redis.conf #修改dump目录为/var/redis/data vi +/logfile redis.conf #修改日志目录为/var/redis/log
3.启动redis
redis-server /etc/redis/redis.conf
4.查看进程
ps aux | grep redis-server
5.查看dump,log,pid
cd /var/redis/ ls -l cd data/ ls -l cd .. cd log/ ls -l cd .. cd run/ ls -l cd /etc/redis/ ls -l vi +/daemonize redis.conf cd /var/redis/ ls -l cd run/ ls -l cd .. cd data/ ls -l cd ..
6.测试客户端连接Redis
redis-cli quit #退出
7.添加到服务
#创建redis启动脚本 cp redis_init_script /etc/init.d/ ls -l #重命令 mv redis_init_script redis #编辑redis文件 vi redis #修改PIDFILE和CONF PIDFILE=/var/redis/run/redis.pid CONF="/etc/redis/redis.conf" #保存退出 service redis start/stop
本文转自 素颜猪 51CTO博客,原文链接:http://blog.51cto.com/suyanzhu/1944492