PostgreSQL等同于MongoDB中的Oplog尾部 [英] PostgreSQL equivalent of Oplog Tailing in MongoDB
问题描述
在PostgreSQL中,是否存在与对MongoDB进行oplog拖尾类似的等效过程?我发现它在MongoDB中非常有用,可用于实时分析和通过查看日志来构建数据库中正在发生的事情的仪表板.不幸的是,MongoDB不能满足我的特定数据库需求.我真的在寻找一种合法的,非骇人听闻的方法.这将被放置在生产环境中,并且我所引起的问题不会超出它的价值.
Is there an equivalent process similar to oplog tailing for MongoDB in PostgreSQL? I find it very useful in MongoDB for real-time analytics and building out dashboards on what is going on in the DB by peeking at the log. Unfortunately MongoDB is not useful for my particular DB needs. I'm looking really for a legitimate, non-hackish, way of doing it. This would be put in a production environment and I can't cause more problems than it's worth down the line.
在此先感谢,让我们尽量不要让这成为NO-SQL与RDBMS的争论.
Thanks in advance and lets try to not make this a NO-SQL vs RDBMS debate.
推荐答案
在PostgreSQL 9.4及更高版本中,您可以通过pg_recvlogical
使用test_decoding
插件从复制槽中流式传输更改.
In PostgreSQL 9.4 and newer you can use the test_decoding
plugin via pg_recvlogical
to stream changes from a replication slot.
在9.3及更高版本中,pg_xlogdump
可以对事务日志段进行解码,但这意味着您必须捕获并转储每个段,并且确实需要启用WAL归档才能实用.
In 9.3 and newer pg_xlogdump
can decode the transaction log segments, but that means you have to capture and dump each segment, and it really requires WAL archiving to be enabled in order to be practical.
您还应该查看:
-
pg_stat_statements
扩展名 - 内置的
pg_stat_activity
视图 - 内置的
pg_stat_..
视图,例如pg_stat_user_indexes
等.
- The
pg_stat_statements
extension - The built-in
pg_stat_activity
view - The built-in
pg_stat_..
views likepg_stat_user_indexes
, etc.
这篇关于PostgreSQL等同于MongoDB中的Oplog尾部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!