Redis一键编译安装脚本

#!/bin/sh
pwd
mkdir /data
cd /data
wget -c 
yum -y install gcc gcc-c++ make autoconf mlocate lsof rsync
tar zxvf redis-2.8.9.tar.gz
cd redis-2.8.9
make & make install
mkdir pids
mkdir logs
cp utils/redis_init_script /etc/init.d/redis_6379
cp redis.conf /etc/redis/6379.conf
mkdir /data/nosql/redis/6379 -p
mkdir /etc/redis
cat > /etc/redis/6379.conf <<EOF
daemonize yes
logfile /data/redis-2.8.9/logs/redis_6379.log
pidfile /data/redis-2.8.9/pids/redis_6379.pid
port 6379
bind 0.0.0.0
timeout 0
tcp-keepalive 0
loglevel notice
databases 16
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
#dbfilename dump_6379.rdb
dir /data/nosql/redis/6379
#maxmemory      2000000000
#slave-serve-stale-data yes
#slave-read-only yes
repl-disable-tcp-nodelay no
slave-priority 100
appendonly no
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
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
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
EOF
/etc/init.d/redis_6379 start

注意:

wget地址,大家可以从官网下载

bind填写服务器实际内网地址

你可能感兴趣的:(redis,安装脚本,一键编译)