Changeset 2bda7ac4


Ignore:
Timestamp:
12/12/2021 07:06:40 AM (2 years ago)
Author:
Thomas Trepl (Moody) <thomas@…>
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:
11d9a3f
Parents:
36a0ff4 (diff), e99a437 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Add some notes about how to upgrade existing DBMS to avoid failures with incompatible file formats.

Location:
server/databases
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • server/databases/databases.xml

    r36a0ff4 r2bda7ac4  
    1919  </para>
    2020
     21  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="upgradedb.xml"/>
     22
    2123  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="db.xml"/>
    2224  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="lmdb.xml"/>
  • server/databases/postgresql.xml

    r36a0ff4 r2bda7ac4  
    105105    <title>Installation of PostgreSQL</title>
    106106
     107    <para>
     108      For enhanced security, it is better to have a dedicated group and user
     109      for running the PostgreSQL server. First, issue as the
     110      <systemitem class="username">root</systemitem> user:
     111    </para>
     112
     113<screen role="root"><userinput>groupadd -g 41 postgres &amp;&amp;
     114useradd -c "PostgreSQL Server" -g postgres -d /srv/pgsql/data \
     115        -u 41 postgres</userinput></screen>
     116
    107117    <note>
     118      <para>
     119        There are several configuration items that add additional
     120        functionality with optional packages to
     121        <application>PostgreSQL</application>.  Use <command>./configure
     122        --help</command> to see a list.
     123      </para>
     124    </note>
     125
     126    <para>
     127      Install <application>PostgreSQL</application> with the
     128      following commands:
     129    </para>
     130
     131<screen><userinput>sed -i '/DEFAULT_PGSOCKET_DIR/s@/tmp@/run/postgresql@' src/include/pg_config_manual.h &amp;&amp;
     132
     133./configure --prefix=/usr          \
     134            --enable-thread-safety \
     135            --docdir=/usr/share/doc/postgresql-&postgresql-version; &amp;&amp;
     136make</userinput></screen>
     137
     138    <para>
     139      There are a number of programs in the
     140      <filename class="directory">contrib/</filename> directory. If you are
     141      going to run this installation as a server and wish to build some of
     142      them, enter <command>make -C contrib</command> or <command>make -C
     143      contrib/<replaceable>&lt;SUBDIR-NAME&gt;</replaceable></command> for
     144      each subdirectory.
     145    </para>
     146
     147    <para>
     148      Tests must be run as an unprivileged user because they need to start a
     149      temporary server and this is prevented as the root user. For the same
     150      reason, you need to stop all PostgreSQL servers if any are running. If a
     151      previous version of PostgreSQL is installed, it may be necessary to use
     152      <command>--disable-rpath</command> with <command>configure</command> to
     153      avoid failures, but <emphasis>installing the binaries created using this
     154      switch is not recommended</emphasis>. To test the results, issue:
     155      <command>make check</command>.
     156    </para>
     157
     158    <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>
     166
    108167      <para>
    109168        Before upgrading an existing installation of PostgreSQL check
     
    114173        <ulink url="https://www.postgresql.org/docs/current/upgrading.html"/>.
    115174      </para>
     175
     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
     180      <itemizedlist>
     181        <listitem><para>The actual data files are stored in
     182          <filename class="directory">/srv/pgsql/data</filename></para>
     183        </listitem>
     184        <listitem><para>The upgraded data files will be stored in
     185          <filename class="directory">/srv/pgsql/newdata</filename></para>
     186        </listitem>
     187        <listitem><para>There is enough disk space to hold the actual
     188          data files twice. The upgrade is not an inline upgrade but
     189          it will copy the data to new database files.</para>
     190        </listitem>
     191      </itemizedlist>
     192      </para>
     193
     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
     200      <systemitem class="username">root</systemitem> user:</para>
     201     
     202      <screen><userinput role="root">install -D -o postgres $(pwd)/DESTDIR/tmp</userinput></screen>
     203     
     204      <para>Now, stop the existing instance of <application>PostgreSQL</application>
     205      and start the upgrade process as the
     206      <systemitem class="username">root</systemitem> user:</para>
     207     
     208      <screen><userinput role="root">pushd $(pwd)/DESTDIR/tmp
     209/etc/rc.d/init.d/postgresql stop
     210su postgres -c "../usr/bin/initdb -D /srv/pgsql/newdata"
     211su postgres -c "../usr/bin/pg_upgrade \
     212                    -d /srv/pgsql/data    -b /usr/bin \
     213                    -D /srv/pgsql/newdata -B ../usr/bin"
     214popd</userinput></screen>
     215     
     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
     222      directory as the <systemitem class="username">root</systemitem> user:</para>
     223     
     224      <screen><userinput role="root">rm -rf /srv/pgsql/data
     225mv /srv/pgsql/newdata /srv/pgsql/data</userinput></screen>
     226
    116227    </note>
    117 
    118     <para>
    119       For enhanced security, it is better to have a dedicated group and user
    120       for running the PostgreSQL server. First, issue as the
    121       <systemitem class="username">root</systemitem> user:
    122     </para>
    123 
    124 <screen role="root"><userinput>groupadd -g 41 postgres &amp;&amp;
    125 useradd -c "PostgreSQL Server" -g postgres -d /srv/pgsql/data \
    126         -u 41 postgres</userinput></screen>
    127 
    128     <note>
    129       <para>
    130         There are several configuration items that add additional
    131         functionality with optional packages to
    132         <application>PostgreSQL</application>.  Use <command>./configure
    133         --help</command> to see a list.
    134       </para>
    135     </note>
    136 
    137     <para>
    138       Install <application>PostgreSQL</application> with the
    139       following commands:
    140     </para>
    141 
    142 <screen><userinput>sed -i '/DEFAULT_PGSOCKET_DIR/s@/tmp@/run/postgresql@' src/include/pg_config_manual.h &amp;&amp;
    143 
    144 ./configure --prefix=/usr          \
    145             --enable-thread-safety \
    146             --docdir=/usr/share/doc/postgresql-&postgresql-version; &amp;&amp;
    147 make</userinput></screen>
    148 
    149     <para>
    150       There are a number of programs in the
    151       <filename class="directory">contrib/</filename> directory. If you are
    152       going to run this installation as a server and wish to build some of
    153       them, enter <command>make -C contrib</command> or <command>make -C
    154       contrib/<replaceable>&lt;SUBDIR-NAME&gt;</replaceable></command> for
    155       each subdirectory.
    156     </para>
    157 
    158     <para>
    159       Tests must be run as an unprivileged user because they need to start a
    160       temporary server and this is prevented as the root user. For the same
    161       reason, you need to stop all PostgreSQL servers if any are running. If a
    162       previous version of PostgreSQL is installed, it may be necessary to use
    163       <command>--disable-rpath</command> with <command>configure</command> to
    164       avoid failures, but <emphasis>installing the binaries created using this
    165       switch is not recommended</emphasis>. To test the results, issue:
    166       <command>make check</command>.
    167     </para>
    168 
     228   
    169229    <para>
    170230      Now, as the <systemitem class="username">root</systemitem> user:
     
    188248      </para>
    189249    </tip>
     250
     251    <para>
     252      If you have upgraded an existing database, skip the rest of the
     253      commands because your database is ready to use. If this is the
     254      first time you install <application>PostgreSQL</application>,
     255      continue with the initialization.
     256    </para>
    190257
    191258    <para>
Note: See TracChangeset for help on using the changeset viewer.