동일한 노드에서 데이터 서비스를 재시작하기 위해 decide_restart_or_failover()에 의해 restart_service() 함수가 호출됩니다. 이 함수는 다음 논리를 실행합니다.
데이터 서비스가 여전히 PMF에 등록되어 있는지 확인합니다. 데이터 서비스가 여전히 등록되어 있는 경우 다음 작업을 수행합니다.
데이터 서비스의 Stop 메소드 이름과 Stop_timeout 값을 얻습니다.
hatimerun을 사용하여 데이터 서비스에 대한 Stop 메소드를 시작함으로써 Stop_timeout 값을 전달합니다.
데이터 서비스가 성공적으로 중지된 경우 데이터 서비스의 Start 메소드 이름과 Start_timeout 값을 얻습니다.
hatimerun을 사용하여 데이터 서비스에 대한 Start 메소드를 시작함으로써 Start_timeout 값을 전달합니다.
데이터 서비스가 더 이상 PMF에 등록되지 않은 경우 데이터 서비스가 PMF에서 허용되는 최대 재시도 횟수를 초과했다는 것을 의미합니다. 따라서 scha_control() 함수가 GIVEOVER 옵션과 함께 호출되어 데이터 서비스를 다른 노드로 페일오버합니다.
function restart_service
{
# To restart the data service, first verify that the
# data service itself is still registered under PMF.
pmfadm -q $PMF_TAG
if [[ $? -eq 0 ]]; then
# Since the TAG for the data service is still registered under
# PMF, first stop the data service and start it back up again.
# Obtain the Stop method name and the STOP_TIMEOUT value for
# this resource.
STOP_TIMEOUT=`scha_resource_get -O STOP_TIMEOUT \
-R $RESOURCE_NAME -G $RESOURCEGROUP_NAM?
STOP_METHOD=`scha_resource_get -O STOP \
-R $RESOURCE_NAME -G $RESOURCEGROUP_NAM?
hatimerun -t $STOP_TIMEOUT $RT_BASEDIR/$STOP_METHOD \
-R $RESOURCE_NAME -G $RESOURCEGROUP_NAME \
-T $RESOURCETYPE_NAME
if [[ $? -ne 0 ]]; then
logger-p ${SYSLOG_FACILITY}.err -t [$SYSLOG_TAG] \
“${ARGV0} Stop method failed.”
return 1
fi
# Obtain the START method name and the START_TIMEOUT value for
# this resource.
START_TIMEOUT=`scha_resource_get -O START_TIMEOUT \
-R $RESOURCE_NAME -G $RESOURCEGROUP_NAM?
START_METHOD=`scha_resource_get -O START \
-R $RESOURCE_NAME -G $RESOURCEGROUP_NAM?
hatimerun -t $START_TIMEOUT $RT_BASEDIR/$START_METHOD \
-R $RESOURCE_NAME -G $RESOURCEGROUP_NAME \
-T $RESOURCETYPE_NAME
if [[ $? -ne 0 ]]; then
logger-p ${SYSLOG_FACILITY}.err -t [$SYSLOG_TAG] \
“${ARGV0} Start method failed.”
return 1
fi
else
# The absence of the TAG for the dataservice
# implies that the data service has already
# exceeded the maximum retries allowed under PMF.
# Therefore, do not attempt to restart the
# data service again, but try to failover
# to another node in the cluster.
scha_control -O GIVEOVER -G $RESOURCEGROUP_NAME \
-R $RESOURCE_NAME
fi
return 0
}