redis安装-1

redis安装

cd /opt/tools/ #包目录
tar -xf redis-3.2.8.tar.gz
cd redis-3.2.8
make
#centos7安装   make MALLOC=libc && make PREFIX=/opt/redis install make PREFIX
=/opt/redis install cd /opt/redis mkdir -p {data/6379,logs} vim 6379.conf #内容如下 =================== daemonize yes
protected-mode no #3.2 后的新特性,禁止公网访问redis cache,加强redis安全的 pidfile
/var/run/redis_6379.pid port 6379 bind 0.0.0.0 timeout 0 tcp-keepalive 0 loglevel notice logfile /opt/redis/logs/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 /opt/redis/data/6379 appendonly no 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 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 ================ cd /opt/redis/bin/ vim redis-6379.sh #内容如下 ================ #!/bin/sh REDISPORT=6379 EXEC=/opt/redis/bin/redis-server CLIEXEC=/opt/redis/bin/redis-cli PIDFILE=/var/run/redis_${REDISPORT}.pid CONF="/opt/redis/${REDISPORT}.conf" case "$1" in start) if [ -f $PIDFILE ] then echo "$PIDFILE exists, process is already running or crashed" else echo "Starting Redis server..." $EXEC $CONF fi ;; stop) if [ ! -f $PIDFILE ] then echo "$PIDFILE does not exist, process is not running" else PID=$(cat $PIDFILE) echo "Stopping ..." $CLIEXEC -p $REDISPORT shutdown while [ -x /proc/${PID} ] do echo "Waiting for Redis to shutdown ..." sleep 1 done echo "Redis stopped" fi ;; *) echo "Please use start or stop as first argument" ;; esac =========================== chmod u+x redis-6379.sh #启动 /opt/redis/bin/redis-6379.sh start
原文地址:https://www.cnblogs.com/hanxiaohui/p/8778642.html