How to migrate data from non-bdr pgsql to bdr pgsql - postgresql

I have fusionpbx with simple pgsql working ... Now i have created HA fusionpbx with bdr pgsql and it is working fine but I don't know how to migrate data from non-bdr pgsql to bdr pgsql ...

pg_dump worked for me.
pg_dump $non_bdr_db > db.sql
psql $bdr_db < db.sql
Although if you have some fancy extensions (in my case it's PostGIS) you might want to restore the database from the backup first (separately on each and every node of your BDR cluster) and then enable the BDR extension.

Related

How to exclude a particular table in postgres backup using pgbackrest?

Trying to exclude a particular table alone during postgres backup. Is there something similar in pgbackrest like pg_dump
pg_dump --exclude-table-data=ex_table demodb
I have not found such option in pbBackRest and that is expected because it's a physical backup tool and not a logical backup tool like pg_dump.

Restoring a Postgresql 10 dump to Postgres 9.3 server

We are about to upgrade from pgsql 9.3 to 10.x. Part of the requirement is to be able to switch back to 9.3 in the case of some disaster (some massive but of course, unlikely incompatibility).
I tried pg_restoring a dump taken from one of our dev v. 10.x databases to a pgsql9.3 server, and got a lot of errors.
Is there any known "roll back path" from v 10.x to v 9.3?
Actually you can use Pg_Dump will give you a full sql file including all DDL and DML statements to recreate your database in another place (or restore).
You can do statement in cmd for backup use Pg_Dump
pg_dump -U username -d database > filename.sql
For more documentation and command use you can see here Pg_Dump
And you can restore use Psql command like this
psql -U username -d database -f filename.sql
You can use the pg_dump from pg9.3 to backup the pg10 database. Then use that backup and pg_restore from pg9.3 again to restore.

Difference between the similar databases at Postgres 9.1 and Postgres 9.3

I have a database at Postgres 9.1 which is well optimised (indexes). When I make dump from it and restore it to another server with Postgres 9.3, it works very slow. What is the difference between these versions? Should I disable any features in Postgres 9.3?

How can I upgrade to postgres 9.5 from 9.3.4?

I am new to postgres. I am using postgres 9.3.4. How can I upgrade to postgres 9.5 without losing my data? Please help me.
See the Fine Manual.
Essentially, you can either dump with pg_dumpall (use pg_dumpall from 9.5!) and restore with psql, or you can use pg_upgrade for an in-place upgrade (after you have made a backup).

Postgres / Postgis - Dump and restore to new server with different user

I search for a while to find this answer but with no luck.
The situation:
I have Postgresql currently running on my production environment. I am preparing to scale my database and move it to a large server instance. I made the mistake of setting up the initial database with the postgres user who has all permissions, and I would like the new database to be controlled by a custom user I have created. ie The current database's owner is postgres, and I want the new database owner to be pooper.
To dump, I am running:
pg_dump -d database_name > database_name.sql
To restore on separate machine, I am running:
psql database_name < database_name.sql
If the user is the same, ie both postgres, then it will work just fine, but when switching users, my app does not load correctly. Is there a secret to the madness. Nothing stood out to me.
My system:
Debian Wheezy
Postgresql 9.1
Postgis Extension
pg_dump with the --no-owner flag (see pg_dump --help)
Create the new db with the new owner CREATE DATABASE foo OWNER pooper;,
Load via psql -U pooper -d database_name -f database_name.sql.