欢迎来到天天文库
浏览记录
ID:38233095
大小:503.51 KB
页数:18页
时间:2019-06-07
《redis+keepalived配置文档(改)》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、Redis+keepalived配置文档一.环境部署介绍介绍:为了其保证redis缓存服务的稳定,将做一个redis+keepalived双机主备,并具备高可用性(HA)环境:现在已有一台服务器上搭建有redis服务,做为redis主,将准备另一台服务器部署redis,作为从,在通过keepalived软件实现在主机redis服务宕掉后,自动切换到从机redis,并且redis角色成为主,可以存入和读取数据。而当主机恢复后,主机redis会马上抢夺回redis主的角色,而从机又会还原,并且主机会同步回从机存入的数据,达到数据同步,实现其高可用性二.使用相关环境及软件系统:redhat
2、EnterpriseLinux6.3主机:10.224.70.33从机:10.224.70.18虚拟IP:10.224.70.100keepalived-1.2.7redis-2.6.17一.安装软件1、 以root用户登录,cd/usr/local2、命令:mkdirms40 新建ms40目录3、cdms404、mkdirredis&&cdredis&&mkdirlog&&mkdirdata 然后切回ms40目录5、mkdirkeepalived6、上传文件redis-2.6.17.tar.gz至redis目录上传文件keepalived-1.2.7.tar.gz至keepa
3、lived目录7、安装redis1)cdredis2)tarzxvfredis-2.6.17.tar.gz3)cd redis-2.6.174)make5)cdsrc6)cpredis-benchmarkredis-cliredis-server/usr/bin/7)切回至ms40目录8、安装keepalived1)cdkeepalived2)tarzxvfkeepalived-1.2.7.tar.gz#解压安装包3)yuminstallpopt-devel4)yum-yinstallopenssl-devel5)cdkeepalived-1.2.76)./configure7)ma
4、ke&&makeinstall9 转移keepalived的配置文件1)cp/usr/local/etc/rc.d/init.d/keepalived/etc/rc.d/init.d/#用于keepalived服务点的启动2)cp/usr/local/etc/sysconfig/keepalived/etc/sysconfig/#这个是用于查看keepalived相关的帮助文档,如keepalived–help或者mankeepalived3) mkdir/etc/keepalived4) cp/usr/local/etc/keepalived/keepalived.conf/
5、etc/keepalived/#将keepalived配置文件做备份5) cp/usr/local/sbin/keepalived/usr/sbin/二.配置过程主机:1.配置redismkdir/etc/rediscp/usr/local/ms40/redis/redis-2.6.17/redis.conf/etc/redis#复制一份配置文档做为主配置文档vim/etc/redis.conf#编辑redis配置文档需要修改的配置如下daemonizeyes#开启redis守护进程pidfile/var/run/redis.pid#redis守护进程的pid存放位置logfile
6、"/var/log/keepalived-redis-state.log"#指定日志路径dbfilenamedump.rdb#指定快照文件名dir/var/lib/redis#指定快照文件存储路径masterauth123456#主库认证密码requirepass123456#客户端连接密码1.配置keepalivedmkdir/etc/keepalivedcp/usr/local/ms40/keepalived/keepalived-2.6.17/keepalived.conf/etc/keepalived#复制一份配置文档做为主配置文档vim/etc/keepalived/kee
7、palived.conf#配置keepalived配置文件配置内容如下:vrrp_scriptchk_redis{script"/etc/keepalived/scripts/redis_check.sh"#执行检查脚本interval2#监控时间间隔}vrrp_instanceVI_1{stateMASTER#keepalived主机角色interfaceeth0#监听网卡端口virtual_router_id52#keepalived内的虚拟路由idp
此文档下载收益归作者所有