用kill(pid,0) >= 0 || errno != ESRCH 可以判断是不是存在个process
init_procinfo--用来保存一个全系统的变量(进程之间用)
可以定义一些宏,然后让这些宏由configure指定,就可以定义出程序要用的文件的信息!
#ifndef HA_PLUGIN_D
#define HA_PLUGIN_DHALIB "/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停止,就可以换了