HeartBeat源代码学习

HeartBeat源代码学习

 

用kill(pid,0) >= 0 || errno != ESRCH 可以判断是不是存在个process

init_procinfo--用来保存一个全系统的变量(进程之间用)

可以定义一些宏,然后让这些宏由configure指定,就可以定义出程序要用的文件的信息!
#ifndef HA_PLUGIN_D
#define HA_PLUGIN_D	HALIB "/plugins"
#endif

plugin的处理,用plis lib
	plis lib的使用
		Provides a general plugin and interface loading library
		/usr/lib/pils/plugins/InterfaceMgr/generic.so
		InterfaceMgr/generic.c--用来定义load interface。。。???

可以连续的杀进程
		if (CL_KILL((pid_t)running_hb_pid, SIGTERM) >= 0) {
			/* Wait for the running heartbeat to die */
			alarm(0);
			do {
				sleep(1);
				continue;
			}while (CL_KILL((pid_t)running_hb_pid, 0) >= 0);
			cleanexit(LSB_EXIT_OK);
		}

init_config???

initialize_heartbeat
	创建fifo register fifo
	    pipe status_pipe
	Open all our heartbeat channels(???)--建立与一些so的通讯path
		hb_media
	write_child
	read_child
		Reads hb channel (tty, UDP, etc)
		copying to master status pipe
 		For ttys ONLY:
			copying to tty write pipes (incrementing hop count and
				filtering out "ring wraparounds")

	master_status_process
	用来记录child的信息(serial,udp。。。)
		clustermsg_input_dispatch
			process_clustermsg--Process a message coming in from our status FIFO(从Control process或者child)
		APIregistration_input_dispatch
			process_registermsg
		hb_send_local_status
			send_local_status
		hb_dump_all_proc_stats
		api_audit_clients
		Gmain_hb_signal_process_pending
			hb_signal_process_pending

		Master Status process:
	 		Reads master status pipe(从Control process)
			forks children, etc. to deal with status changes
	control_process
		Control process:
			Reads a control fifo for input
 			Writes master status pipe
 			Writes heartbeat channel pipes

hb_rsc_recover_dead_resources
	--Node 'hip' has died.  	
	  Take over its resources (if any)
	  This may mean we have to STONITH them.

tips:
	可以在加参数-d来增加调试

heartbeat是用来保证集群调度器的死活
mon是用来保证后面的东西的死活

Heartbeat runs on both machines, but Apache and Mon is only running on the active one

mon的alert把heartbeat停止,就可以换了
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值