![]() ![]() ![]() Start the database server, again using the special database user account: /usr/local/pgsql/bin/postgres -D /usr/local/pgsql/dataįinally, restore your data from backup with: /usr/local/pgsql/bin/psql -d postgres -f outputfile Restore your previous pg_hba.conf and any nf modifications. ![]() usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data Remember that you must execute these commands while logged in to the special database user account (which you already have if you are upgrading). Ĭreate a new database cluster if needed.Install the new version of PostgreSQL as outlined in Section 16.4. (Be sure to move the directory as a single unit so relative paths remain unchanged.) To rename the directory, use a command like this: mv /usr/local/pgsql /usr/local/pgsql.old Keep in mind the directory might consume significant disk space. It is a good idea to rename the directory, rather than delete it, in case you have trouble and need to revert to it. If restoring from backup, rename or delete the old installation directory if it is not version-specific. See Chapter 18 for details about starting and stopping the server. For example, on a Red Hat Linux system one might find that this works: /etc/rc.d/init.d/postgresql stop On systems that have PostgreSQL started at boot time, there is probably a start-up file that will accomplish the same thing. In that case you can complete the installation normally and transfer the data later. While this advice might seem idiosyncratic since you haven't installed the new version yet, it is advisable to follow it if you plan to install the new version in parallel with the old version. For best results, however, try to use the pg_dumpall command from PostgreSQL 13.13, since this version contains bug fixes and improvements over older versions. To make the backup, you can use the pg_dumpall command from the version you are currently running see Section 25.1.2 for more details. To back up your database installation, type: pg_dumpall > outputfile See Chapter 20 for additional information on access control. If necessary, edit the permissions in the file /usr/local/pgsql/data/pg_hba.conf (or equivalent) to disallow access from everyone except you. This does not affect the integrity of the backup, but the changed data would of course not be included. If making a backup, make sure that your database is not being updated. When testing a PostgreSQL major upgrade, consider the following categories of possible changes: Though you can upgrade from one major version to another without upgrading to intervening versions, you should read the major release notes of all intervening versions.Ĭautious users will want to test their client applications on the new version before switching over fully therefore, it's often a good idea to set up concurrent installations of old and new versions. All user-visible changes are listed in the release notes ( Appendix E) pay particular attention to the section labeled "Migration". New major versions also typically introduce some user-visible incompatibilities, so application programming changes might be required. Consult the package-level documentation for details.) (If you are using a pre-packaged version of PostgreSQL, it may provide scripts to assist with major version upgrades. Replication methods are also available, as discussed below. The traditional method for moving data to a new major version is to dump and restore the database, though this can be slow. The data directory remains unchanged - minor upgrades are that simple.įor major releases of PostgreSQL, the internal data storage format is subject to change, thus complicating upgrades. To update between compatible versions, you simply replace the executables while the server is down and restart the server. For example, version 10.1 is compatible with version 10.0 and version 10.6. Minor releases never change the internal storage format and are always compatible with earlier and later minor releases of the same major version number. In those cases, the major version consists of the first two digit groups of the version number, e.g., 9.5, and the minor version is the third number, e.g., 3, meaning this would be the third minor release of the major release 9.5. For releases before PostgreSQL version 10.0, version numbers consist of three numbers, for example, 9.5.3. For example, in the version number 10.1, the 10 is the major version number and the 1 is the minor version number, meaning this would be the first minor release of the major release 10. This section discusses how to upgrade your database data from one PostgreSQL release to a newer one.Ĭurrent PostgreSQL version numbers consist of a major and a minor version number. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |