我正在尝试设置 pglogical 复制。我在提供商服务器中有一个大约有 4 行的表。
=========
employee_id | visitor_email | vistor_id | date | message
-------------+-----------------------+-----------+---------------------+--------------------------
1 | roshan@gmail.com | 1 | 2016-08-24 00:00:00 | This is the first test.
2 | roshan@myrepublic.net | 2 | 2016-08-24 00:00:00 | This is the second test.
3 | roshan@myrepublic.net | 3 | 2016-08-24 00:00:00 | This is the third test.
4 | roshan@myrepublic.net | 4 | 2016-08-24 00:00:00 | This is the fourth test.
===============================
创建上述表格后。我在提供程序中创建了一个复制集。然后我配置了订阅者节点和订阅。理想情况下,我应该在我的订阅者中看到 provider 表中的 4 行,但我只看到订阅者中的表结构,而不是数据。如果我在 provider 表中添加一个新行,如下所示
INSERT INTO employees (employee_id, visitor_email, date, message) VALUES (5, 'roshan@myrepublic.net', current_date, 'This is the fifth test.');
现在,我可以在订阅者表中看到最后添加的行。开头添加的所有其他 4 行仍然缺失。我在这里做错了什么?
这是否意味着只会考虑创建复制集之后创建的数据?如何将表的全部内容添加到复制集。?
任何帮助将不胜感激。?
问候, 穆罕默德·罗斯汉
最佳答案
您可以发出 resynchronise_table 命令来拉动所有内容。如您所见,所有后续插入都可以。
使用这个函数来做到这一点:
pglogical.alter_subscription_resynchronize_table(subscription_name name, relation regclass)
您也可以在初始同步期间传递“synchronize_data”:
有关详细信息,请参阅以下文档中的 2.3:
https://2ndquadrant.com/en/resources/pglogical/pglogical-docs/
关于postgresql - Pglogical 复制集未按预期工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39122431/