

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 了解 pgactive 結構描述
<a name="Appendix.PostgreSQL.CommonDBATasks.pgactive.schema"></a>

pgactive 結構描述會管理 RDS for PostgreSQL 中的主動-主動複寫。此結構描述包含儲存複寫組態和狀態資訊的資料表。

**注意**  
pgactive 結構描述正在演進，可能會有所變更。請勿直接修改這些資料表中的資料。

pgactive 結構描述中的索引鍵資料表包括：
+ `pgactive_nodes` – 儲存主動-主動複寫群組中節點的相關資訊。
+ `pgactive_connections` – 儲存每個節點的連線詳細資訊。

## pgactive\$1nodes
<a name="Appendix.PostgreSQL.CommonDBATasks.pgactive.schema.nodes"></a>

pgactive\$1nodes 會儲存參與主動-主動複寫群組之節點的相關資訊。


| 資料行 | Type | 定序 | Nullable | 預設 | 
| --- | --- | --- | --- | --- | 
| node\$1sysid | text | – | 非 NULL | – | 
| node\$1timeline | oid | – | 非 NULL | – | 
| node\$1dboid | oid | – | 非 NULL | – | 
| node\$1status | char | – | 非 NULL | – | 
| node\$1name | text | – | 非 NULL | – | 
| node\$1dsn | text | – | 非 NULL | – | 
| node\$1init\$1from\$1dsn | text | – | 非 NULL | – | 
| node\$1read\$1only | boolean | – | – | false | 
| node\$1seq\$1id | smallint | – | 非 NULL | – | 

**node\$1sysid**  
節點的唯一 ID，在 `pgactive_create_group` 或 `pgactive_join_group` 期間產生

**node\$1status**  
節點的整備程度：  
+ **b** - 開始設定
+ **i** - 初始化
+ **c** - 追趕
+ **o** - 建立傳出插槽
+ **r** - 就緒
+ **k** - 已終止
此資料行不會指出節點是否已連線或中斷連線。

**node\$1name**  
使用者提供的唯一節點名稱。

**node\$1dsn**  
連線字串或使用者映射名稱

**node\$1init\$1from\$1dsn**  
建立此節點的 DSN。

## pgactive\$1connection
<a name="Appendix.PostgreSQL.CommonDBATasks.pgactive.schema.connection"></a>

pgactive\$1connections 會儲存每個節點的連線詳細資訊。


| 資料行 | Type | 定序 | Nullable | 預設 | 
| --- | --- | --- | --- | --- | 
| conn\$1sysid | text | 無 | 非 NULL | 無 | 
| conn\$1timeline | oid | 無 | 非 NULL | 無 | 
| conn\$1dboid | oid | 無 | 非 NULL | 無 | 
| conn\$1dsn | text | 無 | 非 NULL | 無 | 
| conn\$1apply\$1delay | integer | 無 | 無 | 無 | 
| conn\$1replication\$1sets | text | 無 | 無 | 無 | 

conn\$1sysid  
此項目所參考節點的節點識別符。

conn\$1dsn  
與 pgactive.pgactive\$1nodes `node_dsn` 相同。

conn\$1apply\$1delay  
如果設定，在從遠端節點套用每個交易之前，要等待的毫秒數。主要用於偵錯。如果為 null，則套用全域預設值。

## 使用複寫集
<a name="Appendix.PostgreSQL.CommonDBATasks.pgactive.replication"></a>

複寫集會決定要從複寫操作中包含或排除哪些資料表。根據預設，除非您使用下列函數另外指定，否則會複寫所有資料表：
+ `pgactive_exclude_table_replication_set()` - 從複寫中排除指定的資料表
+ `pgactive_include_table_replication_set()` - 在複寫中包含指定的資料表

**注意**  
設定複寫集之前，請考慮下列事項：  
您只能在執行 `pgactive_create_group()` 之後但在 `pgactive_join_group()` 之前設定資料表包含或排除。
使用 `pgactive_exclude_table_replication_set()` 之後，您就無法使用 `pgactive_include_table_replication_set()`。
使用 `pgactive_include_table_replication_set()` 之後，您就無法使用 `pgactive_exclude_table_replication_set()`。

系統會根據您的初始組態，以不同的方式處理新建立的資料表：
+ 如果您排除資料表：在 `pgactive_join_group()` 之後建立的任何新資料表都會自動包含在複寫中
+ 如果您包含資料表：在 `pgactive_join_group()` 之後建立的任何新資料表都會自動從複寫中排除。

若要檢視特定資料表的複寫集組態，請使用 `pgactive.pgactive_get_table_replication_sets()` 函數。