设置mysql acquisition_MYSQL 7*24 高可用环境的部署
配置好MM和HEARTBEAT后。主机启动heartbeat
1、trazilla:/etc/ha.d# /etc/init.d/heartbeat start
Starting High-Availability services:
Done.
trazilla:/etc/ha.d#
---------------message
2、trazilla:~# tail -f /var/log/messages | grep heartbeat
Aug 5 11:01:31 trazilla heartbeat[16574]: info: **************************
Aug 5 11:01:31 trazilla heartbeat[16574]: info: Configuration validated. Starting heartbeat 1.2.5
Aug 5 11:01:31 trazilla heartbeat[16575]: info: heartbeat: version 1.2.5
Aug 5 11:01:32 trazilla heartbeat[16575]: info: Heartbeat generation: 51
Aug 5 11:01:32 trazilla heartbeat[16575]: info: UDP Broadcast heartbeat started on port 694 (694) interface eth1
Aug 5 11:01:32 trazilla heartbeat[16575]: info: ping heartbeat started.
Aug 5 11:01:32 trazilla heartbeat[16575]: info: pid 16575 locked in memory.
Aug 5 11:01:32 trazilla heartbeat[16575]: info: Local status now set to: 'up'
Aug 5 11:01:33 trazilla heartbeat[16578]: info: pid 16578 locked in memory.
Aug 5 11:01:33 trazilla heartbeat[16579]: info: pid 16579 locked in memory.
Aug 5 11:01:33 trazilla heartbeat[16580]: info: pid 16580 locked in memory.
Aug 5 11:01:33 trazilla heartbeat[16575]: info: Link trazilla:eth1 up.
Aug 5 11:01:33 trazilla heartbeat[16581]: info: pid 16581 locked in memory.
Aug 5 11:01:33 trazilla heartbeat[16582]: info: pid 16582 locked in memory.
Aug 5 11:01:33 trazilla heartbeat[16575]: info: Link 192.168.1.1:192.168.1.1 up.
Aug 5 11:01:33 trazilla heartbeat[16575]: info: Status update for node 192.168.1.1: status ping
备用机启动heartbeat
3、debian:/# /etc/init.d/heartbeat start
Starting High-Availability services:
2009/08/05_11:02:53 INFO: Resource is stopped
Done.
debian:/#
4、-------------------------message
Aug 5 11:02:53 debian heartbeat: [5813]: info: Configuration validated. Starting heartbeat 2.1.3
Aug 5 11:02:53 debian heartbeat: [5814]: info: heartbeat: version 2.1.3
Aug 5 11:02:53 debian heartbeat: [5814]: info: Heartbeat generation: 1249022562
Aug 5 11:02:53 debian heartbeat: [5814]: info: glib: UDP Broadcast heartbeat started on port 694 (694) interface eth1
Aug 5 11:02:53 debian heartbeat: [5814]: info: glib: UDP Broadcast heartbeat closed on port 694 interface eth1 - Status: 1
Aug 5 11:02:53 debian heartbeat: [5814]: info: glib: ping heartbeat started.
Aug 5 11:02:53 debian heartbeat: [5814]: info: G_main_add_TriggerHandler: Added signal manual handler
Aug 5 11:02:53 debian heartbeat: [5814]: info: G_main_add_TriggerHandler: Added signal manual handler
Aug 5 11:02:53 debian heartbeat: [5814]: info: G_main_add_SignalHandler: Added signal handler for signal 17
Aug 5 11:02:53 debian heartbeat: [5814]: info: Local status now set to: 'up'
Aug 5 11:02:54 debian heartbeat: [5814]: info: Link 192.168.1.1:192.168.1.1 up.
Aug 5 11:02:54 debian heartbeat: [5814]: info: Status update for node 192.168.1.1: status ping
Aug 5 11:02:54 debian heartbeat: [5814]: info: Link debian:eth1 up.
Aug 5 11:02:55 debian heartbeat: [5814]: info: Link trazilla:eth1 up.
Aug 5 11:02:55 debian heartbeat: [5814]: info: flow control disabled due to different version heartbeat
Aug 5 11:02:55 debian heartbeat: [5814]: info: Status update for node trazilla: status active
Aug 5 11:02:55 debian heartbeat: [5814]: info: Comm_now_up(): updating status to active
Aug 5 11:02:55 debian heartbeat: [5814]: info: Local status now set to: 'active'
Aug 5 11:02:55 debian heartbeat: [5814]: info: remote resource transition completed.
Aug 5 11:02:55 debian heartbeat: [5814]: info: remote resource transition completed.
Aug 5 11:02:55 debian heartbeat: [5814]: info: Local Resource acquisition completed. (none)
Aug 5 11:02:56 debian heartbeat: [5814]: info: trazilla wants to go standby [foreign]
Aug 5 11:02:56 debian heartbeat: [5814]: info: standby: acquire [foreign] resources from trazilla
Aug 5 11:02:56 debian heartbeat: [5839]: info: acquire local HA resources (standby).
Aug 5 11:02:56 debian heartbeat: [5839]: info: local HA resource acquisition completed (standby).
Aug 5 11:02:56 debian heartbeat: [5814]: info: Standby resource acquisition done [foreign].
Aug 5 11:02:56 debian heartbeat: [5814]: info: Initial resource acquisition complete (auto_failback)
Aug 5 11:02:57 debian heartbeat: [5814]: info: remote resource transition completed.
192.168.1.66为浮动IP,这里显示资源服务mysqld已经启动起来了,trazilla为主机名
5、trazilla:/etc/ha.d# ifconfig eth0:0
eth0:0 Link encap:Ethernet HWaddr 00:1A:A0:36:60:7A
inet addr:192.168.1.66 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:177
trazilla:/etc/ha.d#
如果这时候手动停止主机的mysqld,备用机监控不到主机的服务停止了。按资料上面heartbeat是会监控主机的资源服务的,如果down掉,自动接管过来,启动资源服务,分配IP。
实际测试却没有。而只有当主机或者heartbeat停止才会接管过来。
这是怎么回事呢?
在网上查了一下资料。原来Heartbeat目前不监视它启动的资源,查看它们是否正在运行,健康状态如何,以及客户端计算机是否能够抵达。
资料上提到采用mon来进行资源的监控,但似乎并不能达到实现资源服务的自动接管。
最后在局域网内测试成功。
资源服务的健康情况监控写脚本完成。部署到主服务器上,
如果检测到资源服务停止,那么停止主服务器上的heartbeat服务,这样备用服务器就能接管过来了。
附脚本。
trazilla:/home/scripts# cat chkmysqlservice.sh
#/bin/bash
logfile="/home/scripts/chk.log"
pgrep="/usr/bin/pgrep"
stop_heartbeat="/etc/init.d/heartbeat stop"
# mysql daemon name
mysql_service="mysqld"
# find mysql pid
$pgrep ${mysql_service}
echo "-------------------------------------------" >> $logfile
echo $(date +"%y-%m-%d %H:%M:%S") >> $logfile
echo "--------------------------" >> $logfile
#if mysql is not running
if [ $? -ne 0 ];then
$stop_heartbeat
echo "heartbeat stop success" >> $logfile
else
echo "mysqld is already running ">>$logfile
fi
trazilla:/home/scripts#
设置mysql acquisition_MYSQL 7*24 高可用环境的部署相关推荐
- mysql+keepalived搭建高可用环境
假设已经搭建好了mysql并且存在正常状态的主主复制 1.安装keepalived并且根据业务的vip及主机网卡,ip配置好/etc/keepalived/keepalived.conf,具体操作已在 ...
- mysql 集群切换_完美起航-MySQLMHA高可用集群部署及故障切换(图文详解)
MySQL MHA 一.MHA概念 MHA(MasterHigh Availability)是一套优秀的MySQL高可用环境下故障切换和主从复制的软件. MHA 的出现就是解决MySQL 单点的问题. ...
- MySQL(10)数据库实现高可用架构之MHA
文章目录 一.MySQL MHA介绍 1.1 什么是 MHA? 1.2 MHA 的组成 1) MHA Node(数据节点) 2) MHA Manager(管理节点) 1.3 MHA 的特点 二.MyS ...
- Mysql数据库(十一)——MHA高可用集群部署及故障切换
Mysql数据库(十一)--MHA高可用集群部署及故障切换 一.MHA概述 二.MHA的组成 三.MHA的特点 四.案例环境 1.服务器配置 2.思路 3.关闭防火墙和安全机制,并进行主从配置 4.配 ...
- 基于heartbeat v1配置mysql和httpd的高可用双主模型
一.配置高可用集群的前提:(以两节点的heartbeat为例) ⑴时间必须保持同步 ⑵节点之间必须用名称互相通信 建议使用/etc/hosts,而不要用DNS 集群中使用的主机名为`uname -n` ...
- 《MySQL性能优化和高可用架构实践》阅读总结
文章目录 介绍 第1章 MySQL架构介绍 1.1 MySQL简介 1.2 MySQL主流的分支版本 1.3 MySQL存储引擎 1.4 MySQL逻辑架构 1.5 MySQL物理文件体系结构 第2章 ...
- 构建Oracle高可用环境HA rac:企业级高可用数据库架构、实战与经验总结
1.1 理解Oracle数据库 1.2 Oracle高可用特性(High Availability) 1.3 搭建高可用的周边辅助环境 1.4 高可用应用设计 1.5 高可用数据库设计 1. ...
- MHA+keepalive高可用环境搭建
MHA+keepalive高可用环境搭建 2017年02月17日 14:05:57 阅读数:2582 MHA(Master HighAvailability)目前在MySQL高可用方面是一个相对成熟的 ...
- MySQL MHA高可用集群部署及故障切换(图文详解)
文章目录 MySQL MHA 一.MHA概念 1.MHA 的组成 2.MHA 的特点 二.搭建MySQL+MHA 实验思路 实验环境.安装包 1.所有服务器,关闭系统防火墙和安全机制 2.修改 mas ...
最新文章
- 破除SCI至上!评价 AI 科研成果,需要新思路【附报告下载】
- ACS AAA Tacacs+
- 最详细的phpmailer的使用方法
- Android--解析XML之SAX
- boundingRect函数
- JAVA 解析xml字符串
- Springboot+MyBatis-plus+postgresSQL 的整合
- IntelliJ IDEA最常用的一些快捷键,学会了室友还以为你在祖安对线
- 啥?不用安装Jre,SpringBoot项目也可以打包exe应用程序运行!
- 下载 LINUX 和 windows 版本下 MySQL5.7.32
- itextpdf 简介
- Deep Ordinal Regression Network for Monocular Depth Estimation
- python字符串中常见的内置方法
- 【已开源】Flutter 穿山甲广告插件的集成-FlutterAds
- 子平真诠释疑笔记(四)
- Java 12 来了,我们应该采用嘛?
- Centos8.5无法用yum安装screen,iftop,nethogs等的解决办法
- 为知所见即所得MarkDown插件
- 计算机中丢失ubiorbitapi,我的刺客信条出现无法启动此程序,因为计算机中丢失ubiorbitapi_r2_loader.dll,,怎么处理。。...
- 【bzoj3573】[Hnoi2014]米特运输