初始化

This commit is contained in:
2026-06-25 09:41:16 +08:00
commit 34001a4296
10 changed files with 689 additions and 0 deletions
+12
View File
@@ -0,0 +1,12 @@
-- 创建复制用户(在 Host1 主库上运行)
DO $$
BEGIN
IF NOT EXISTS (SELECT FROM pg_catalog.pg_roles WHERE rolname = 'replicator') THEN
CREATE ROLE replicator WITH REPLICATION LOGIN PASSWORD 'Bjang09@686^*^';
END IF;
END
$$;
-- 创建复制槽(用于主从复制)
SELECT pg_create_physical_replication_slot('replication_slot_slave')
WHERE NOT EXISTS (SELECT 1 FROM pg_replication_slots WHERE slot_name = 'replication_slot_slave');