redis3.2.10单实例安装测试
主要是实际使用环境中使用,为了方便快速部署,特意记录如下:
# root用户 yum -y install make gcc-c++ cmake bison-devel ncurses-devel readline-devel libaio-devel perl libaio wget lrzsz vim mkdir -p /data useradd -d /data/redis -m redis mkdir -p /data/redis/application chown -R redis.redis /data/redis/* # 切换到redis用户 su - redis cd application/ # 上传安装包 wget http://download.redis.io/releases/redis-3.2.10.tar.gz
tar -zxvf redis-3.2.10.tar.gz
cd redis-3.2.10 make make PREFIX=/data/redis/application/redis_3.2.10 install mkdir -p /usr/local/redis/etc/ cp redis.conf /usr/local/redis/etc/ cd /usr/local/redis/bin/ cp redis-benchmark redis-cli redis-server /usr/bin/ mkdir -p /data/redis/redis/data mkdir -p /data/redis/redis/run mkdir -p /data/redis/redis/etc # 切换到root执行,这一步可选 cat >> /etc/sysctl.conf<<"EOF" vm.overcommit_memory = 1 net.core.somaxconn= 1024 EOF sysctl -p echo never > /sys/kernel/mm/transparent_hugepage/enabled cat >>/etc/rc.local <<"EOF" echo never > /sys/kernel/mm/transparent_hugepage/enabled EOF ln -s /data/redis/application/redis_3.2.10/bin/* /usr/bin/ # redis用户执行 cat >/data/redis/redis/etc/redis.6379.conf <<"EOF" # requirepass mypasswd protected-mode no port 6379 tcp-backlog 511 timeout 0 tcp-keepalive 300 daemonize yes supervised no pidfile /data/redis/redis/run/redis_6379.pid loglevel debug logfile "/data/redis/redis/run/redis_6379.log" databases 16 save 900 1 save 300 10 save 60 10000 stop-writes-on-bgsave-error yes rdbcompression yes rdbchecksum yes dbfilename dump.rdb dir /data/redis/redis/data slave-serve-stale-data yes slave-read-only yes repl-diskless-sync no repl-diskless-sync-delay 5 repl-disable-tcp-nodelay no slave-priority 100 appendonly yes appendfilename "appendonly.aof" appendfsync everysec no-appendfsync-on-rewrite no auto-aof-rewrite-percentage 100 auto-aof-rewrite-min-size 64mb aof-load-truncated yes lua-time-limit 5000 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-size -2 list-compress-depth 0 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 EOF # 启动redis /data/redis/application/redis_3.2.10/bin/redis-server /data/redis/redis/etc/redis.6379.conf &