CentOS 6.5 安装Redis

前端之家收集整理的这篇文章主要介绍了CentOS 6.5 安装Redis前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

1.安装gcc-c++

2.下载并安装redis

参照 http://www.cnblogs.com/haoxinyue/p/3620648.html

wget http://download.redis.io/redis-stable.tar.gz

tar xvzf redis-stable.tar.gz

cd redis-stable

make

3.执行测试代码

yum install -y tcl

make test

4.安装redis

cp src/redis-server /usr/local/bin/

cp src/redis-cli /usr/local/bin/

mkdir /etc/redis /var/redis/var/redis/log /var/redis/run /var/redis/6379

cp redis.conf /etc/redis/6379.conf

vi /etc/redis/6379.conf

daemonize yes

pidfile /var/redis/run/redis_6379.pid

logfile /var/redis/log/redis_6379.log

dir /var/redis/6379

#bind 127.0.0.1 ## 注释此行用于redis在外部访问

protected-mode no ## 改成no是为了非本地访问时,既不绑定ip也不设置密码

###注释下方3条语句并加上save "",禁止redis启用rdb缓存

#save 900 1
#save 300 10
#save 60 10000

save ""


5.运行redis

$ redis-server /etc/redis/6379.conf
6.设置redis自启动
cp utils/redis_init_script /etc/init.d/redis
vi /etc/init.d/redis
#!/bin/sh
#
# chkconfig: 2345 90 10
# description: Redis is a persistent key-value database

...

chkconfig /etc/init.d/redis on

猜你在找的CentOS相关文章