50 lines
2.1 KiB
YAML
Executable File
50 lines
2.1 KiB
YAML
Executable File
#!/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
|
|
# Docs : https://pigsty.io/docs/pgsql/playbook
|
|
# License : Apache-2.0 @ https://pigsty.io/docs/about/license/
|
|
# Copyright : 2018-2026 Ruohang Feng / Vonng (rh@vonng.com)
|
|
#==============================================================#
|
|
- name: PGSQL MIGRATION
|
|
become: false
|
|
hosts: localhost # run on localhost or infra(admin nodes)
|
|
gather_facts: no
|
|
ignore_errors: true
|
|
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
|
|
#----------------------------------------------------------------- |