小编Ale*_*bev的帖子

无法访问 PostgreSQL 中的流复制统计信息

我有需要监视的流复制。所以Zabbix有一个特殊的用户。我不想使用 pg_mongz 并决定将我自己的查询设置为 pg_catalog 模式的视图 pg_stat_replication 以获取复制状态。

当我使用查询时:

select * 
from pg_stat_replication;
Run Code Online (Sandbox Code Playgroud)

它返回管理员的复制状态记录。但是当我以监控用户身份登录时,它仅返回:

pid, usesysid, usename, application_name
Run Code Online (Sandbox Code Playgroud)

所以client_addr、client_hostname、client_port、backend_start、state、sent_location、write_location等参数为空。

首先,我向用户授予了对架构和表的权限:

grant usage on schema pg_catalog to usrmonitor;
grant select on all tables in schema pg_catalog to usrmonitor;
Run Code Online (Sandbox Code Playgroud)

但这没有帮助。当我查看视图时,我发现查询使用函数并授予执行权限:

grant execute on function pg_stat_get_wal_senders() to usrmonitor;
grant execute on function pg_stat_get_activity(integer) to usrmonitor;
Run Code Online (Sandbox Code Playgroud)

但选择查询仍然返回空列。可能是什么问题?

postgresql replication monitoring

3
推荐指数
1
解决办法
2896
查看次数

标签 统计

monitoring ×1

postgresql ×1

replication ×1