CentOS6.8安装Redis3.2.5
来源:互联网 发布:杰视帮美工教程 编辑:程序博客网 时间:2024/05/20 04:11
1、下载Redis3.2.5安装包
wget http://download.redis.io/releases/redis-3.2.5.tar.gz
2、解压、编译、安装redis-3.2.5:
tar -zxvf redis-3.2.5.tar.gz -C /usr/src/
cd /usr/src/redis-3.2.5/
make && make install
3、创建redis相关目录:
mkdir -p /home/redis/bin
mkdir -p /home/redis/log
mkdir -p /home/redis/pid
mkdir -p /home/redis/db
4、将可执行文件复制到自己的安装目录:/home/redis/
ln -s /usr/local/bin/redis-* /home/redis/bin/
5、复制配置文件到自己的安装目录:/home/redis/
cp redis.conf /home/redis/
6、进入自己的安装目录,编辑redis.conf配置文件:
cd /home/redis/
vim /home/redis/redis.conf
根据实际需要修改配置文件,以下仅供参考
daemonize yes
pidfile /home/redis/pid/redis.pid
logfile /home/redis/log/redis.log
dir /home/redis/db
port 6379
tcp-backlog 511
timeout 600
tcp-keepalive 0
loglevel notice
databases 16
save 900 1
save 300 10
save 60 10000
rdbcompression yes
dbfilename dump.rdb
slave-serve-stale-data yes
appendonly yes
appendfilename “appendonly.aof”
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events “”
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-entries 512
list-max-ziplist-value 64
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
aof-rewrite-incremental-fsync yes
vm-enabled no
maxmemory 4G
7、创建redis服务脚本,并赋予权限:
vim /etc/init.d/redis
!/bin/sh
#
Simple Redis init.d script conceived to work on Linux systems
as it does use of the /proc filesystem.
PATH=/home/redis/bin:/sbin:/usr/bin:/bin
REDISPORT=6379
EXEC=/home/redis/bin/redis-server
CLIEXEC=/home/redis/bin/redis-cli
PIDFILE=/home/redis/pid/redis.pid
CONF=”/home/redis/redis.conf”
case “
then
echo “
then
echo “
do
echo “Waiting for Redis to shutdown …”
sleep 1
done
echo “Redis stopped”
fi
;;
*)
echo “Please use start or stop as first argument”
;;
esac
8、添加redis服务开机启动:
chmod a+x /etc/init.d/redis
9、启动redis服务:
service redis start
ps -ef | grep redis
netstat -anptu | grep 6379
10、测试OK
redis-cli
set key1 hello
get key1
quit
(防火墙启用6379端口:iptables -A INPUT -p tcp –dport 6379 -j ACCEPT)
- CentOS6.8安装Redis3.2.5
- CentOS6.8安装Redis3.2.5
- centos6安装redis3.2.5
- centos6 安装redis3
- Centos6.5安装redis3.0.7
- CentOS6.5安装redis3.2.1
- centos6.7安装redis3.2.3
- centos6下安装配置redis3
- centos6.5安装redis3.0.5问题
- centos6.5安装redis3.0集群
- CentOS6.5下redis3.2.1安装
- CentOS6.5安装Redis3.0稳定版
- centos6.5安装配置redis3.0
- CentOS6.5下redis3.2.8的安装
- 在centos6.4上安装redis3.0
- Centos6.5 linux下安装Redis3.2.9
- redis3.0 centos6.5 集群安装 遇到的问题
- centos6.5下Redis3.2.1安装和配置
- 1022. D进制的A+B (20)
- 【Codeforces Round #397】Codeforces 765F Souvenirs【解法二】
- 两个堆栈实现队列,两个队列实现堆栈
- java下载文件案例(带源码)
- 说说获取服务器的域名java
- CentOS6.8安装Redis3.2.5
- 正则表达式
- 人生定势:作息,学习习惯,能力技能
- 白话经典算法系列之二 直接插入排序的三种实现
- Python 用OPEN读文件报错 ,路径以及r
- 灰度变换--imadjust和stretchlim
- 世豪先生:精致是一种生活态度的体现
- Linux的多线程--初识
- 简单的文本处理命令