Tag

Ada beberapa kebutuhan yang memaksa untuk melakukan proses upgrade PostgreSQL, di mana saat ini menggunakan Debian jessie.

# apt-get install postgresql-9.4

Kemudian menggunakan tool pg_dropcluster maka terlebih dahulu mematikan dahulu yang baru supaya bisa menggunakan tool pg_ugpradecluster.

Mematikan dulu cluster yang baru …

# pg_dropcluster --stop 9.4 main

Kemudian melakukan proses upgradecluster …

# pg_upgradecluster -v 9.4 9.1 main

Namun didapatkan pesan error …

Stopping old cluster...
pg_ctl: server does not shut down
HINT: The "-m fast" option immediately disconnects sessions rather than
waiting for session-initiated disconnection.
Error: Could not stop old cluster

Saya kira dengan mengulang lagi bisa berjalan, ternyata tidak …

# pg_upgradecluster -v 9.4 9.1 main
psql: FATAL: the database system is shutting down
psql: FATAL: the database system is shutting down
Use of uninitialized value $out in pattern match (m//) at /usr/share/perl5/PgCommon.pm line 915.
psql: FATAL: the database system is shutting down
Use of uninitialized value $out in pattern match (m//) at /usr/share/perl5/PgCommon.pm line 921.
Use of uninitialized value $ctype in scalar chomp at /usr/share/perl5/PgCommon.pm line 924.
Use of uninitialized value $collate in scalar chomp at /usr/share/perl5/PgCommon.pm line 925.
Error: could not get cluster locales

Kemudian dicoba untuk mematikan service postgresql yang lama dan dilanjutkan dengan menjalankan proses ulang …

# service postgresql stop
# service postgresql stop
# pg_upgradecluster -v 9.4 9.1 main
Disabling connections to the old cluster during upgrade...
Restarting old cluster with restricted connections...
Creating new cluster 9.4/main ...
config /etc/postgresql/9.4/main
data /var/lib/postgresql/9.4/main
locale en_US.UTF-8
Flags of /var/lib/postgresql/9.4/main set as ---------------C
port 5433
Disabling connections to the new cluster during upgrade...
Roles, databases, schemas, ACLs...
Fixing hardcoded library paths for stored procedures...
Upgrading database template1...
Analyzing database template1...
Fixing hardcoded library paths for stored procedures...
Upgrading database epns_lat...
Analyzing database epns_lat...
Fixing hardcoded library paths for stored procedures...
Upgrading database epns_latihan...
Analyzing database epns_latihan...
Fixing hardcoded library paths for stored procedures...
Upgrading database postgres...
Analyzing database postgres...
Fixing hardcoded library paths for stored procedures...
Upgrading database epns...
Analyzing database epns...
Re-enabling connections to the old cluster...
Re-enabling connections to the new cluster...
Copying old configuration files...
Copying old start.conf...
Copying old pg_ctl.conf...
Copying old server.crt...
Copying old server.key...
Stopping target cluster...
Stopping old cluster...
Disabling automatic startup of old cluster...
Configuring old cluster to use a different port (5433)...
Starting target cluster on the original port...
Success. Please check that the upgraded cluster works. If it does,
you can remove the old cluster with

pg_dropcluster 9.1 main

Kemudian test bahwa data yang di upgrade memiliki data yang benar, karena kalau tidak maka selamat tinggal data kalau tidak di backup lebih dahulu 😀
Bila sudah yakin benar, maka baru yang cluster 9.1 di hapus …

# pg_dropcluster 9.1 main

Referensi:

Iklan