複製作業 v1.9.0 自訂資源定義

選取文件版本:

規格結構定義

ReplicationSpec 會定義 Replication 的所需狀態。

dbcluster:
  name: string
downstream:
  control: string
  host: string
  password:
    name: string
    namespace: string
  port: integer
  replicationSlotName: string
  username: string
upstream:
  applicationName: string
  logReplicationSlot: boolean
  logicalReplication:
    databaseName: string
    pluginName: string
  password:
    name: string
    namespace: string
  replicationSlotName: string
  synchronous: string
  username: string

欄位

類型
必填或選填

 

說明
dbcluster
object
選填
DBCluster 是這個 Replication 所屬的 DBCluster。
dbcluster.name
string
選填
參照對象的名稱。詳情請參閱「名稱」。
downstream
object
選填
Downstream 包含複製下游資料庫的規格。
downstream.control
string
必要
控制項會指定要對這個資料庫執行的複製作業。允許的值為 setup、promote 和 rewind。
downstream.host
string
必填
主機是上游資料庫的連線端點,這個資料庫可以存取該端點來進行複製。
downstream.password
object
必填
密碼是指儲存上游資料庫複製使用者密碼的密鑰。
downstream.password.name
string
選填
名稱在命名空間內不得重複,用於參照密鑰資源。
downstream.password.namespace
string
選填
namespace 定義密鑰名稱不得重複的空間。
downstream.port
integer
選填
通訊埠是這個資料庫可存取的上游資料庫通訊埠,用於複製作業。預設值為 5432。
downstream.replicationslotname
string
必填
ReplicationSlotName 是在上游資料庫建立的複製運算單元名稱。這個資料庫會使用這個值進行複製。
downstream.username
string
必要
使用者名稱是指在上游資料庫建立的複製使用者名稱。這個資料庫會使用該金鑰連線至上游,以便進行複製。
upstream
object
選填
上游包含複製上游資料庫的規格。
upstream.applicationName
string
選填
applicationName 是同步複製連線的 ID。如果將「Synchronous」設為「true」,就必須提供這個值。
upstream.logReplicationSlot
boolean
選填
如果將 LogReplicationSlot 設為 true,這個複製運算單元就能寫入主要執行個體產生的 WAL 檔案。
建議啟用這個選項,特別是跨區域複寫時。請確認主要 DBCluster 也已啟用 ReplayReplicationSlotsOnStandbys 選項,確保寫入 WAL 檔案的複製運算單元會在高可用性待命執行個體上重播。
同時啟用這兩個選項,可確保在主要 DBCluster 發生 HA 容錯移轉或切換時,新的 HA 主要執行個體會保留次要 DBCluster 尚未收到的 WAL 檔案。
請注意,修改這個欄位會導致主要資料庫重新啟動。
upstream.logicalReplication
object
選填
LogicalReplication 會指定複製運算單元的邏輯複製設定。如果留空,複製運算單元會設為實體複製運算單元。
upstream.logicalReplication.databaseName
string
選填
DatabaseName 是與這個運算單元相關聯的資料庫。只有這個資料庫的變更會透過運算單元串流。
upstream.logicalReplication.pluginName
string
選填
PluginName 是與這個時段相關聯的解碼外掛程式。詳情請參閱「邏輯解碼說明」。
upstream.password
object
必要
Password 是指儲存複製使用者密碼的密鑰。 如未提供密碼,系統會產生密碼,並儲存在狀態中顯示的密鑰。
upstream.password.name
string
選填
名稱在命名空間內不得重複,用於參照密鑰資源。
upstream.password.namespace
string
選填
namespace 定義密鑰名稱不得重複的空間。
upstream.replicationslotname
string
選填
ReplicationSlotName 是要用於複製作業的複製運算單元名稱。如未提供,系統會產生複製運算單元名稱,並顯示在狀態中。
upstream.synchronous
string
選填
「同步」會指定是否必須為同步複製設定複製運算單元。如果為 true,applicationName 會新增至同步待命清單。預設值為 false。
注意:這可能會對效能造成負面影響。
upstream.username
string
選填
使用者名稱是複製作業要使用的複製使用者名稱。 如未提供,系統會產生使用者名稱,並顯示在狀態中。

狀態結構定義

ReplicationStatus 定義 Replication 的觀察狀態。

conditions:
- lastTransitionTime: string
  message: string
  observedGeneration: integer
  reason: string
  status: string
  type: string
criticalIncidents:
- code: string
  createTime: string
  message: string
  messageTemplateParams: object
  resource:
    component: string
    location:
      cluster: string
      group: string
      kind: string
      name: string
      namespace: string
      version: string
  stackTrace:
  - component: string
    message: string
  transientUntil: string
downstream:
  physicalDownstream:
    passwordResourceVersion: string
    setupStrategies:
      endedAt: string
      message: string
      retries: integer
      startedAt: string
      state: string
      strategy: string
    state: string
observedGeneration: integer
reconciled: boolean
upstream:
  host: string
  password:
    name: string
    namespace: string
  port: integer
  replicationSlotName: string
  username: string

欄位

類型
必填或選填

 

