简体   繁体   English

在 AWS Aurora/postgres 上收听/通知

[英]LISTEN/NOTIFY on AWS Aurora/postgres

I am hoping to implement a trigger that fires a notify on table change in PostgreSQL, but I am unable to find any definite answer to if it would work in a cluster.我希望实现一个触发器,在 PostgreSQL 中的表更改时触发通知,但我无法找到它是否可以在集群中工作的任何明确答案。

Does PostgreSQL listen/notify work on AWS Aurora (both provisioned and serverless), and can I expect all clients to receive notifications regardless of what instance they are connected to? PostgreSQL 侦听/通知是否在 AWS Aurora(预配置和无服务器)上工作,我是否可以期望所有客户端都收到通知,而不管它们连接到哪个实例?

If yes, are there any major performance concerns?如果是,是否有任何重大的性能问题?

Thanks :)谢谢 :)

The best AWS Documentation implies - YES, it does work最好的 AWS 文档暗示 - 是的,它确实有效

Specifically for Aurora Serverless, there is an advisory that "LISTEN/NOTIFY" is NOT RECOMMENDED.特别是对于 Aurora Serverless,有一个不推荐“聆听/通知”的建议。 This implies that it's possible with Aurora Serverless but not advisable.这意味着 Aurora Serverless 是可能的,但不可取。 It also implies that normal RDS LISTEN/NOTIFY does work and is ok to use.这也意味着正常的 RDS LISTEN/NOTIFY 确实有效并且可以使用。

https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-serverless.html https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-serverless.html

Currently, certain SQL queries and commands, such as cursors with hold (DECLARE name ... CURSOR WITH HOLD FOR query);当前,某些 SQL 查询和命令,例如带有保留的游标(DECLARE name ... CURSOR WITH HOLD FOR 查询); session-level advisory locks;会话级咨询锁; temporary relations;临时关系; and asynchronous notifications (LISTEN, NOTIFY commands) prevent scaling and are not recommended和异步通知(LISTEN、NOTIFY 命令)会阻止缩放,不推荐使用

My own quick test on AWS shows - Yes, it does work我自己在 AWS 上的快速测试显示 - 是的,它确实有效

  1. Launch Instance with Public Access使用公共访问启动实例

在此处输入图片说明

... ...

在此处输入图片说明

  1. Allow Traffic允许流量

在此处输入图片说明

  1. Run command in dbeaver在 dbeaver 中运行命令

在此处输入图片说明

Note: This test doesn't show a successful receipt of a notification.注意:此测试未显示成功收到通知。 That will need a quick console application to test that.这将需要一个快速的控制台应用程序来测试。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM