terça-feira, 10 de fevereiro de 2015

Upgrade de PostgreSQL 9.3 para 9.4 (em CentOS 7)

[root@localhost ~]# su - postgres
Last login: Thu Dec 25 04:31:05 EST 2014 on pts/0
-bash-4.2$ pg_dumpall > backup.sql
-bash-4.2$ exit
logout
[root@localhost ~]# wget http://yum.postgresql.org/9.4/redhat/rhel-7-x86_64/pgdg-centos94-9.4-1.noarch.rpm
--2014-12-25 04:33:01--  http://yum.postgresql.org/9.4/redhat/rhel-7-x86_64/pgdg-centos94-9.4-1.noarch.rpm
Resolving yum.postgresql.org (yum.postgresql.org)... 174.143.35.196, 2001:4800:1501:1::196
Connecting to yum.postgresql.org (yum.postgresql.org)|174.143.35.196|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5328 (5.2K) [application/x-redhat-package-manager]
Saving to: ‘pgdg-centos94-9.4-1.noarch.rpm’

100%[==============================================>] 5,328       --.-K/s   in 0.002s  

2014-12-25 04:33:08 (2.46 MB/s) - ‘pgdg-centos94-9.4-1.noarch.rpm’ saved [5328/5328]

[root@localhost ~]# rpm -ivh pgdg-centos94-9.4-1.noarch.rpm 
Preparing...                          ################################# [100%]
Updating / installing...
   1:pgdg-centos94-9.4-1              ################################# [100%]
[root@localhost ~]# systemctl stop postgresql-9.3
[root@localhost ~]# yum -y install postgresql94 postgresql94-devel postgresql94-contrib postgresql94-libs postgresql94-test postgresql94-server postgresql94-docs
Loaded plugins: fastestmirror
base                                                                                                                                            | 3.6 kB  00:00:00     
extras                                                                                                                                          | 3.4 kB  00:00:00     
pgdg93                                                                                                                                          | 3.6 kB  00:00:00     
pgdg94                                                                                                                                          | 3.6 kB  00:00:00     
updates                                                                                                                                         | 3.4 kB  00:00:00     
Loading mirror speeds from cached hostfile
 * base: mirror.powerhost.cl
 * extras: centos.ufms.br
 * updates: centos.ufms.br
Resolving Dependencies
--> Running transaction check
---> Package postgresql94.x86_64 0:9.4.0-1PGDG.rhel7 will be installed
---> Package postgresql94-contrib.x86_64 0:9.4.0-1PGDG.rhel7 will be installed
---> Package postgresql94-devel.x86_64 0:9.4.0-1PGDG.rhel7 will be installed
---> Package postgresql94-docs.x86_64 0:9.4.0-1PGDG.rhel7 will be installed
---> Package postgresql94-libs.x86_64 0:9.4.0-1PGDG.rhel7 will be installed
---> Package postgresql94-server.x86_64 0:9.4.0-1PGDG.rhel7 will be installed
---> Package postgresql94-test.x86_64 0:9.4.0-1PGDG.rhel7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================
 Package                                        Arch                             Version                                        Repository                        Size
====================================================================================
Installing:
 postgresql94                                   x86_64                           9.4.0-1PGDG.rhel7                              pgdg94                           1.0 M
 postgresql94-contrib                           x86_64                           9.4.0-1PGDG.rhel7                              pgdg94                           601 k
 postgresql94-devel                             x86_64                           9.4.0-1PGDG.rhel7                              pgdg94                           1.6 M
 postgresql94-docs                              x86_64                           9.4.0-1PGDG.rhel7                              pgdg94                            13 M
 postgresql94-libs                              x86_64                           9.4.0-1PGDG.rhel7                              pgdg94                           201 k
 postgresql94-server                            x86_64                           9.4.0-1PGDG.rhel7                              pgdg94                           3.8 M
 postgresql94-test                              x86_64                           9.4.0-1PGDG.rhel7                              pgdg94                           1.3 M

Transaction Summary
==========================================================================================
Install  7 Packages

