admin管理员组文章数量:1401653
Replication events are displayed by ASP.NET Core 9 MVC controller according using code:
public async Task Index()
{
const string slotName = "all_slot";
await ctx.Database.ExecuteSqlAsync("create publication Jalgi_pub for all tables;");
await ctx.Database.ExecuteSqlAsync(@$"SELECT * FROM pg_create_logical_replication_slot({slotName}, 'pgoutput' , false );");
await using LogicalReplicationConnection conn = new("host=localhost;database=postgres");
await conn.Open();
PgOutputReplicationSlot slot = new(slotName);
CancellationTokenSource cancellationTokenSource = new();
await foreach (PgOutputReplicationMessage m in conn.StartReplication(
slot, new PgOutputReplicationOptions("jalgi_pub", PgOutputProtocolVersion.V4), cancellationTokenSource.Token))
{
await Response.WriteAsync($"{m.GetType().Name}<br>");
conn.SetReplicationStatus(m.WalEnd);
}
}
Code is based is sample from .html
This shows events from Postgres database only. How to show events from all databases in the cluster?
本文标签: postgresqlHow to get replication events for all databasesStack Overflow
版权声明:本文标题:postgresql - How to get replication events for all databases - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744318995a2600402.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论