DSDL을 사용한 자원 유형 구현은 일반적으로 다음 작업을 담당하는 오류 모니터 데몬을 가집니다.
관리 중인 응용 프로그램의 상태를 정기적으로 모니터합니다. 모니터 데몬의 이 특정 측면은 응용 프로그램과 완전히 무관하며 자원 유형별로 크게 다를 수 있습니다. DSDL에는 간단한 TCP 기반 서비스에 대해 상태 검사를 수행하기 위한 몇 가지 유틸리티 기능이 기본으로 제공됩니다. HTTP, NNTP, IMAP 및 POP3 같은 ASCII 기반 프로토콜을 구현하는 응용 프로그램은 이러한 유틸리티를 사용하여 구현할 수 있습니다.
Retry_interval 및 Retry_count 자원 등록 정보를 사용하여 응용 프로그램에서 발생한 문제를 추적합니다. 응용 프로그램이 완전히 실패하면 PMF 작업 스크립트가 서비스를 다시 시작해야 하는지 또는 응용 프로그램 실패가 신속하게 누적되어 페일오버를 고려할 수 있는지 여부를 결정합니다. DSDL 유틸리티 scds_fm_action() 및 scds_fm_sleep()은 이 기법의 구현을 지원하기 위한 목적으로 사용됩니다.
적절한 작업(일반적으로 응용 프로그램을 다시 시작하거나 포함 자원 그룹의 페일오버 시도)을 수행합니다. DSDL 유틸리티 scds_fm_action()은 이러한 알고리즘을 구현합니다. 이 유틸리티는 이를 위해 경과한 Retry_interval (초)에서 현재까지 누적된 검사 실패를 계산합니다.
클러스터 관리 GUI 뿐만 아니라 scstat 명령에서 응용 프로그램 상태를 사용할 수 있도록 자원 상태를 업데이트합니다.
DSDL 유틸리티는 오류 모니터 데몬의 주 루프가 이 장의 끝에 나오는 의사 코드로 표시될 수 있도록 설계되었습니다.
DSDL을 사용하여 구현한 오류 모니터의 경우
PMF를 통한 프로세스 중지 알림이 동기식이므로 scds_fm_sleep()에 의한 응용 프로그램 프로세스 중지의 감지가 상당히 신속하게 이루어집니다. 이는 오류 모니터가 가끔씩 작동하여 서비스 상태를 검사하고 중지된 응용 프로그램을 찾는 경우와 대조를 이룹니다. 오류 감지 시간이 대폭 줄어들기 때문에 서비스의 가용성이 향상됩니다.
RGM이 scha_control(3HA) API를 통해 서비스를 페일오버하려는 시도를 거부할 경우 scds_fm_action()은 현재 오류 기록을 재설정(삭제)합니다. 이유는 실패 기록이 이미 Retry_count 이상이기 때문입니다. 모니터 데몬이 다음 반복에서 웨이크업하고 데몬의 상태 검사를 성공적으로 완료할 수 없는 경우 scha_control() 호출을 다시 시도합니다. 이 호출은 거부되며 따라서 마지막 반복에서 거부되는 상황이 여전히 유효합니다. 기록을 다시 설정하면 오류 모니터는 다음 반복 시에 최소한 현재 상황을 로컬로(예를 들어, 응용 프로그램 재시작을 통해) 수정하려고 시도합니다.
상황 자체가 수정되지 않을 경우 곧바로 scha_control()을 시도하는 것이 일반적이기 때문에 scds_fm_action()은 재시작 실패의 경우 응용 프로그램 실패 기록을 재설정하지 않습니다.
scds_fm_action() 유틸리티는 실패 기록에 따라 자원 상태를 SCHA_RSSTATUS_OK, SCHA_RSSTATUS_DEGRADED 또는 SCHA_RSSTATUS_FAULTED로 업데이트합니다. 따라서 이 상태를 클러스터 시스템 관리에 사용할 수 있습니다.
대부분의 경우 응용 프로그램 특정 상태 검사 작업은 별도의 독립 실행형 유틸리티(예: svc_probe())에서 구현되고 다음과 같은 일반적인 주 루프와 통합될 수 있습니다.
for (;;) { / * sleep for a duration of thorough_probe_interval between * successive probes. */ (void) scds_fm_sleep(scds_handle, scds_get_rs_thorough_probe_interval(scds_handle)); /* Now probe all ipaddress we use. Loop over * 1. All net resources we use. * 2. All ipaddresses in a given resource. * For each of the ipaddress that is probed, * compute the failure history. */ probe_result = 0; /* Iterate through the all resources to get each * IP address to use for calling svc_probe() */ for (ip = 0; ip < netaddr->num_netaddrs; ip++) { /* Grab the hostname and port on which the * health has to be monitored. */ hostname = netaddr->netaddrs[ip].hostname; port = netaddr->netaddrs[ip].port_proto.port; /* * HA-XFS supports only one port and * hence obtaint the port value from the * first entry in the array of ports. */ ht1 = gethrtime(); /* Latch probe start time */ probe_result = svc_probe(scds_handle, hostname, port, timeout); /* * Update service probe history, * take action if necessary. * Latch probe end time. */ ht2 = gethrtime(); /* Convert to milliseconds */ dt = (ulong_t)((ht2 - ht1) / 1e6); /* * Compute failure history and take * action if needed */ (void) scds_fm_action(scds_handle, probe_result, (long)dt); } /* Each net resource */ } /* Keep probing forever */ |