美文网首页
Redhat安装单机版Redis

Redhat安装单机版Redis

作者: wyaoo | 来源:发表于2017-12-22 17:00 被阅读10次

Redis安装

修改系统参数


sed -i '/^vm.overcommit_memory/d' /etc/sysctl.conf

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

sysctl -p /etc/sysctl.conf 

安装Redis


tar zxvf /tmp/redis-3.2.9.tar.gz -C /opt

cd /opt;ln -s redis-3.2.9/ redis

cd redis;make && make install

make test

mkdir -p /etc/redis;cp /opt/redis/redis.conf /etc/redis;mkdir -p /opt/redis/logs;mkdir -p /opt/redis/db

sed -i 's/^bind 127.0.0.1/bind 0.0.0.0/g' /etc/redis/redis.conf

sed -i 's/^daemonize no/daemonize yes/g' /etc/redis/redis.conf

sed -i 's/^logfile ""/logfile "\/opt\/redis\/logs\/redis.log"/g' /etc/redis/redis.conf

sed -i 's/^dir .\//dir "\/opt\/redis\/db"/g' /etc/redis/redis.conf

启服务:


redis-server /etc/redis/redis.conf

查看redis服务:


ps -ef|grep redis

停服务:


redis-cli shutdown

redis-cli -p 6379 shutdown

测试:


redis-cli set key hi

redis-cli get key

相关文章

网友评论

      本文标题:Redhat安装单机版Redis

      本文链接:https://www.haomeiwen.com/subject/czrxgxtx.html