cloud-sql-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服务器的当前状态,返回版本信息、是否为副本服务器、运行时长、最大连接限制、当前连接数、活跃连接数以及连接使用率百分比。

list_pg_settings

list_pg_settings

Parameters

参数

NameTypeDescriptionRequiredDefault
setting_namestringOptional: A specific configuration parameter name pattern to search for.No``
limitintegerOptional: The maximum number of rows to return.No
50

名称类型描述是否必填默认值
setting_namestring可选:要搜索的特定配置参数名称模式。``
limitinteger可选:返回的最大行数。
50

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的大小。

list_roles

list_roles

Lists all the user-created roles in the instance . It returns the role name, Object ID, the maximum number of concurrent connections the role can make, along with boolean indicators for: superuser status, privilege inheritance from member roles, ability to create roles, ability to create databases, ability to log in, replication privilege, and the ability to bypass row-level security, the password expiration timestamp, a list of direct members belonging to this role, and a list of other roles/groups that this role is a member of.
列出实例中所有用户创建的角色。返回角色名称、对象ID、该角色允许的最大并发连接数,以及以下布尔值标识:超级用户状态、是否继承成员角色的权限、是否具备创建角色的权限、是否具备创建数据库的权限、是否允许登录、是否具备复制权限、是否可以绕过行级安全、密码过期时间戳、属于该角色的直接成员列表,以及该角色所属的其他角色/组列表。

Parameters

参数

NameTypeDescriptionRequiredDefault
role_namestringOptional: a text to filter results by role name. The input is used within a LIKE clause.No``
limitintegerOptional: The maximum number of rows to return. Default is 10No
50

名称类型描述是否必填默认值
role_namestring可选:用于按角色名称筛选结果的文本。输入将用于LIKE子句中。``
limitinteger可选:返回的最大行数。默认值为10
50

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(主服务器到已重放)。