此範例中的資源類型註冊 (RTR) 檔案定義 DNS 資源類型的靜態配置。此類型的資源將繼承在 RTR 檔案中定義的特性。
當叢集管理員註冊 HA-DNS 檔案服務時,Resource Group Manager (RGM) 將讀取 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 檔案中的第一個項目。否則,資源類型註冊會失敗。
以下資訊說明這些特性︰
您可以單獨使用 Resource_type 特性 (sample) 指定資源類型名稱,或將 vendor-id 用做前綴,後接小數點號 (.),然後接資源類型特性 (SUNW.sample)。
如果您指定 vendor-id,請使用定義資源類型的公司之股票交易代號。資源類型名稱在叢集中必須是唯一的。
RT_version 特性識別由供應商指定的資料服務範例版本。
API_version 特性識別 Sun Cluster 版本。例如,API_version = 2 表示資料服務可以在 Sun Cluster 3.0 及其以後的任何 Sun Cluster 版本上執行。API_version = 5 表示資料服務可以安裝在 3.1 9/04 及其以後的任何 Sun Cluster 版本上。然而,API_version = 5 也表示資料服務不能安裝在 3.1 9/04 之前發行的任何 Sun Cluster 版本上。資源類型特性中的 API_version 項目更詳細地說明了此特性。
Failover = TRUE 表示資料服務無法在可在多個節點上同時處於線上狀態的資源群組中執行。
RT_basedir 指向 /opt/SUNWsample/bin 作為目錄路徑以完成相對路徑,例如回呼方法路徑。
Start、Stop 和 Validate 為 RGM 執行的每個回呼方法程式分別提供路徑。這些路徑與由 RT_basedir 指定的路徑是相對的。
Pkglist 將 SUNWsample 識別為含有資料服務範例安裝的套裝軟體。
未在此 RTR 檔案中指定的資源類型特性 (如 Single_instance、Init_nodes 和 Installed_nodes) 將設定為預設值。資源類型特性含有資源類型特性的完整清單 (包含其預設值)。
叢集管理員無法變更 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 方法如何工作。
資源特性分類如下︰
必需的。建立資源時,叢集管理員必須指定一個值。
可選用。如果叢集管理員不指定值,系統將提供預設值。
條件式。RGM 僅建立在 RTR 檔案中已宣告的特性。
資料服務範例的故障監視器使用 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 配置目錄的路徑。此目錄含有 in.named 檔案,DNS 需要此檔案才能成功作業。資料服務範例的 Start 和 Validate 方法在啟動 DNS 前使用此特性驗證配置目錄和 in.named 檔案是否可存取。
配置資料服務時,Validate 方法將驗證新目錄是否可存取。
資料服務範例的 PROBE 方法不是 Sun Cluster 回呼方法,而是使用者定義的方法。因此,Sun Cluster 不提供該方法的 Probe_timeout 特性。您需要定義 RTR 檔案中的延伸特性,以便叢集管理員配置 Probe_timeout 值。