本实例中的资源类型登记 (RTR) 文件中定义了 DNS 资源类型的静态配置。 此类型的资源继承了在 RTR 文件中定义的特性。
群集管理员登记 HA-DNS 数据服务时,由 RGM 读取 RTR 文件中的信息。
RTR 文件采用定义好的格式。 在文件中将依次定义资源类型特性、系统定义的资源特性和扩展特性。 有关详细信息,请参阅 rt_reg(4) 手册页和设置资源和资源类型特性。
本小节介绍了 RTR 文件样例中的具体特性。 其中列出了该文件的不同部分。 要想获得 RTR 文件样例的完整内容列表,请参阅资源类型登记文件列表。
RTR 文件样例的开头部分是注释,其后跟有用来定义 HA-DNS 配置的资源类型特性,如下所示。
# # Copyright (c) 1998-2004 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 文件中的第一项。 否则,资源类型的登记将失败。
RGM 认为特性名是不区分大小写的。 由 Sun 提供的 RTR 文件中的特性名称惯例是将名称的首字母大写,其余字母小写(方法名除外)。 方法名以及特性的属性中包含的都是大写字母。
您可以仅使用 Resource_type 特性指定资源类型名称 (sample);或在该特性前用 Vendor_id 作为前缀,前缀 与资源类型之间用“.”分隔 (SUNW.sample)。
如果使用 Vendor_id,请将其设置为用来定义资源类型的公司的股票代号。 在群集中资源类型的名称必须唯一。
Rt_version 特性用于将数据服务样例的版本标识为供应商指定的版本。
API_version 特性用于标识 Sun Cluster 的版本。 例如,API_version = 2 表明数据服务在 Sun Cluster 3.0 版本中运行。
Failover = TRUE 表明数据服务无法在可同时在多个节点联机的资源组中运行。
RT_basedir 指向 /opt/SUNWsample/bin,作为指向完整相对路径(例如回叫方法路径)的目录路径。
Start、Stop、Validate 等提供了RGM 调用的相应回叫方法程序的路径。 这些路径是基于 RT_basedir 所指定的目录的相对路径。
Pkglist 用于将 SUNWsample 标识为包含数据服务样例安装的软件包。
未在此 RTR 文件中指定的资源类型特性(例如 Single_instance、Init_nodes 和 Installed_nodes)将使用缺省值。 要获得这些资源类型特性及其缺省值的完整列表,请参阅表 A–1。
群集管理员无法更改 RTR 文件中所指定的资源类型特性的值。
按照惯例,在 RTR 文件中声明资源类型特性之后声明资源特性。 资源特性包括由 Sun Cluster 提供的系统定义的特性和由您定义的扩展特性。 对于每一种类型,您都可以指定多个由 Sun Cluster 提供的特性属性,例如最小值、最大值和缺省值。
下面列出了 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 文件样例中的系统定义的资源特性的信息:
对于所有超时设置,Sun Cluster 都提供了最小值(1 秒)和缺省值(3600 秒)。 在 RTR 文件样例中将最小值更改为 60 秒,并将缺省值更改为 300 秒。 群集管理员既可以接受此缺省值,又可以将超时值更改为其它值(60 或更大值)。 Sun Cluster 不具有最大允许值。
特性 Thorough_Probe_Interval、Retry_count 和 Retry_interval 的 TUNABLE 属性的值已设置成 ANYTIME。 此设置意味着即使在数据服务运行的情况下,群集管理员也可以更改这些特性的值。 这些特性由通过数据服务样例实现的故障监视器使用。 数据服务样例将实现 Update 方法,以在通过管理操作更改这些或其它资源特性后停止和重启故障监视器。 请参阅Update 方法。
资源特性分为以下几类:
必需的 — 创建资源时,群集管理员必须指定一个值;
可选的 — 如果管理员未指定值,系统将应用缺省值。
有条件的 — 仅当在 RTR 文件中声明之后,RGM 才会创建该特性。
数据服务样例的缺省监视器使用 Thorough_probe_interval、Retry_count、 Retry_interval 和 Network_resources_used 条件特性,因此开发者需要在 RTR 文件中声明它们。 有关特性如何分类的信息,请参阅 r_properties(5) 手册页或资源特性。
# 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 文件样例中定义了两种扩展特性 Confdir 和 Probe_timeout。 Confdir 用于指定指向 DNS 配置目录的路径。 此目录中包含 DNS 要成功地进行操作所需的 in.named 文件。 在启动 DNS 之前,数据服务样例的 Start 和 Validate 方法将使用此特性来检验配置目录和 in.named 文件是否可以存取。
配置数据服务之后,Validate 方法将检验新目录是否可以存取。
数据服务样例的 PROBE 方法不是 Sun Cluster 回叫方法,而是用户定义的方法, 因此,Sun Cluster 未为该方法提供 Probe_timeout 特性。 开发者已在 RTR 文件中定义了一个扩展特性,以便群集管理员配置 Probe_timeout 值。