| 1 | = Moving !GeoNetwork from MySQL to Postgres = |
| 2 | |
| 3 | Author : Heikki Doeleman |
| 4 | |
| 5 | This page describes steps taken to move from a MySQL-based installation to aPostgres-based installation. The Postgres version used is 8.3.5. |
| 6 | |
| 7 | |
| 8 | === Postgres configuration for command line and JDBC access === |
| 9 | |
| 10 | Depending on your Postgres installation, you may need to make some changes to allow for command line access and to allow for !GeoNetwork's JDBC connection. |
| 11 | |
| 12 | I changed : |
| 13 | |
| 14 | {{{ |
| 15 | /var/lib/pgsql/data/pg_hba.conf |
| 16 | }}} |
| 17 | |
| 18 | such that now it contains : |
| 19 | |
| 20 | {{{ |
| 21 | local all all trust |
| 22 | host all 127.0.0.1/32 trust |
| 23 | host all all 127.0.0.1/32 ident sameuser |
| 24 | host all all 127.0.0.1 255.0.0.0 trust |
| 25 | host all all 127.0.0.1/32 md5 |
| 26 | |
| 27 | }}} |
| 28 | |
| 29 | (for an explanation of stuff in this file, see [http://developer.postgresql.org/pgdocs/postgres/auth-pg-hba-conf.html The pg_hba.conf file]). |
| 30 | |
| 31 | And I changed |
| 32 | |
| 33 | {{{ |
| 34 | /var/lib/pgsql/data/postgresql.conf |
| 35 | }}} |
| 36 | |
| 37 | uncommenting the lines |
| 38 | |
| 39 | {{{ |
| 40 | listen_addresses = 'localhost' |
| 41 | port = 5432 |
| 42 | }}} |
| 43 | |
| 44 | These latter changes require a restart of Postgres. This you can do by issuing : |
| 45 | |
| 46 | {{{ |
| 47 | . /etc/init.d/postgresql stop |
| 48 | . /etc/init.d/postgresql start |
| 49 | }}} |
| 50 | |
| 51 | |
| 52 | === creating a database and user === |
| 53 | |
| 54 | To create a database and user you can issue the following commands : |
| 55 | |
| 56 | {{{ |
| 57 | }}} |
| 58 | |
| 59 | |
| 60 | === config.xml === |
| 61 | |
| 62 | !GeoNetwork's config.xml needs to be changed to add Postgres JDBC connection settings : |
| 63 | |
| 64 | {{{ |
| 65 | <!-- - - - - - --> |
| 66 | <!-- postgres --> |
| 67 | <!-- - - - - - --> |
| 68 | <resource enabled="true"> |
| 69 | <name>main-db</name> |
| 70 | <provider>jeeves.resources.dbms.DbmsPool</provider> |
| 71 | <config> |
| 72 | <user>username</user> |
| 73 | <password>password</password> |
| 74 | <driver>org.postgresql.Driver</driver> |
| 75 | <url>jdbc:postgresql://127.0.0.1:5432/geonetwork</url> |
| 76 | <poolSize>10</poolSize> |
| 77 | </config> |
| 78 | </resource> |
| 79 | |
| 80 | }}} |
| 81 | |
| 82 | |
| 83 | === Database create scripts === |
| 84 | |
| 85 | TODO describe the changes |
| 86 | |
| 87 | === Exporting existing data from MySQL and importing it into Postgres === |
| 88 | |
| 89 | TODO describe the process |
| 90 | |
| 91 | === Links to related information === |
| 92 | |
| 93 | [http://wiki.postgresql.org/wiki/Converting_from_other_Databases_to_PostgreSQL Converting from other Databases to PostgreSQL] |
| 94 | |
| 95 | [http://en.wikibooks.org/wiki/Programming:Converting_MySQL_to_PostgreSQL Converting MySQL to PostgreSQL] |
| 96 | |
| 97 | [http://www.pageofguh.org/technicality/584 MIGRATING A DATABASE FROM MYSQL 5 TO POSTGRESQL 8] |
| 98 | |
| 99 | [http://www.markslade.name/Articles.html?a=9 Converting from MySQL to PostgreSQL] |
| 100 | |
| 101 | [http://www.sitepoint.com/article/site-mysql-postgresql-1/ Migrate your site from MySQL to PostgreSQL] |
| 102 | |