redis以及redis的php擴展一鍵安裝
阿新 • • 發佈:2018-10-12
load output dir tcp set dep export sta entos 說明:腳本記錄在此處只要是供自己部署環境使用
[root@VM_82_178_centos ~]# cat redis_redis-php.sh
#!/bin/bash /usr/bin/wget -P /tmp http://download.redis.io/releases/redis-3.2.12.tar.gz cd /tmp tar xf redis-3.2.12.tar.gz cd /tmp/redis-3.2.12 make MANIFESTO=jemalloc make PREFIX=/usr/local/redis install echo "export PATH=/usr/local/redis/bin:$PATH" >> /etc/profile source /etc/profile [ ! -d /usr/local/redis/conf ]&&mkdir /usr/local/redis/conf -p [ ! -d /data/redis ]&&mkdir /data/redis -p [ ! -d /usr/local/redis/log ]&&mkdir /usr/local/redis/log -p if [ -s /usr/local/redis/conf/redis.conf ]; then mv /usr/local/redis/conf/redis.conf /usr/local/redis/conf/redis.conf.`date +%Y%m%d%H%M%S`.bak cp /tmp/redis-3.2.12/redis.conf /usr/local/redis/conf/ fi >/usr/local/redis/conf/redis.conf cat << EOF > /usr/local/redis/conf/redis.conf bind 127.0.0.1 protected-mode yes port 10201 tcp-backlog 8192 timeout 300 tcp-keepalive 300 daemonize yes supervised no pidfile /var/run/redis_10201.pid loglevel warning logfile "/usr/local/redis/log/10201.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/ slaveof 192.168.1.10 102098 masterauth YHu222tuEq 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 min-slaves-to-write 6 min-slaves-max-lag 30 requirepass YHu222tuEq maxclients 100000 maxmemory 8g maxmemory-policy noeviction maxmemory-samples 5 #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 256 list-max-ziplist-size -2 list-compress-depth 0 set-max-intset-entries 512 zset-max-ziplist-entries 128 zset-max-ziplist-value 256 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 ###### echo 8192 >/proc/sys/net/core/somaxconn echo ‘vm.overcommit_memory = 1‘ >> /etc/sysctl.conf echo never > /sys/kernel/mm/transparent_hugepage/enabled echo ‘redis-server /usr/local/redis/conf/redis.conf ‘ >>/etc/rc.local echo ‘echo never > /sys/kernel/mm/transparent_hugepage/enabled‘ >>/etc/rc.local source /etc/profile redis-server /usr/local/redis/conf/redis.conf wget -P /tmp https://github.com/nicolasff/phpredis/archive/master.zip cd /tmp/ unzip master.zip && cd phpredis-master /usr/local/php/bin/phpize ./configure --with-php-config=/usr/local/php/bin/php-config make make install echo "extension = redis.so" >> /usr/local/php/etc/php.ini /usr/local/php/sbin/php-fpm -y /usr/local/php/etc/php-fpm.conf -t
redis以及redis的php擴展一鍵安裝