說明
conditions[]
object
選填
條件代表實體目前狀態的最新可用觀察結果。
conditions[].lastTransitionTime
string
必填
lastTransitionTime 是條件上次從某個狀態轉換為另一個狀態的時間,這會在基礎條件變更時發生。如果不知道基礎條件的變更時間,請使用 API 欄位變更的時間。
conditions[].message
string
必填
message 是使用者可讀的訊息,指出轉換的詳細資料。這個值可以是空白字串。
conditions[].observedGeneration
integer
選填
observedGeneration 代表設定條件時依據的 .metadata.generation。舉例來說,如果 .metadata.generation 為 12,但 .status.conditions[x].observedGeneration 為 9,則條件相對於執行個體的目前狀態已過時。
conditions[].reason
string
必填
reason 包含程式輔助 ID,指出條件上次轉換的原因。特定條件類型的產生者可以定義這個欄位的預期值和意義,以及這些值是否視為保證的 API。值必須是駝峰式大小寫字串。 這個欄位不得留空。
conditions[].status
string
必填
條件狀態,可為 True、False 或 Unknown。
conditions[].type
string
必填
條件類型,格式為駝峰式大小寫或 foo.example.com/駝峰式大小寫。許多 .condition.type 值在不同資源中都一致,例如 Available。由於任意條件可能很有用 (請參閱 .node.status.conditions),因此解決衝突的能力相當重要。比對的規則運算式為 (dns1123SubdomainFmt/)?(qualifiedNameFmt)。
criticalIncidents[]
object
必填
CriticalIncidents 是所有有效重大事件的平面清單。
criticalIncidents[].code
string
必填
「Code」是這項特定錯誤的錯誤代碼。錯誤代碼是 DBSE+numeric 字串,例如 DBSE1012。
criticalIncidents[].createTime
string
必填
CreateTime 是在來源建立這個事件的時間戳記。
criticalIncidents[].message
string
選填
訊息會說明發生的事件或錯誤。
criticalIncidents[].messageTemplateParams
object
選填
MessageTemplateParams 包含產生使用者介面中資料驅動型 Message 容易使用版本所需的鍵/值組合。
criticalIncidents[].resource
object
必填
資源包含回報事件的資料庫服務元件相關資訊,以及 Kubernetes 資源的相關資訊。
criticalIncidents[].resource.component
string
必填
元件是回報事件的資料庫服務子系統內部 ID。
criticalIncidents[].resource.location
object
選填
位置。
criticalIncidents[].resource.location.cluster
string
選填
受影響 Kubernetes 資源的叢集名稱。
criticalIncidents[].resource.location.group
string
選填
Kubernetes 資源的群組名稱。
criticalIncidents[].resource.location.kind
string
選填
Kubernetes 資源的種類。
criticalIncidents[].resource.location.name
string
選填
受影響 Kubernetes 資源的名稱。
criticalIncidents[].resource.location.namespace
string
選填
受影響 Kubernetes 資源的命名空間。
criticalIncidents[].resource.location.version
string
選填
Kubernetes 資源的版本。
criticalIncidents[].stackTrace[]
object
選填
堆疊追蹤中的非結構化訊息清單。
criticalIncidents[].stackTrace[].component
string
選填
記錄訊息的資料庫服務元件名稱。
criticalIncidents[].stackTrace.message
string
選填
記錄訊息。
criticalIncidents[].transientUntil
string
選填
如果存在 TransientUntil,表示問題必須視為暫時性,直到指定時間為止。
downstream
object
選填
下游包含觀察到的複製下游資料庫狀態。
downstream.physicalDownstream
object
選填
downstream.physicalDownstream.passwordResourceVersion
string
選填
PasswordResourceVersion 是密鑰密碼的資源版本。這個版本代表密碼上次在資料庫更新的時間。
downstream.physicalDownstream.setupStrategies
object
選填
SetupStrategies 包含每次嘗試設定策略的執行資訊。清單中的顯示順序與規格中定義的策略順序相同。
downstream.physicalDownstream.setupStrategies.endedAt
string
選填
EndedAt 是這項策略最近一次嘗試結束的時間。
downstream.physicalDownstream.setupStrategies.message
string
選填
訊息會說明設定嘗試處於目前狀態的原因。
downstream.physicalDownstream.setupStrategies.retries
integer
選填
「重試」是指這項策略的重試次數。
downstream.physicalDownstream.setupStrategies.startedAt
string
選填
StartedAt 是指最近一次嘗試執行這項策略的時間。
downstream.physicalDownstream.setupStrategies.state
string
必填
這項設定策略的狀態。可接受的值如下:
InProgress:策略正在執行。
Success:策略已順利完成,不會再嘗試設定策略。
Error:策略失敗,但系統會重試。「重試」欄位會顯示這項策略的重試次數。
Fallback:策略失敗,不會重新嘗試。如果沒有,運算子會改用下一個可用的策略。
Unknown
downstream.physicalDownstream.setupStrategies.strategy
string
必填
「策略」是指這個狀態所屬的策略類型。
downstream.physicalDownstream.state
object
選填
狀態是下游資料庫伺服器的 pg_stat_wal_receiver 資料表所顯示的複寫狀態。
observedgeneration
integer
選填
內部:控制器觀察到的世代。
reconciled
boolean
選填
內部:資源是否已由控制器協調。
upstream
object
選填
Upstream 包含複製上游資料庫的觀測狀態。
upstream.host
string
選填
主機是這個資料庫的連線端點,下游資料庫可以存取這個端點來執行複製作業。
upstream.password
object
選填
密碼是指儲存這個資料庫複寫使用者密碼的密鑰。
upstream.password.name
string
選填
名稱在命名空間內不得重複,用於參照密鑰資源。
upstream.password.namespace
string
選填
namespace 定義密鑰名稱不得重複的空間。
upstream.port
integer
選填
通訊埠是這個資料庫的通訊埠,下游資料庫可透過這個通訊埠存取資料庫,以便複製資料。
upstream.replicationslotname
string
選填
ReplicationSlotName 是在這個資料庫上建立的複製運算單元名稱。下游資料庫可以使用這個複製運算單元進行複製。
upstream.username
string
選填
使用者名稱是這個資料庫的複寫使用者名稱。下游資料庫可以使用這個使用者連線至這個資料庫,以便進行複製。