postgresql database upgrade

1. When viewing an old version of the compiler parameters

/ * Into the old library, see the compiler parameters using the following SQL * / 
the SELECT 
    name, 
    Setting, 
    Unit 
from 
    pg_catalog.pg_settings 
the WHERE 
    context =  ' Internal '

The main attention block_size, lc_collate, lc_ctype, segment_size, wal_block_size, wal_segment_size several parameters

2. Upload and install a new version of the database source

# tar vxf postgresql-12beta1.tar.gz
# cd postgresql-12beta1
# ./configure --prefix=/usr/local/pgsql-12.0
# make -j 2
# make instal
# export PATH=$PATH:/usr/local/pgsql-12.0/bin/
# cd contrib/
# make all
# make install
# su - postgres
# cd /usr/local/pgsql-12.0/bin/
# ./initdb -D /pgdata/data_new

3. Modify the old and new pg_hba.conf file, to ensure that local postgres user can log in without a password database of old and new

# Su - Postgres 
$ cd / PGDATA / the Data 
$ vi the pg_hba.conf 
# show follows no password can log on locally to all users of all databases, without having to modify the default
------------------ -------------------------------------------------- -------
# "local" IS for Unix Domain socket Connections only
local All All Trust
---------------------------- ----------------------------------------------
# cd / PGDATA / data_ne

4. Close the old database

# su - postgres
$ pg_ctl stop

5. Upgrade

# Su - Postgres 
$ cd / tmp 
$ mkdir the upgrade_log 
# - meaning c option is to check not only upgrade 
$ / usr / local / pgsql- 12.0 / bin / pg_upgrade -c -b / usr / local / pgsql- 10.0 / bin - B / usr / local / pgsql- 12.0 / bin -d / PGDATA / Data -D / PGDATA / data_new 
# added --link, the use of hard links, the speed will increase,

 

Guess you like

Origin www.cnblogs.com/monkey6/p/11087786.html