Total download size: 22 M
Installed size: 72 M
Downloading packages:
(1/7): postgresql94-contrib-9.4.0-1PGDG.rhel7.x86_64.rpm                                                                                        | 601 kB  00:00:02     
(2/7): postgresql94-devel-9.4.0-1PGDG.rhel7.x86_64.rpm                                                                                          | 1.6 MB  00:00:01     
(3/7): postgresql94-9.4.0-1PGDG.rhel7.x86_64.rpm                                                                                                | 1.0 MB  00:00:17     
(4/7): postgresql94-docs-9.4.0-1PGDG.rhel7.x86_64.rpm                                                                                           |  13 MB  00:00:13     
(5/7): postgresql94-libs-9.4.0-1PGDG.rhel7.x86_64.rpm                                                                                           | 201 kB  00:00:00     
(6/7): postgresql94-server-9.4.0-1PGDG.rhel7.x86_64.rpm                                                                                         | 3.8 MB  00:00:04     
(7/7): postgresql94-test-9.4.0-1PGDG.rhel7.x86_64.rpm                                                                                           | 1.3 MB  00:00:05     
---------------------------------------------------------------------------------------
Total                                                                                                                                  933 kB/s |  22 MB  00:00:23     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : postgresql94-libs-9.4.0-1PGDG.rhel7.x86_64                                                                                                          1/7 
  Installing : postgresql94-9.4.0-1PGDG.rhel7.x86_64                                                                                                               2/7 
  Installing : postgresql94-devel-9.4.0-1PGDG.rhel7.x86_64                                                                                                         3/7 
  Installing : postgresql94-server-9.4.0-1PGDG.rhel7.x86_64                                                                                                        4/7 
  Installing : postgresql94-test-9.4.0-1PGDG.rhel7.x86_64                                                                                                          5/7 
  Installing : postgresql94-contrib-9.4.0-1PGDG.rhel7.x86_64                                                                                                       6/7 
  Installing : postgresql94-docs-9.4.0-1PGDG.rhel7.x86_64                                                                                                          7/7 
  Verifying  : postgresql94-contrib-9.4.0-1PGDG.rhel7.x86_64                                                                                                       1/7 
  Verifying  : postgresql94-test-9.4.0-1PGDG.rhel7.x86_64                                                                                                          2/7 
  Verifying  : postgresql94-9.4.0-1PGDG.rhel7.x86_64                                                                                                               3/7 
  Verifying  : postgresql94-devel-9.4.0-1PGDG.rhel7.x86_64                                                                                                         4/7 
  Verifying  : postgresql94-docs-9.4.0-1PGDG.rhel7.x86_64                                                                                                          5/7 
  Verifying  : postgresql94-server-9.4.0-1PGDG.rhel7.x86_64                                                                                                        6/7 
  Verifying  : postgresql94-libs-9.4.0-1PGDG.rhel7.x86_64                                                                                                          7/7 

Installed:
  postgresql94.x86_64 0:9.4.0-1PGDG.rhel7              postgresql94-contrib.x86_64 0:9.4.0-1PGDG.rhel7         postgresql94-devel.x86_64 0:9.4.0-1PGDG.rhel7         
  postgresql94-docs.x86_64 0:9.4.0-1PGDG.rhel7         postgresql94-libs.x86_64 0:9.4.0-1PGDG.rhel7            postgresql94-server.x86_64 0:9.4.0-1PGDG.rhel7        
  postgresql94-test.x86_64 0:9.4.0-1PGDG.rhel7        

Complete!
[root@localhost ~]# /usr/pgsql-9.4/bin/postgresql94-setup initdb
Initializing database ... OK

[root@localhost ~]# systemctl enable postgresql-9.4
ln -s '/usr/lib/systemd/system/postgresql-9.4.service' '/etc/systemd/system/multi-user.target.wants/postgresql-9.4.service'
[root@localhost ~]# systemctl disable postgresql-9.3
rm '/etc/systemd/system/multi-user.target.wants/postgresql-9.3.service'
[root@localhost ~]# systemctl start postgresql-9.4
[root@localhost ~]# su - postgres
Last login: Thu Dec 25 04:31:31 EST 2014 on pts/0
-bash-4.2$ psql
psql (9.4.0)
Type "help" for help.

postgres=# \q
-bash-4.2$ psql < backup.sql 
SET
SET
SET
ERROR:  role "postgres" already exists
ALTER ROLE
REVOKE
REVOKE
GRANT
GRANT
You are now connected to database "postgres" as user "postgres".
SET
SET
SET
SET
SET
SET
SET
COMMENT
CREATE EXTENSION
COMMENT
REVOKE
REVOKE
GRANT
GRANT
You are now connected to database "template1" as user "postgres".
SET
SET
SET
SET
SET
SET
SET
COMMENT
CREATE EXTENSION
COMMENT
REVOKE
REVOKE
GRANT
GRANT
-bash-4.2$

Nenhum comentário:

Postar um comentário