欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

Centos安装配置redis

程序员文章站 2022-04-08 16:40:49
...

编译安装: wget http://download.redis.io/releases/redis-2.8.6.tar.gztar zxvf redis-2.8.6.tar.gz cd redis-2.8.6make make PREFIX=/www/wdlinux/redis installcp redis.conf /etc/mkdir /www/wdlinux/redis/dbmkdir /www/wdlinux/redis/logtouch /www/w

编译安装:

wget http://download.redis.io/releases/redis-2.8.6.tar.gz
tar zxvf redis-2.8.6.tar.gz 
cd redis-2.8.6
make 
make PREFIX=/www/wdlinux/redis install
cp redis.conf /etc/

mkdir /www/wdlinux/redis/db
mkdir /www/wdlinux/redis/log
touch /www/wdlinux/redis/log/redis.log
ln -s /etc/redis.conf /www/wdlinux/redis/redis.conf

编辑配置文件 /etc/redis.conf:

daemonize yes
port 6379
bind 127.0.0.1
timeout 300
dir /www/wdlinux/redis/db/
logfile /www/wdlinux/redis/log/redis.log
maxmemory 1024000000

防止Redis脚本在重启或停止报错

echo "vm.overcommit_memory = 1" >> /etc/sysctl.conf
sysctl -p

运行redis

/usr/local/bin/redis-server /etc/redis.conf

添加开机启动:
echo "/usr/local/bin/redis-server /etc/redis.conf" >> /etc/rc.d/rc.local