Difference between revisions of "Updating PostgreSQL"
From Observer GigaFlow Support | VIAVI Solutions Inc.
Kevin Wilkie (Talk | contribs) (Created page with "It is possible to do a file system copy of postgres and use the db tools to perform an upgrade Create a folder to contain the original data on the new target server /opt/post...") |
Kevin Wilkie (Talk | contribs) |
||
Line 22: | Line 22: | ||
Create base db on server | Create base db on server | ||
/opt/postgresql/pg95/bin/initdb /opt/postgresql/pg95/data -E utf8 --lc-collate=C --lc-ctype=utf-8 --lc-monetary=C --lc-numeric=C | /opt/postgresql/pg95/bin/initdb /opt/postgresql/pg95/data -E utf8 --lc-collate=C --lc-ctype=utf-8 --lc-monetary=C --lc-numeric=C | ||
− | Exist "su" on new server and | + | Exist "su" on new server and start service |
exit | exit | ||
+ | mkdir /opt/postgresql/pg95/data/pg_log | ||
+ | chown postgres:postgres /opt/postgresql/pg95/data/pg_log | ||
/etc/init.d/postgresql-95 start | /etc/init.d/postgresql-95 start | ||
Revision as of 08:47, 18 October 2016
It is possible to do a file system copy of postgres and use the db tools to perform an upgrade Create a folder to contain the original data on the new target server
/opt/postgresql/orig/
On the source (orig) server, stop postgres and move the current (should be small) data folder
/etc/init.d/postgresql-95 stop
Now perform the copy
cd /opt/ rsync -av postgresql root@172.21.40.132:/opt/postgresql/orig/
On the new server copy the existing data folder (just in case)
/etc/init.d/postgresql-95 stop mv /opt/postgresql/pg95/data /opt/postgresql/pg95/orig95 mkdir /opt/postgresql/pg95/data mkdir /opt/postgresql/pg95/data/log chown -R postgres:postgres /opt/postgresql/pg95/data
"su" to the postgres user
su - postgres
Create base db on server
/opt/postgresql/pg95/bin/initdb /opt/postgresql/pg95/data -E utf8 --lc-collate=C --lc-ctype=utf-8 --lc-monetary=C --lc-numeric=C
Exist "su" on new server and start service
exit mkdir /opt/postgresql/pg95/data/pg_log chown postgres:postgres /opt/postgresql/pg95/data/pg_log /etc/init.d/postgresql-95 start
On the new server run the following
mv /opt/postgresql/pg95/data /opt/postgresql/pg95/orig95 pg_upgrade -v -d /opt/postgresql/orig/data -D /opt/postgresql/pg95/data -b /opt/postgresql/orig/bin/ -B /opt/postgresql/pg95/bin/