建立自訂模式檔案時,請留意下列事項,尤其是使用複寫時更需特別注意:
新增模式元素時,所有屬性皆須先完成定義,方可用於物件類別中。您可以在相同的模式檔案中定義屬性與物件類別。
您所建立的每個自訂屬性或物件類別,應定義於單一的模式檔案中。此做法可防止伺服器在載入最新建立的模式時,覆寫了任何先前的定義。目錄伺服器在載入模式檔案時,會先依據數字順序,再依字母順序。
手動定義新的模式定義時,一般理想的做法是將這些定義增加到 99user.ldif 檔案中。
當您使用 LDAP 更新模式元素時,新的元素會自動寫入 99user.ldif 檔案中。因此,您在自訂模式檔案中所做的任何其他模式定義變更,均可能遭到覆寫。僅使用 99user.ldif 檔案,可防止模式元素重複的情況,以及模式變更遭到覆寫的風險。
由於目錄伺服器會依據字母數字順序載入模式檔案,且會先載入數字,因此您應以下列格式為自訂模式檔案命名:
[00-99] filename.ldif
此數字高於任何已定義的目錄標準模式。
若您以低於標準模式檔案的數字為模式檔案命名,伺服器即可能在載入模式時發生錯誤。此外,所有標準屬性與物件類別皆會在您的自訂模式元素完成載入後,才會載入。
請確定自訂模式檔案的名稱在數字與字母上皆未高於 99user.ldif,因為目錄伺服器會使用最高順序的檔案進行其內部模式管理。
例如,若您建立模式檔案,並將其命名為 99zzz.ldif,則在您下次更新模式時,所有 X-ORIGIN 值為 'user defined' 的屬性,都將寫入 99zzz.ldif 中。結果將造成兩個 LDIF 檔案含有重複的資訊,而 99zzz.ldif 檔案中的部分資訊可能會遭清除。
根據一般通則,應以下列兩個項目識別您所增加的自訂模式元素:
自訂模式檔案之 X-ORIGIN 欄位中的 'user defined';
更具說明性的標籤,如 X-ORIGIN 欄位中的 'Example.com Corporation defined',以便讓其他管理員更容易瞭解自訂模式元素。例如,X-ORIGIN ('user defined' 'Example.com Corporation defined')。
若您以手動方式增加模式元素,且未使用 X-ORIGIN 欄位中的 'user defined',模式元素在 DSCC 中即會處於唯讀狀態。
當您使用 LDAP 或 DSCC 增加自訂模式定義時,伺服器即會自動增加 'user defined' 值。但若您未在 X-ORIGIN 欄位中加入更多說明性的值,日後就可能就難以瞭解此模式的相關用途。
請手動將自訂模式檔案傳播到所有的伺服器上,因為這些變更不會自動複寫。
當您變更目錄模式時,伺服器會留存時間戳記,以記錄變更模式的時間。在每個複寫階段作業開始時,伺服器會將其時間戳記與其用戶的時間戳記進行比較,然後在必要時發送模式變更。對於自訂模式檔案,伺服器只會保存一個時間戳記,而此戳記與 99user.ldif 檔案相關聯。這表示,您對 99user.ldif 以外的檔案所做的任何自訂模式檔案變更或增加,都不會進行複寫。因此,您必須將自訂模式檔案傳播到所有其他的伺服器上,以確保所有模式資訊均存在於拓樸各處。