Ignore:
Timestamp:
12/16/2021 08:28:05 PM (2 years ago)
Author:
Douglas R. Reno <renodr@…>
Branches:
11.1, 11.2, 11.3, 12.0, 12.1, kea, ken/TL2024, ken/inkscape-core-mods, ken/tuningfonts, lazarus, lxqt, plabs/newcss, plabs/python-mods, python3.11, qt5new, rahul/power-profiles-daemon, renodr/vulkan-addition, trunk, xry111/intltool, xry111/llvm18, xry111/soup3, xry111/test-20220226, xry111/xf86-video-removal
Children:
bc9c5251
Parents:
0ed6f34
Message:

PostgreSQL: Minor tweaks to the text for upgrading, and make a version
for systemd

File:
1 edited

Legend:

Unmodified
Added
Removed
  • server/databases/postgresql.xml

    r0ed6f34 r60351e5b  
    157157
    158158    <note>
    159       <para>Hold off from continuing in case you are building
    160       <application>PostgreSQL</application> to upgrade an existing
    161       installation. In case the major version of the new build is
    162       different to the existing one, its quite likely that the
    163       new software cannot act on the existing data files. In this case,
    164       the server will not start and the old binaries has been overwritten
    165       so you got stuck with an unusable database.</para>
     159      <para>If you are installing <application>PostgreSQL</application> to
     160      upgrade an existing installation, there are important steps that you need
     161      to follow. If the major version of the new build is greater than the
     162      previous version, there is a chance that the data file format has changed.
     163      new software cannot act on the existing data files. In this case, the
     164      server will not start because the old programs have been overwritten, so
     165      the data is unavailable until it's file format has been converted.</para>
    166166
    167167      <para>
    168         Before upgrading an existing installation of PostgreSQL check
    169         the documentation about various ways to upgrade. Note that
    170         new major versions might use a different binary format in the
    171         data objects in which case incompatibilities may be introduced.
    172         Find the documentation about upgrading at
     168        Before upgrading an existing installation of PostgreSQL, check
     169        the documentation for any considerations that you must keep in mind
     170        during the upgrade. Note that new major versions might use a different
     171        binary format in the data objects, causing potential incompatibilities.
     172        For more information, check out upstream's documentation about
     173        upgrading PostgreSQL here.
    173174        <ulink url="https://www.postgresql.org/docs/current/upgrading.html"/>.
    174175      </para>
    175176
    176       <para>At this moment, you have both, the old and the new binaries
    177       on disk. They can be used to perform an upgrade of your existing
    178       database right now. For the folloging instructions it is
    179       assumed that
     177      <para>At this point, you may have both the old and the new binaries
     178      installed on your filesystem. These binaries can be used to perform an
     179      upgrade of your existing database files. For the following instructions
     180      it is assumed that
    180181      <itemizedlist>
    181182        <listitem><para>The actual data files are stored in
     
    192193      </para>
    193194
    194       <para>Do a temporary install which makes access to the new
    195       binaries a bit easier:</para>
    196       <screen><userinput>make DESTDIR=$(pwd)/DESTDIR install</userinput></screen>
    197 
    198       <para>Create a directory which is writable by the
    199       <systemitem class="username">postgres</systemitem> as the
     195      <para>Fist, do a temporary install which makes access to the new
     196      binaries much easier:</para>
     197<screen><userinput>make DESTDIR=$(pwd)/DESTDIR install</userinput></screen>
     198
     199      <para>Next, create a directory which is writable by the
     200      <systemitem class="username">postgres</systemitem> user, as the
    200201      <systemitem class="username">root</systemitem> user:</para>
    201202     
    202       <screen><userinput role="root">install -D -o postgres $(pwd)/DESTDIR/tmp</userinput></screen>
     203<screen><userinput role="root">install -D -o postgres $(pwd)/DESTDIR/tmp</userinput></screen>
    203204     
    204205      <para>Now, stop the existing instance of <application>PostgreSQL</application>
     
    206207      <systemitem class="username">root</systemitem> user:</para>
    207208     
    208       <screen><userinput role="root">pushd $(pwd)/DESTDIR/tmp
     209<screen revision="sysv"><userinput role="root">pushd $(pwd)/DESTDIR/tmp
    209210/etc/rc.d/init.d/postgresql stop
    210211su postgres -c "../usr/bin/initdb -D /srv/pgsql/newdata"
     
    213214                    -D /srv/pgsql/newdata -B ../usr/bin"
    214215popd</userinput></screen>
     216
     217<screen revision="systemd"><userinput role="root">pushd $(pwd)/DESTDIR/tmp
     218systemctl stop postgresql
     219su postgres -c "../usr/bin/initdb -D /srv/pgsql/newdata"
     220su postgres -c "../usr/bin/pg_upgrade \
     221                    -d /srv/pgsql/data    -b /usr/bin \
     222                    -D /srv/pgsql/newdata -B ../usr/bin"
     223popd</userinput></screen>
     224
     225      <para>At this point, your database files available in two locations on
     226      disk. The old data is located in
     227      <filename class="directory">/srv/pgsql/data</filename>, and the new data
     228      is in <filename class="directory">/srv/pgsql/newdata</filename>.
     229      Backing up the old database files is suggested before continuing.</para>
    215230     
    216       <para>At this stage, you have your database files two times on
    217       disk, one is the old data in <filename class="directory">/srv/pgsql/data</filename>
    218       and the new ones in <filename class="directory">/srv/pgsql/newdata</filename>.
    219       May this is the time you do a last backup of the old database files.</para>
    220      
    221       <para>Remove the old database files, and rename the new data
     231      <para>Next, remove the old database files, and rename the new data
    222232      directory as the <systemitem class="username">root</systemitem> user:</para>
    223233     
    224       <screen><userinput role="root">rm -rf /srv/pgsql/data
     234<screen><userinput role="root">rm -rf /srv/pgsql/data
    225235mv /srv/pgsql/newdata /srv/pgsql/data</userinput></screen>
    226236
Note: See TracChangeset for help on using the changeset viewer.