su - postgres
mkdir /tmp/pgsql
pg_dumpall > /tmp/pgsql/db.out
cp -pr /var/lib/pgsql/9.2 /tmp/pgsql/
exit
cd /root/setup/database
wget http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-centos93-9.3-1.noarch.rpm
rpm -ivh ./pgdg-centos93-9.3-1.noarch.rpm
[root@www database]# rpm -qa | grep postgresql92
postgresql92-libs-9.2.9-1PGDG.rhel6.x86_64
postgresql92-9.2.9-1PGDG.rhel6.x86_64
postgresql92-server-9.2.9-1PGDG.rhel6.x86_64
yum install postgresql93-server postgresql93-libs postgresql93 postgresql93-contrib
PGPORT=5432
PGPORT=5433
/etc/init.d/postgresql-9.3 initdb
ls /var/lib/pgsql/9.3/
cat /var/lib/pgsql/9.3/pgstartup.log
service tomcat stop
service postgresql-9.2 stop
su - postgres
cp -pr /var/lib/pgsql/9.2 /tmp/pgsql/
/usr/pgsql-9.3/bin/pg_upgrade -v -b /usr/pgsql-9.2/bin/ -B /usr/pgsql-9.3/bin/ -d /var/lib/pgsql/9.2/data/ -D /var/lib/pgsql/9.3/data/
Creating 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.2/data/pg_hba.conf /var/lib/pgsql/9.3/data/pg_hba.conf
cp -p /var/lib/pgsql/9.2/data/pg_hba.conf /var/lib/pgsql/9.3/data/pg_hba.conf
diff /var/lib/pgsql/9.2/data/postgresql.conf /var/lib/pgsql/9.3/data/postgresql.conf
exit
PGPORT=5433
PGPORT=5432
service postgresql-9.3 start
su - postgres
./analyze_new_cluster.sh
-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.3/bin/vacuumdb" --all --analyze-only
Generating minimal optimizer statistics (1 target)
--------------------------------------------------
vacuumdb: vacuuming database "jforum"
vacuumdb: vacuuming database "postgres"
vacuumdb: vacuuming database "template1"
The server is now available with minimal optimizer statistics.
Query performance will be optimal once this script completes.
Generating medium optimizer statistics (3 targets)
---------------------------------------------------
vacuumdb: vacuuming database "jforum"
vacuumdb: vacuuming database "postgres"
vacuumdb: vacuuming database "template1"
Generating default (full) optimizer statistics (100 targets?)
-------------------------------------------------------------
vacuumdb: vacuuming database "jforum"
vacuumdb: vacuuming database "postgres"
vacuumdb: vacuuming database "template1"
Done
-bash-4.1$
service tomcat start
su - postgres
./delete_old_cluster.sh
yum remove postgresql92-server postgresql92-libs postgresql92 pgdg-centos92
rm -rf /tmp/pgsql