forked from Vonng/pigsty
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pgsql-migration.yml
executable file
·49 lines (47 loc) · 2.02 KB
/
pgsql-migration.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env ansible-playbook
---
#==============================================================#
# File : pgsql-migration.yml
# Desc : pgsql migration plan based on logical replication
# Ctime : 2020-09-07
# Mtime : 2023-01-06
# Path : pgsql-migration.yml
# Author : Ruohang Feng ([email protected])
# License : AGPLv3
#==============================================================#
- name: PGSQL MIGRATION
become: no
hosts: localhost # run on localhost or infra(admin nodes)
gather_facts: no
ignore_errors: yes
roles: [ { role: pg_migration } ]
#--------------------------------------------------------------#
# Usage
#--------------------------------------------------------------#
# This playbook will generate on-the-fly migration plan for
# PostgreSQL Clusters using logical replication with 0 downtime:
#
# 1. Define migration task (e.g. files/migration/pg-meta.yml)
# 2. Generate migration manual & scripts with:
# ./pgsql-migration.yml -e@files/migration/pg-meta.yml
# 3. Following the manual and execute scripts one by one
#
#-----------------------------------------------------------------
# Example Migration Task Definition (files/migration/pg-meta.yml)
#-----------------------------------------------------------------
# context_dir: ~/migration # migration manuals & scripts
# src_cls: pg-meta # src cluster name <REQUIRED>
# src_db: meta # src database name <REQUIRED>
# src_ip: 10.10.10.10 # src cluster primary ip <REQUIRED>
# dst_cls: pg-test # dst cluster name <REQUIRED>
# dst_db: test # dst database name <REQUIRED>
# dst_ip: 10.10.10.11 # dst cluster primary ip <REQUIRED>
# # reference
# pg_dbsu: postgres
# pg_replication_username: replicator
# pg_replication_password: DBUser.Replicator
# pg_admin_username: dbuser_dba
# pg_admin_password: DBUser.DBA
# pg_monitor_username: dbuser_monitor
# pg_monitor_password: DBUser.Monitor
#-----------------------------------------------------------------