此範例中的資源類型註冊 (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) 將取得它們的預設值。資源類型特性包含資源類型特性的完整清單,其中包括它們的預設值。
叢集管理員無法變更 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 提供系統定義的特性,但您可以使用資源特性性質來設定不同的預設值。請參閱資源特性性質,以取得可套用至資源特性的性質之完整清單。
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 配置目錄的路徑。此目錄包含 in.named 檔案,DNS 需要此檔案才能成功執行。資料服務範例的 Start 方法與 Validate 方法都將使用此特性,以驗證在啟動 DNS 之前配置目錄與 in.named 檔案是否均可存取。
配置資料服務時,Validate 方法將驗證新目錄是否可存取。
資料服務範例的 PROBE 方法不是 Sun Cluster 回呼方法,而是使用者定義的方法。因此,Sun Cluster 不為其提供 Probe_timeout 特性。開發者已在 RTR 檔案中定義了延伸特性,以允許叢集管理員配置 Probe_timeout 值。