一、环境介绍
Redis—master 172.18.8.19
Redis—slave 172.18.8.20
二、redis主的配置
#创建redis数据目录 mkdir -p /data0/redis_trade #redis主配置文件 root># cat redis_6379.conf |grep -Ev "^$|^#" bind 172.18.8.19 protected-mode yes port 6379 tcp-backlog 511 timeout 0 tcp-keepalive 300 daemonize yes supervised no pidfile /var/run/redis_6379.pid 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 /data0/redis_trade 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 Allwelltokok 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-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 rename-command FLUSHALL ZYzv6FOBdwflW2nX rename-command EVAL S9UHPKEpSvUJMM rename-command FLUSHDB D60FPVDJuip7gy6l 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
三、redis从配置
root># cat redis_6379.conf |grep -Ev "^$|^#" bind 172.18.8.20 protected-mode yes port 6379 tcp-backlog 511 timeout 0 tcp-keepalive 300 daemonize yes supervised no pidfile /var/run/redis_6379.pid 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 /data0/redis_trade slaveof 172.18.8.19 6379 -----从库比主库多这2行配置参数 masterauth Allwelltokok -----从库比主库多这2行配置参数 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 Allwelltokok 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-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 rename-command FLUSHALL ZYzv6FOBdwflW2nX rename-command EVAL S9UHPKEpSvUJMM rename-command FLUSHDB D60FPVDJuip7gy6l 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
四、redis启动脚本
root># cat /etc/init.d/redis_6379 #!/bin/sh # # Simple Redis init.d script conceived to work on Linux systems # as it does use of the /proc filesystem. # chkconfig: 2345 90 10 source /etc/init.d/functions REDISPORT=6379 EXEC=/usr/local/bin/redis-server CLIEXEC=/usr/local/bin/redis-cli PIDFILE=/var/run/redis_${REDISPORT}.pid CONF="/usr/local/redis/etc/redis_${REDISPORT}.conf" AUTH="Allwelltokok" BIND_IP='172.18.8.19' start(){ if [ -f $PIDFILE ] then echo "$PIDFILE exists, process is already running or crashed" else echo "Starting Redis server..." $EXEC $CONF fi if [ "$"="0" ] then echo "Redis is running..." fi } stop(){ if [ ! -f $PIDFILE ] then echo "$PIDFILE does not exist, process is not running" else PID=$(cat $PIDFILE) echo "Stopping ..." $CLIEXEC -h $BIND_IP -a $AUTH -p $REDISPORT SHUTDOWN sleep 1 while [ -x /proc/${PID} ] do echo "Waiting for Redis to shutdown ..." sleep 1 done echo "Redis stopped" fi } restart(){ stop start } status(){ ps -ef|grep redis-server|grep -v grep >/dev/null 2>&1 if [ $"redis server is running" else echo "redis server is stopped" fi } case "$1" in start) start ;; stop) stop ;; restart) restart ;; status) status ;; *) echo "Usage: /etc/init.d/redis {start|stop|status|start}" >&2 exit 1 esac
五、启动服务
root># /etc/init.d/redis_6379 start
查看日志
root># tail -100f /var/log/redis_6379.log 5563:S 29 Jun 22:14:23.236 * Increased maximum number of open files to 10032 (it was originally set to 1024). _._ _.-``__ ''-._ _.-`` `. `_. ''-._ Redis 3.2.12 (00000000/0) 64 bit .-`` .-```. ```\/ _.,_ ''-._ ( ' , .-` | `, ) Running in standalone mode |`-._`-...-` __...-.``-._|'` _.-'| Port: 6379 | `-._ `._ / _.-' | PID: 5563 `-._ `-._ `-./ _.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | http://redis.io `-._ `-._`-.__.-'_.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | `-._ `-._`-.__.-'_.-' _.-' `-._ `-.__.-' _.-' `-._ _.-' `-.__.-' 5563:S 29 Jun 22:14:23.237 # Server started, Redis version 3.2.12 5563:S 29 Jun 22:14:23.237 * The server is now ready to accept connections on port 6379 5563:S 29 Jun 22:14:23.237 * Connecting to MASTER 172.18.8.19:6379 5563:S 29 Jun 22:14:23.237 * MASTER <-> SLAVE sync started 5563:S 29 Jun 22:14:23.237 * Non blocking connect for SYNC fired the event. 5563:S 29 Jun 22:14:23.238 * Master replied to PING, replication can continue... 5563:S 29 Jun 22:14:23.238 * Partial resynchronization not possible (no cached master) 5563:S 29 Jun 22:14:23.239 * Full resync from master: c9f303069f87253011bf39369366732a2e88b389:1 5563:S 29 Jun 22:14:23.304 * MASTER <-> SLAVE sync: receiving 77 bytes from master 5563:S 29 Jun 22:14:23.305 * MASTER <-> SLAVE sync: Flushing old data 5563:S 29 Jun 22:14:23.305 * MASTER <-> SLAVE sync: Loading DB in memory 5563:S 29 Jun 22:14:23.305 * MASTER <-> SLAVE sync: Finished with success 5563:S 29 Jun 22:14:23.305 * Background append only file rewriting started by pid 5567 5563:S 29 Jun 22:14:23.329 * AOF rewrite child asks to stop sending diffs. 5567:C 29 Jun 22:14:23.329 * Parent agreed to stop sending diffs. Finalizing AOF... 5567:C 29 Jun 22:14:23.329 * Concatenating 0.00 MB of AOF diff received from parent. 5567:C 29 Jun 22:14:23.329 * SYNC append only file rewrite performed 5567:C 29 Jun 22:14:23.330 * AOF rewrite: 0 MB of memory used by copy-on-write 5563:S 29 Jun 22:14:23.337 * Background AOF rewrite terminated with success 5563:S 29 Jun 22:14:23.337 * Residual parent diff successfully flushed to the rewritten AOF (0.00 MB) 5563:S 29 Jun 22:14:23.337 * Background AOF rewrite finished successfully
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
金钱帮资源网 Copyright www.kbjia.com
暂无“Centos7 Redis主从搭建配置的实现”评论...
《魔兽世界》大逃杀!60人新游玩模式《强袭风暴》3月21日上线
暴雪近日发布了《魔兽世界》10.2.6 更新内容,新游玩模式《强袭风暴》即将于3月21 日在亚服上线,届时玩家将前往阿拉希高地展开一场 60 人大逃杀对战。
艾泽拉斯的冒险者已经征服了艾泽拉斯的大地及遥远的彼岸。他们在对抗世界上最致命的敌人时展现出过人的手腕,并且成功阻止终结宇宙等级的威胁。当他们在为即将于《魔兽世界》资料片《地心之战》中来袭的萨拉塔斯势力做战斗准备时,他们还需要在熟悉的阿拉希高地面对一个全新的敌人──那就是彼此。在《巨龙崛起》10.2.6 更新的《强袭风暴》中,玩家将会进入一个全新的海盗主题大逃杀式限时活动,其中包含极高的风险和史诗级的奖励。
《强袭风暴》不是普通的战场,作为一个独立于主游戏之外的活动,玩家可以用大逃杀的风格来体验《魔兽世界》,不分职业、不分装备(除了你在赛局中捡到的),光是技巧和战略的强弱之分就能决定出谁才是能坚持到最后的赢家。本次活动将会开放单人和双人模式,玩家在加入海盗主题的预赛大厅区域前,可以从强袭风暴角色画面新增好友。游玩游戏将可以累计名望轨迹,《巨龙崛起》和《魔兽世界:巫妖王之怒 经典版》的玩家都可以获得奖励。
更新日志
2024年12月22日
2024年12月22日
- 小骆驼-《草原狼2(蓝光CD)》[原抓WAV+CUE]
- 群星《欢迎来到我身边 电影原声专辑》[320K/MP3][105.02MB]
- 群星《欢迎来到我身边 电影原声专辑》[FLAC/分轨][480.9MB]
- 雷婷《梦里蓝天HQⅡ》 2023头版限量编号低速原抓[WAV+CUE][463M]
- 群星《2024好听新歌42》AI调整音效【WAV分轨】
- 王思雨-《思念陪着鸿雁飞》WAV
- 王思雨《喜马拉雅HQ》头版限量编号[WAV+CUE]
- 李健《无时无刻》[WAV+CUE][590M]
- 陈奕迅《酝酿》[WAV分轨][502M]
- 卓依婷《化蝶》2CD[WAV+CUE][1.1G]
- 群星《吉他王(黑胶CD)》[WAV+CUE]
- 齐秦《穿乐(穿越)》[WAV+CUE]
- 发烧珍品《数位CD音响测试-动向效果(九)》【WAV+CUE】
- 邝美云《邝美云精装歌集》[DSF][1.6G]
- 吕方《爱一回伤一回》[WAV+CUE][454M]