cd /root/setup/database
yum install -y http://yum.postgresql.org/9.4/redhat/rhel-6-x86_64/pgdg-centos94-9.4-1.noarch.rpm
[root@www database]# rpm -qa | grep postgresql93
postgresql93-9.3.6-1PGDG.rhel6.x86_64
postgresql93-libs-9.3.6-1PGDG.rhel6.x86_64
postgresql93-server-9.3.6-1PGDG.rhel6.x86_64
postgresql93-contrib-9.3.6-1PGDG.rhel6.x86_64
yum install postgresql94-server postgresql94-libs postgresql94 postgresql94-contrib
/etc/init.d/postgresql-9.4 initdb
ls /var/lib/pgsql/9.4/
cat /var/lib/pgsql/9.4/pgstartup.log
service tomcat stop
su - postgres
mkdir /tmp/pgsql
pg_dumpall > /tmp/pgsql/db.out
exit
service postgresql-9.3 stop
su - postgres
cp -pr /var/lib/pgsql/9.3 /tmp/pgsql/
/usr/pgsql-9.4/bin/pg_upgrade -b /usr/pgsql-9.3/bin -B /usr/pgsql-9.4/bin -d /var/lib/pgsql/9.3/data -D /var/lib/pgsql/9.4/data --check
/usr/pgsql-9.4/bin/pg_upgrade -v -b /usr/pgsql-9.3/bin/ -B /usr/pgsql-9.4/bin/ -d /var/lib/pgsql/9.3/data -D /var/lib/pgsql/9.4/data
reating script to analyze new cluster ok
Creating script to delete old cluster ok
Upgrade Complete
----------------
Optimizer statistics are not transferred by pg_upgrade so,
once you start the new server, consider running:
analyze_new_cluster.sh
Running this script will delete the old cluster's data files:
delete_old_cluster.sh
-bash-4.1$
diff /var/lib/pgsql/9.3/data/pg_hba.conf /var/lib/pgsql/9.4/data/pg_hba.conf
vi /var/lib/pgsql/9.4/data/pg_hba.conf
diff /var/lib/pgsql/9.3/data/postgresql.conf /var/lib/pgsql/9.4/data/postgresql.conf
effective_cache_size = 256MB
exit
service postgresql-9.4 start
su - postgres
./analyze_new_cluster.sh
[root@www database]# su - postgres
-bash-4.1$ ./analyze_new_cluster.sh
This script will generate minimal optimizer statistics rapidly
so your system is usable, and then gather statistics twice more
with increasing accuracy. When it is done, your system will
have the default level of optimizer statistics.
If you have used ALTER TABLE to modify the statistics target for
any tables, you might want to remove them and restore them after
running this script because they will delay fast statistics generation.
If you would like default statistics as quickly as possible, cancel
this script and run:
"/usr/pgsql-9.4/bin/vacuumdb" --all --analyze-only
vacuumdb: vacuuming database "jforum"
Generating minimal optimizer statistics (1 target)
vacuumdb: vacuuming database "postgres"
Generating minimal optimizer statistics (1 target)
vacuumdb: vacuuming database "template1"
Generating minimal optimizer statistics (1 target)
vacuumdb: vacuuming database "jforum"
Generating medium optimizer statistics (10 targets)
vacuumdb: vacuuming database "postgres"
Generating medium optimizer statistics (10 targets)
vacuumdb: vacuuming database "template1"
Generating default (full) optimizer statistics
vacuumdb: vacuuming database "jforum"
Generating default (full) optimizer statistics
vacuumdb: vacuuming database "postgres"
Generating default (full) optimizer statistics
vacuumdb: vacuuming database "template1"
Done
-bash-4.1$
service tomcat start
su - postgres
./delete_old_cluster.sh
yum remove postgresql93* pgdg-centos93
rm -rf /tmp/pgsql