alloydb-postgres-replication

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Usage

使用方法

All scripts can be executed using Node.js. Replace
<param_name>
and
<param_value>
with actual values.
Bash:
node <skill_dir>/scripts/<script_name>.js '{"<param_name>": "<param_value>"}'
PowerShell:
node <skill_dir>/scripts/<script_name>.js '{\"<param_name>\": \"<param_value>\"}'
Note: The scripts automatically load the environment variables from various .env files. Do not ask the user to set vars unless skill executions fails due to env var absence.
所有脚本均可通过Node.js执行。将
<param_name>
<param_value>
替换为实际值。
Bash:
node <skill_dir>/scripts/<script_name>.js '{"<param_name>": "<param_value>"}'
PowerShell:
node <skill_dir>/scripts/<script_name>.js '{\"<param_name>\": \"<param_value>\"}'
注意:脚本会自动从多个.env文件加载环境变量。除非因缺少环境变量导致技能执行失败,否则无需要求用户设置变量。

Scripts

脚本

database_overview

database_overview

Fetches the current state of the PostgreSQL server, returning the version, whether it's a replica, uptime duration, maximum connection limit, number of current connections, number of active connections, and the percentage of connections in use.

获取PostgreSQL服务器的当前状态,返回版本信息、是否为副本实例、运行时长、最大连接限制、当前连接数、活跃连接数以及连接使用率百分比。

get_instance

get_instance

Retrieves details about a specific AlloyDB instance.
检索特定AlloyDB实例的详细信息。

Parameters

参数

NameTypeDescriptionRequiredDefault
projectstringThe GCP project ID. This is pre-configured; do not ask for it unless the user explicitly provides a different one.No
locationstringThe location of the instance (e.g., 'us-central1').Yes
clusterstringThe ID of the cluster.Yes
instancestringThe ID of the instance.Yes

名称类型描述是否必填默认值
projectstringGCP项目ID。该参数已预先配置;除非用户明确提供不同的ID,否则无需询问。
locationstring实例所在区域(例如:'us-central1')。
clusterstring集群ID。
instancestring实例ID。

list_instances

list_instances

Lists all AlloyDB instances in a given project, location and cluster.
列出指定项目、区域和集群中的所有AlloyDB实例。

Parameters

参数

NameTypeDescriptionRequiredDefault
projectstringThe GCP project ID. This is pre-configured; do not ask for it unless the user explicitly provides a different one.No
locationstringOptional: The location of the cluster (e.g., 'us-central1'). Use '-' to get results for all regions.(Default: '-')No
-
clusterstringOptional: The ID of the cluster to list instances from. Use '-' to get results for all clusters.(Default: '-')No
-

名称类型描述是否必填默认值
projectstringGCP项目ID。该参数已预先配置;除非用户明确提供不同的ID,否则无需询问。
locationstring可选:集群所在区域(例如:'us-central1')。使用'-'可获取所有区域的结果。(默认值:'-')
-
clusterstring可选:要列出实例的集群ID。使用'-'可获取所有集群的结果。(默认值:'-')
-

list_publication_tables

list_publication_tables

Parameters

参数

NameTypeDescriptionRequiredDefault
table_namesstringOptional: Filters by a comma-separated list of table names.No``
publication_namesstringOptional: Filters by a comma-separated list of publication names.No``
schema_namesstringOptional: Filters by a comma-separated list of schema names.No``
limitintegerOptional: The maximum number of rows to return.No
50

名称类型描述是否必填默认值
table_namesstring可选:按逗号分隔的表名列表进行过滤。``
publication_namesstring可选:按逗号分隔的发布名称列表进行过滤。``
schema_namesstring可选:按逗号分隔的模式名称列表进行过滤。``
limitinteger可选:返回的最大行数。
50

list_replication_slots

list_replication_slots

List key details for all PostgreSQL replication slots (e.g., type, database, active status) and calculates the size of the outstanding WAL that is being prevented from removal by the slot.

列出所有PostgreSQL复制槽的关键详情(例如:类型、数据库、活跃状态),并计算该槽阻止删除的未处理WAL的大小。

replication_stats

replication_stats

Lists each replica's process ID, user name, application name, backend_xmin (standby's xmin horizon reported by hot_standby_feedback), client IP address, connection state, and sync_state, along with lag sizes in bytes for sent_lag (primary to sent), write_lag (sent to written), flush_lag (written to flushed), replay_lag (flushed to replayed), and the overall total_lag (primary to replayed).

列出每个副本的进程ID、用户名、应用名称、backend_xmin(由hot_standby_feedback报告的备用实例xmin范围)、客户端IP地址、连接状态和sync_state,以及各类延迟的字节数:sent_lag(主节点到已发送)、write_lag(已发送到已写入)、flush_lag(已写入到已刷新)、replay_lag(已刷新到已重放),以及总延迟total_lag(主节点到已重放)。