How to use PostgreSQL instead of HyperSQL?

Hi,

First off, thanks to the great XWiki team for all the great efforts.
I just tried to use the ZIP package to install XWiki on Ubuntu Linux (16.04) for my company.
It makes mention of setting up a HyperSQL database.
Do you recommend using PostgreSQL instead?
How to switch to PostgreSQL if necessary?
I searched and found some info at http://www.xwiki.org/xwiki/bin/view/Documentation/AdminGuide/Installation/InstallationWAR/InstallationPostgreSQL/
Is it the right place for me to go to make that change?

Thank everyone for your help.

Using HyperSQL database (at least the way it’s configured in the zip package) is really not a good idea in production because the whole database ends up in the RAM. We (on xwiki.org servers) usually use MySQL but many people use Postgres too.

On Ubuntu I would recommend to use the Debian packages (MySQL and PostgreSQL based packages are provided). See http://platform.xwiki.org/xwiki/bin/view/AdminGuide/InstallationViaAPT for more details.

1 Like

Thank you very much, Thomas.
Actually I did start my installation there but somehow ended in failure after running “sudo apt-get install xwiki-tomcat8-pgsql”.
That’s why I later tried to use the ZIP package, instead, and finally succeeded.
Now XWiki is up and running but I’d like to know how to switch it to the PostgreSQL database without reinstallation.
Isn’t it possible?

To change the database used by XWiki you can take a look at http://www.xwiki.org/xwiki/bin/view/Documentation/AdminGuide/Installation/InstallationWAR/InstallationPostgreSQL/#HManualInstallation. On XWiki side it mostly involves modifying WEB-INF/hibernate.cfg.xml.

If you want to keep the existing data you have you can take a do what is indicated on http://www.xwiki.org/xwiki/bin/view/Documentation/AdminGuide/Upgrade#HAlternative:ExportandReimport (export everything from the hqldb based instance in XAR format and then import it on the postgresql instance).

Would be great if you could indicate the error you got to see if it’s something on fix on XWiki package side. Note that the Tomcat version that comes with 16.04 by default has a bug, see http://www.xwiki.org/xwiki/bin/view/Documentation/AdminGuide/Installation/InstallationViaAPT/#HUbuntu16.0428XenialXerus29 for more details. Debian package also makes XWiki a lot easier to upgrade so you might want to consider trying again :wink:

1 Like

Thanks a lot for your help, Thomas.

I made up my mind to start over using the Debian packages and chose PostgreSQL.
Probably because I already got PostgreSQL configuration right when I last tried to install PostgreSQL manually, I didn’t meet any issue with PostgreSQL running “sudo apt-get install xwiki-tomcat8-pgsql” this time.
Now it’s back up and running again.
In this case, where does database setting reside?
I no longer have to check into the WEB-INF/hibernate.cfg.xml file to make sure it’s as the Manual PostgreSQL Installation Guide says, right?
(I did check but found it’s not like that. I thought it’d be set like that automatically in this case.)
How can I make sure it’s indeed using PostgreSQL?

As to the bug with Tomcat, can’t we just use Tomcat 9?
(If yes, how?)

When you use the Debian package all the XWiki configuration files end up in /etc/xwiki/. You can see more details on http://www.xwiki.org/xwiki/bin/view/Documentation/AdminGuide/Installation/InstallationViaAPT/#HOverviewoftheimportantfiles.

If you install the pgsql package then the database setup should be all OK. At least nobody reported any issue with it recently :slight_smile:

Tomcat 9 is not available yet on Debian/Ubuntu repositories. There is a workaround for Tomcat 8 indicated on http://www.xwiki.org/xwiki/bin/view/Documentation/AdminGuide/Installation/InstallationViaAPT/#HUbuntu16.0428XenialXerus29. Another possibility is to use Tomcat 7.

Speaking about Tomcat don’t forget to take a look at http://www.xwiki.org/xwiki/bin/view/Documentation/AdminGuide/Installation/InstallationViaAPT/#HTomcatUsability.

1 Like

:grinning:
Thank you again for all your guidance.
I chose the demo flavor and browsed through the user guide and admin guide to get an understanding of all the basics.
Now I am about to start creating content for my team and company.
Since the home page has been prepopulated with information on how to get started etc. by default, if I would like to keep these pieces somewhere else for first-time users’ reference instead of deleting them all at once, what would you suggest I do with it to start creating my own content?

You could rename the home page somewhere else and link to it in your new home page maybe.

1 Like