Easily move from one PostgreSQL server to a new PostgreSQL 9.5+ server with zero or limited downtime.
Important: You must move to PostgreSQL 9.5+
- Setup your tables under
db-mover.core/start-movers
- Use
db-mover.move/move-at
anddb-mover.move/move-multi-at
- Use
- Set database configurations
from
is the database that is creating datato
is the database that is receiving data
- Profit
List of fields that comprise the table's unique condition. db-mover cannot currently move tables that do not have unique entries.
:integer
= Seconds epoch (string or int):timestamp
= SQL Timestamp
- Create the new database
- Move db roles (i.e. user accounts) Remember on RDS you cannot use pg_dumpall
- In
psql
use\du
to list roles and\z
to list permissions CREATE ROLE [DB_USER] password '[USER_PASSWORD]' login;
GRANT USAGE ON SCHEMA "public" TO "[DB_USER]";
GRANT SELECT,INSERT,UPDATE,DELETE ON ALL TABLES IN SCHEMA "public" TO "[DB_USER]";
- In
- Move schema (perhaps like):
pg_dump -h [FROM_HOST] -U [USER] -d [DB] -s -Fc > out.sql
pg_restore -v -h [TO_HOST] -U [USER] -d [DB] out.sql
- Move data on frozen/static tables
pg_dump -h [FROM_HOST] -U [USER] -d [DB] --data-only -b -t [table1] -t [table2] -Fc > table-data.sql
pg_restore -v -h [TO_HOST] -U [USER] -d [DB] table-data.sql
- Get Clojure
- Check your environment in env.clj
- lein run
Hitting the root with http will return json with current status. For example: http://localhost:8080
make build
Currently we always backup 30 seconds. Last known value - 30 seconds is the starting point.
You get to move those manually.
Nope.