Upgrade ipvs under CostOS7
Environment
CentOS7
Original version:
Psql-version
Psql (9.2.14)
Prepare to upgrade to version 9.4
Full backup of Postgresql
-Bash-4.2 $ pg_dump-U postgres whr_info_db> whr_info_db_bak.copy. SQL; this statement uses copy backup and does not run. -Bash-4.2 $ pg_dump-U postgres -- column-inserts whr_info_db> whr_info_db_bak.insert. SQL;
The backup file is located at/var/lib/pgsql.
Install the new version (this step is followed by a problem, here for record, but do not use this step) to find resources
To http://yum.postgresql.org
wget http://yum.postgresql.org/9.4/redhat/rhel-7-x86_64/pgdg-centos94-9.4-2.noarch.rpmrpm -ivh ./pgdg-centos94-9.4-2.noarch.rpm
Determine the currently running package. Run
Rpm-qa | grep postgre
Yum list ipvs * | grep 94 If the yum resource cannot be connected, run the command: yum install yum-plugin-fastestmirror to automatically find the fastest image.
Yum install unzip sql94.x86 _ 64 postgresql94-server.x86_64 postgresql94-libs.x86_64 postgresql94-contrib.x86_64 postgresql94-devel.x86_64
In this case, its installation location can be queried through the command:
/Usr/pgsql-9.4
Run upgrade
Stop sudo systemctl stop postgresql
Delete existing postgresql
Rpm-qa | grep postgresql deletes all packages found by yum remove postgresql *
Run the installation command: yum install postgresql94-server
Location:/var/lib/pgsql/9.4/data
Initialization
Run: service postgresql-9.4 initdb Of course this statement is likely to fail, run:/usr/pgsql-9.4/bin/postgresql94-setup initdb chkconfig postgresql-9.4 on
Modify the configuration by referring to http://blog.csdn.net/xundh/article/details/500371_t1:
Here, the path should be changed to/var/lib/pgsql/9.4/data/pg_hba.conf.
Set to allow remote access:
Modify/var/lib/pgsql/9.4/data/pg_assist.conf
Add the following configuration under the host all 127.0.0.1/32 md5 line of the configuration file, or directly change this line to the following configuration
Host all 0.0.0.0/0 md5
Service postgresql-9.4 start
Restore data
Sudo su-postgres-bash-4.2 $ psql create user with color postgres = # create user whr_info with password '000000'; postgres = # create database whr_info_db OWNER whr_info; postgres = # grant all privileges on database whr_info_db to whr_info; postgres = # \ q-bash-4.2 $ psql-d whr_info_db-U postgres-f whr_info_db_bak.insert. SQL
Reference: http://www.uptimemadeeasy.com/databases/upgrade-postgresql/ 9.4 documents: http://www.postgresql.org/docs/9.4/static/