redis部署

########################下载及安装#################################

创新互联公司不只是一家网站建设的网络公司;我们对营销、技术、服务都有自己独特见解,公司采取“创意+综合+营销”一体化的方式为您提供更专业的服务!我们经历的每一步也许不一定是最完美的,但每一步都有值得深思的意义。我们珍视每一份信任,关注我们的成都网站建设、做网站质量和服务品质,在得到用户满意的同时,也能得到同行业的专业认可,能够为行业创新发展助力。未来将继续专注于技术创新,服务升级,满足企业一站式营销型网站需求,让再小的品牌网站制作也能产生价值!

cd /usr/local/src

wget http://download.redis.io/releases/redis-3.0.7.tar.gz

tar zxf redis-3.0.7.tar.gz

cd redis-3.0.7

make PREFIX=/usr/local/redis MALLOC=libc install

#####################拷贝启动脚本#################################

cd utils/

ls

cp redis_init_script /etc/init.d/redis

vim /etc/init.d/redis

EXEC=/usr/local/redis/bin/redis-server

CLIEXEC=/usr/local/redis/bin/redis-cli

保存退出

chmod 755 /etc/init.d/redis

#################配置文件#######################################

mkdir /etc/redis

cp redis.conf /etc/redis/

cd /etc/redis

ll

cp redis.conf 6379.conf

vim 6379.conf  //修改配置文件,以下都是我过滤出来的,可以根据你自己要求更改

daemonize yes

pidfile /var/run/redis_6379.pid

port 6379

tcp-backlog 511

bind 192.168.141.188

timeout 0

tcp-keepalive 0

loglevel notice

logfile "/var/log/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_6379.rdb

dir /var/lib/redis_6379

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

requirepass candy //密码生产必备

appendonly yes

appendfilename "appendonly_6379.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-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

echo 512 > /proc/sys/net/core/somaxconn

mkdir -p /var/lib/redis_6379

#######################启动#############################

/etc/init.d/redis start

less /var/log/redis_6379.log

sysctl vm.overcommit_memory=1 

echo never > /sys/kernel/mm/transparent_hugepage/enabled

######################更改启动脚本#####################

vim /etc/init.d/redis

stop)

        if [ ! -f $PIDFILE ]

        then

                echo "$PIDFILE does not exist, process is not running"

        else

                PID=$(cat $PIDFILE)

                echo "Stopping ..."

                $CLIEXEC -h 192.168.141.188 -p $REDISPORT -a candy shutdown

                while [ -x /proc/${PID} ]

保存退出

/etc/init.d/redis stop

/etc/init.d/redis start

tail -f /var/log/redis_6379.log

2598:M 05 Apr 13:54:47.382 # Server started, Redis version 3.0.7

2598:M 05 Apr 13:54:47.382 * DB loaded from disk: 0.000 seconds

2598:M 05 Apr 13:54:47.382 * The server is now ready to accept connections on port 6379

至此,正常启动


名称栏目:redis部署
标题来源:http://myzitong.com/article/ghiipc.html