温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

redis部署

发布时间:2020-04-01 21:30:08 来源:网络 阅读:322 作者:limingyu0312 栏目:网络安全


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

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



至此,正常启动


向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI