on finding solutions and seeking further assistance from the Evergreen community.</para> \r
</note>\r
</section>\r
- <section xml:id="upgrading_Postgresqlto8.4">\r
- <title>Upgrading PostgreSQL from 8.2 to 8.4 (if required)</title>\r
- <para>Evergreen 2.0 requires PostgreSQL version 8.4 or later.</para>\r
- <note><para>The order of the following steps is very important.</para></note><indexterm><primary>databases</primary><secondary>PostgreSQL</secondary></indexterm>\r
- <procedure>\r
- <step>\r
- <para>As <systemitem class="username">opensrf</systemitem>, stop the evergreen and opensrf services:</para>\r
- <screen><userinput>osrf_ctl.sh -l -a stop_all</userinput></screen>\r
- </step> \r
- <step>\r
- <para><link linkend="backingup">Backup the Evergreen database data</link></para>\r
- </step>\r
- <step>\r
- <para>Upgrade to Postgresql 8.4 by removing old version and installing Postgresql 8.4</para>\r
- </step>\r
- <step> \r
- <para>Create an empty Evergreen database in postgresql 8.4 by issuing the following commands as the postgres user:</para>\r
-<screen>\r
-<userinput>\r
-createdb -E UNICODE evergreen\r
+<section xml:id="upgrading_Postgresqlto9.0">\r
+ <title>Upgrading PostgreSQL from 8.4 to 9.0</title>\r
+ <simplesect>\r
+ <title>Upgrading PostgreSQL on Debian Squeez</title>\r
+ <procedure>\r
+ <step>\r
+ <para>Stop Evergreen and disconnect clients from database.</para>\r
+ </step> \r
+ <step>\r
+ <para>Add the following line to <filename>/etc/apt/sources.list</filename>:</para> \r
+<programlisting>\r
+deb http://www.backports.org/debian squeeze-backports main contrib non-free\r
+</programlisting>\r
+ </step>\r
+ <step>\r
+ <para>Update the sources list on your server.</para>\r
+<screen><userinput> \r
+apt-get update\r
+</userinput></screen>\r
+ </step>\r
+ <step>\r
+ <para>Backup your databases</para>\r
+<screen><userinput> \r
+$ pg_dump [db connect args] [db name] > evergreen-backup.sql\r
+</userinput></screen>\r
+ </step>\r
+ <step>\r
+ <para>Install PostgreSQL 9.0 as well as the client, contrib and plperl support packages.</para>\r
+<screen><userinput> \r
+apt-get -t squeeze-backports install postgresql-9.0 postgresql-client-9.0 postgresql-contrib-9.0 postgresql-plperl-9.0\r
+</userinput></screen>\r
+ </step>\r
+ <step>\r
+ <para>Drop the empty 9.0 cluster.</para>\r
+<screen><userinput> \r
+pg_dropcluster --stop 9.0 main\r
+</userinput></screen>\r
+ </step>\r
+ <step>\r
+ <para>Update the 8.4 cluster (with evergreen database) to 9.0</para>\r
+<screen><userinput> \r
+pg_upgradecluster 8.4 main\r
+</userinput></screen>\r
+ </step>\r
+ <step>\r
+ <para>Test by logging into psql, checking the postgrSQL version and running a simple SELECT query.</para>\r
+<screen><userinput> \r
+psql -U evergreen \r
+evergreen=# select version();\r
+evergreen=# select count(*) from biblio.record_entry;\r
+</userinput></screen>\r
+ </step>\r
+ <step>\r
+ <para>Restart Evergreen and Apache.</para>\r
+ </step>\r
+ <step>\r
+ <para>Drop old 8.4 cluster (optional).</para>\r
+<screen><userinput> \r
+pg_dropcluster 8.4 main\r
+</userinput></screen>\r
+ </step>\r
+ </procedure>\r
+ </simplesect>\r
+ <simplesect>\r
+ <title>Upgrading PostgreSQL on Ubuntu 10.04</title>\r
+ <procedure>\r
+ <step>\r
+ <para>Stop Evergreen and disconnect clients from database.</para>\r
+ </step> \r
+ <step>\r
+ <para>Add the backport repository to your repository sources list:</para> \r
+<programlisting>\r
+sudo add-apt-repository ppa:pitti/postgresql\r
+</programlisting>\r
+ </step>\r
+ <step>\r
+ <para>Update the sources list on your server.</para>\r
+<screen><userinput> \r
+apt-get update\r
+</userinput></screen>\r
+ </step>\r
+ <step>\r
+ <para>As the <systemitem class="username">postgres</systemitem> user, backup your PostgreSQL databases.</para>\r
+<screen><userinput><![CDATA[ \r
+pg_dumpall > data\r
+]]></userinput></screen>\r
+ </step>\r
+ <step>\r
+ <para>As <systemitem class="username">root</systemitem>, remove PostgreSQL 8.4 and install 9.0.</para>\r
+<screen><userinput> \r
+aptitude purge postgresql-8.4\r
+aptitude install postgresql-9.0 postgresql-client-9.0 postgresql-contrib-9.0 postgresql-plperl-9.0\r
+</userinput></screen>\r
+ </step>\r
+ <step>\r
+ <para>as the <systemitem class="username">postgres</systemitem> user, recreate empty evergreen databases with required language supports.</para>\r
+<screen><userinput>\r
+dropdb evergreen\r
+createdb -T template0 --lc-ctype=C --lc-collate=C -E UNICODE evergreen\r
createlang plperl evergreen\r
createlang plperlu evergreen\r
createlang plpgsql evergreen\r
-psql -f /usr/share/postgresql/8.4/contrib/tablefunc.sql evergreen\r
-psql -f /usr/share/postgresql/8.4/contrib/tsearch2.sql evergreen\r
-psql -f /usr/share/postgresql/8.4/contrib/pgxml.sql evergreen\r
-</userinput>\r
-</screen> \r
- </step>\r
- <step>\r
- <para>As the <systemitem class="username">postgres</systemitem> user on the PostgreSQL server, create a PostgreSQL user named <systemitem class="username">evergreen</systemitem> for the database cluster:</para>\r
- <screen><userinput>createuser -P -s evergreen</userinput></screen>\r
- <para>Enter the password for the new PostgreSQL superuser (<systemitem class="username">evergreen</systemitem>)</para> \r
- </step> \r
- <step>\r
- <para>Restore data from backup created in step 1.</para>\r
- </step>\r
- <step>\r
- <para>To point tsearch2 to proper function names in 8.4, run the SQL script \r
- <filename>/home/opensrf/Evergreen-ILS*/Open-ILS/src/sql/Pg/000.english.pg84.fts-config.sql</filename> using the <command>psql</command> command.</para>\r
- <screen><userinput>cd /home/opensrf/Evergreen-ILS*</userinput></screen>\r
- <screen><userinput>psql -f /Open-ILS/src/sql/Pg/000.english.pg84.fts-config.sql evergreen</userinput></screen>\r
- </step>\r
- <step>\r
- <para><link linkend="startingopensrf">Restart Evergreen and OpenSRF services</link></para>\r
- </step>\r
- <step>\r
- <para>For additional information regarding upgrading PostgreSQL, see the following documentation in PostgreSQL:</para>\r
- <para><ulink url="http://www.postgresql.org/docs/8.4/static/install-upgrading.html" /></para>\r
- <para><ulink url="http://www.postgresql.org/docs/8.4/interactive/textsearch-migration.html" /> \r
- </para>\r
- <para><ulink url="http://www.postgresql.org/docs/current/static/tsearch2.html#AEN102824" /></para>\r
- </step>\r
- </procedure>\r
+psql -f /usr/share/postgresql/9.0/contrib/tablefunc.sql evergreen\r
+psql -f /usr/share/postgresql/9.0/contrib/tsearch2.sql evergreen\r
+psql -f /usr/share/postgresql/9.0/contrib/pgxml.sql evergreen\r
+</userinput></screen>\r
+ </step>\r
+ <step>\r
+ <para>Update the 8.4 cluster (with evergreen database) to 9.0.</para>\r
+<screen><userinput> \r
+pg_upgradecluster 8.4 main\r
+</userinput></screen>\r
+ </step>\r
+ <step>\r
+ <para>as the <systemitem class="username">postgres</systemitem> user, load data from backup into PostgreSQL 9.0.</para>\r
+<screen><userinput><![CDATA[ \r
+psql < data\r
+]]></userinput></screen>\r
+ </step>\r
+ <step>\r
+ <para>Restart Evergreen and Apache.</para>\r
+ </step>\r
+ <step>\r
+ <para>Test by logging into psql, checking the postgrSQL version and running a simple SELECT query.</para>\r
+<screen><userinput> \r
+psql -U evergreen \r
+evergreen=# select version();\r
+evergreen=# select count(*) from biblio.record_entry;\r
+</userinput></screen>\r
+ </step>\r
+ </procedure>\r
+ </simplesect>\r
</section>\r
</chapter>\r