简体   繁体   中英

Moqui 1.4.1 Postgresql Configuration

I am trying to get the Moqui 1.4.1 release up and running but using Postgres as the database platform. Here are the platform details.


The MoquiDefaultConf.xml file is in the pre-built executable war file if you downloaded the binary release, though you can see it here in the source repo:

https://github.com/moqui/moqui/blob/master/framework/src/main/resources/MoquiDefaultConf.xml

In there you will see an example configuration for Postgres:

    <datasource group-name="transactional" database-conf-name="postgres" schema-name="public" startup-add-missing="true" runtime-add-missing="false">
        <inline-jdbc pool-minsize="5" pool-maxsize="50">
            <xa-properties user="moqui" password="moqui" serverName="localhost" portNumber="5432"
                           databaseName="MoquiDEFAULT"/>
        </inline-jdbc>
        <!-- <inline-jdbc jdbc-uri="jdbc:postgresql://127.0.0.1/MoquiDEFAULT"
                jdbc-username="moqui" jdbc-password="moqui" pool-minsize="2" pool-maxsize="50"/> -->
    </datasource>

Note especially these two attributes on the datasource element: startup-add-missing="true" runtime-add-missing="false". Postgres does not support creating tables on the fly, so they all have to be created before the system gets running instead of the default mode which is to create tables only as they are needed (when the first write is done).

The MoquiDefaultConf.xml file also has a definition for the "tenantcommon" entity group, pointing it to Derby:

    <datasource group-name="tenantcommon" database-conf-name="derby" schema-name="MOQUI">
        <inline-jdbc pool-minsize="2" pool-maxsize="10">
            <xa-properties databaseName="${moqui.runtime}/db/derby/MoquiDEFAULT" createDatabase="create"/>
        </inline-jdbc>
    </datasource>

To put those entities in Postgres as well you'll need to add a similar definition to the Moqui Conf XML file used at runtime.

Use this config inside entity-facade tag in MoquiDevConf.xml or MoquiProductionConf.xml

<datasource group-name="transactional" database-conf-name="postgres" schema-name="public" startup-add-missing="true" runtime-add-missing="false">
        <inline-jdbc jdbc-uri="jdbc:postgresql://localhost/dbname" jdbc-username="postgres" jdbc-password="pass"/>
</datasource>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM