Sun Cluster 数据服务开发者指南(适用于 Solaris OS)

定义资源类型注册文件

本实例中的资源类型注册 (RTR) 文件中定义了 DNS 资源类型的静态配置。该类型的资源继承 RTR 文件中定义的属性。

资源组管理器 (RGM) 在群集管理员注册 HA-DNS 数据服务时读取 RTR 文件中的信息。

RTR 文件概述

RTR 文件采用定义好的格式。在文件中将依次定义资源类型属性、系统定义的资源属性和扩展属性。有关更多信息,请参见 rt_reg(4) 手册页和设置资源和资源类型属性

以下各节介绍了样例 RTR 文件中的特定属性。其中列出了该文件的不同部分。有关样例 RTR 文件内容的完整列表,请参见资源类型注册文件列表

RTR 文件样例中的资源类型属性

RTR 文件样例的开头部分是注释,其后跟有用来定义 HA-DNS 配置的资源类型属性,如下所示。


注 –

资源组、资源和资源类型的属性名称区分大小写。在指定属性名称时,您可以使用大小写字母的任意组合。


#
# Copyright (c) 1998-2005 by Sun Microsystems, Inc.
# All rights reserved.
#
# Registration information for Domain Name Service (DNS)
#

#pragma ident   “@(#)SUNW.sample   1.1   00/05/24 SMI”

Resource_type = “sample”;
Vendor_id = SUNW;
RT_description = “Domain Name Service on Sun Cluster”;

RT_version =”1.0”; 
API_version = 2;    
Failover = TRUE;

RT_basedir=/opt/SUNWsample/bin;
Pkglist = SUNWsample;

Start         =   dns_svc_start;
Stop          =   dns_svc_stop;

Validate      =   dns_validate;
Update        =   dns_update;

Monitor_start =   dns_monitor_start;
Monitor_stop  =   dns_monitor_stop;
Monitor_check =   dns_monitor_check;

提示 –

您必须将 Resource_type 属性声明为 RTR 文件中的第一项。否则,资源类型注册将失败。


以下信息介绍了这些属性:

在此 RTR 文件中没有指定的资源类型属性(例如 Single_instanceInit_nodesInstalled_nodes 被设置为其默认值。资源类型属性包含资源类型属性(包括其默认值)的完整列表。

群集管理员不能更改 RTR 文件中资源类型属性的值。

RTR 文件样例中的资源属性

根据约定,在 RTR 文件中的资源类型属性之后声明资源属性。资源属性包括由 Sun Cluster 软件提供的系统定义的属性以及您定义的扩展属性。您可以为每一种类型指定许多属性的属性,它们由 Sun Cluster 软件提供,例如最小值、最大值和默认值。

RTR 文件中的系统定义的属性

以下列表显示了某个样例 RTR 文件中系统定义的属性。

# A list of bracketed resource property declarations follows the
# resource type declarations. The property-name declaration must be
# the first attribute after the open curly bracket of each entry.

# The <method>_timeout properties set the value in seconds after which
# the RGM concludes invocation of the method has failed.

# The MIN value for all method timeouts is set to 60 seconds. This
# prevents administrators from setting shorter timeouts, which do not
# improve switchover/failover performance, and can lead to undesired
# RGM actions (false failovers, node reboot, or moving the resource group
# to ERROR_STOP_FAILED state, requiring operator intervention). Setting
# too-short method timeouts leads to a *decrease* in overall availability
# of the data service.
{  
   PROPERTY = Start_timeout; 
   MIN=60; 
   DEFAULT=300;
}

{
   PROPERTY = Stop_timeout; 
   MIN=60; 
   DEFAULT=300;
}
{
   PROPERTY = Validate_timeout;
   MIN=60;
   DEFAULT=300;
}
{
   PROPERTY = Update_timeout;
   MIN=60;
   DEFAULT=300;
}
{
   PROPERTY = Monitor_Start_timeout;
   MIN=60;
   DEFAULT=300;
}
{
   PROPERTY = Monitor_Stop_timeout;
   MIN=60;
   DEFAULT=300;
}
{
   PROPERTY = Thorough_Probe_Interval;
   MIN=1;
   MAX=3600;
   DEFAULT=60;
   TUNABLE = ANYTIME;
}

# The number of retries to be done within a certain period before concluding 
# that the application cannot be successfully started on this node.
{
   PROPERTY = Retry_count;
   MIN=0;
   MAX=10;
   DEFAULT=2;
   TUNABLE = ANYTIME; 
}

# Set Retry_interval as a multiple of 60 since it is converted from seconds
# to minutes, rounding up. For example, a value of 50 (seconds)
# is converted to 1 minute. Use this property to time the number of 
# retries (Retry_count).
{
   PROPERTY = Retry_interval;
   MIN=60;
   MAX=3600;
   DEFAULT=300;
   TUNABLE = ANYTIME;
}

{
   PROPERTY = Network_resources_used;
   TUNABLE = AT_CREATION;
   DEFAULT = ““;
}

尽管 Sun Cluster 软件提供了系统定义的属性,您也可以使用资源属性的属性设置不同的默认值。有关您可用来应用到资源属性中的属性的完整列表,请参见资源特性属性

有关样例 RTR 文件中系统定义的资源属性,请注意以下几点:

RTR 文件中的扩展属性

样例 RTR 文件的结尾处是扩展属性,如该列表所示。

# Extension Properties

# The cluster administrator must set the value of this property to point to the
# directory that contains the configuration files used by the application.
# For this application, DNS, specify the path of the DNS configuration file on
# PXFS (typically named.conf).
{
   PROPERTY = Confdir;
   EXTENSION;
   STRING;
   TUNABLE = AT_CREATION;
   DESCRIPTION = “The Configuration Directory Path”;
}

# Time out value in seconds before declaring the probe as failed.
{
   PROPERTY = Probe_timeout;
   EXTENSION;
   INT;
   DEFAULT = 120;
   TUNABLE = ANYTIME;
   DESCRIPTION = “Time out value for the probe (seconds)”;
}

样例 RTR 文件定义两种扩展属性,ConfdirProbe_timeoutConfdir 属性指定 DNS 配置目录的路径。该目录包含 DNS 正常操作所需的 in.named 文件。数据服务样例的 StartValidate 方法使用该属性验证启动 DNS 之前配置目录和 in.named 文件是否可访问。

配置数据服务之后,Validate 方法将检验新目录是否可以访问。

数据服务样例的 PROBE 方法不是 Sun Cluster 回调方法,而是用户定义的方法。因此,Sun Cluster 没有为其提供 Probe_timeout 属性。要使群集管理员可以配置 Probe_timeout 值,需要在 RTR 文件中定义扩展属性。