Page MenuHomeSoftware Heritage

Migrate databases to postgres 9.5
Closed, MigratedEdits Locked

Description

                                         List of databases
                Name                |  Owner   | Encoding | Collate |  Ctype  |   Access privileges   
------------------------------------+----------+----------+---------+---------+-----------------------
 antelink                           | postgres | UTF8     | C.UTF-8 | C.UTF-8 | 
 gitimport_20150930                 | postgres | UTF8     | C.UTF-8 | C.UTF-8 | 
 lister-github                      | postgres | UTF8     | C.UTF-8 | C.UTF-8 | 
 olasd                              | olasd    | UTF8     | C.UTF-8 | C.UTF-8 | 
 postgres                           | postgres | UTF8     | C.UTF-8 | C.UTF-8 | 
 snapshot.debian.org                | postgres | UTF8     | C.UTF-8 | C.UTF-8 | 
 softwareheritage                   | postgres | UTF8     | C.UTF-8 | C.UTF-8 | =Tc/postgres         +
                                    |          |          |         |         | postgres=CTc/postgres+
                                    |          |          |         |         | olasd=CTc/postgres
 softwareheritage-log               | postgres | UTF8     | C.UTF-8 | C.UTF-8 | 
 softwareheritage-snapshot-20151001 | postgres | UTF8     | C.UTF-8 | C.UTF-8 | 
 softwareheritage-snapshot-20151006 | postgres | UTF8     | C.UTF-8 | C.UTF-8 | 
 softwareheritage-test-dir          | olasd    | UTF8     | C.UTF-8 | C.UTF-8 | 
 template-swh                       | postgres | UTF8     | C.UTF-8 | C.UTF-8 | 
 template0                          | postgres | UTF8     | C.UTF-8 | C.UTF-8 | =c/postgres          +
                                    |          |          |         |         | postgres=CTc/postgres
 template1                          | postgres | UTF8     | C.UTF-8 | C.UTF-8 | =c/postgres          +
                                    |          |          |         |         | postgres=CTc/postgres
 zack                               | zack     | UTF8     | C.UTF-8 | C.UTF-8 | 
 zack-swh-sample                    | zack     | UTF8     | C.UTF-8 | C.UTF-8 |

move plan :

databasedestinationstatusduration
softwareheritage9.5/maindonedump: 6h50; restore 26h04
softwareheritage-log9.5/secondarydone4h03
softwareheritage-snapshot-*9.5/secondarydone4h30
softwareheritage-test-dir9.5/secondarydone33m
zack-*9.5/secondarydone12m
olasd9.5/secondarydone7h07
gitimport_201509309.5/secondarydone42m
antelink9.5/hdddone1h20
snapshot.debian.org9.5/hdddone31m
lister-github9.5/hdddone1h38

Event Timeline

olasd changed the task status from Open to Work in Progress.
olasd raised the priority of this task from to Normal.
olasd updated the task description. (Show Details)
olasd added subscribers: zack, olasd.

Database cluster initialization and credentials sync (-g: dump only tablespaces and users):
pg_dumpall -g -p <old db port> | psql -p <new db port>

Dumping and reloading one database (-C: add create database statement):
time pg_dump -p <old db port> -C <dbname> | psql -p <new db port>

We can also use the directory custom dump format to allow for job parallelization, which was used for the softwareheritage database :

Dumping one database in directory format
time pg_dump -Fd -p <old db port> -j <num jobs> -d <database> -f <destination dir>

Restoring one database in directory format
time pg_restore -p <new db port> -d postgres -cC -j <num jobs> <source dir>

We used 16 as the number of jobs, which will restore data and create indexes in parallel.

The directory format dump can also be passed to pg_restore for conversion to a SQL format dump:
pg_restore -v <source dir> | pigz > database.sql.gz

olasd claimed this task.
olasd updated the task description. (Show Details)
olasd changed the visibility from "All Users" to "Public (No Login Required)".May 13 2016, 5:08 PM