Run Confluence on custom schema on PostgreSQL

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Fisheye および Crucible は除く

    

要約

Occasionally a Confluence admin may need to use a custom schema on PostgreSQL to store Confluence's objects - a DB migration, for example.   Out-of-the-box, PostgreSQL will place/look for any database objects on its default schema: public.  An admin can make both PostgreSQL and Confluence use a custom schema to place those objects.

環境

PostgreSQL (9.6, 10, 11)

Confluence Server/DC 6.13, 7.4

ソリューション

Confluence side

To ensure your application (Confluence) will have its objects stored on a different schema, you need to add a parameter to the JDBC connection string.

 Add the property below to your <confluence_home_dir>/confluence.cfg.xml (or to your <confluence_install_dir>/conf/server.xml if you're delegating Confluence's database connection pool to Tomcat's datasource):

?currentSchema=<schema name>

例:

Confluence new installation:

Confluence existing installation:

Change confluence.cfg.xml file to use the custom schema:

<property name="hibernate.connection.url">jdbc:postgresql://localhost:5432/conf1317?currentSchema=osi</property>

Or server.xml, if that's the case:

url="jdbc:postgresql://localhost:5432/confluence?currentSchema=osi"


PostgreSQL side

search_path

However, to make it work you'll need also to inform PostgreSQL of where it should store and look for the application's database objects.
To do so you'll want to change your database's default search path:

conf1317=# ALTER DATABASE conf1317 SET search_path TO osi;

Otherwise, PostgreSQL will keep looking for the database objects on the default search path (public) and you'll keep getting "Table not found" kind of errors.

Depending on how the update of the default public schema is implemented, be careful not to update values within the Confluence tables themselves.  For instance, the KEYSTORE table typically stores two records with one having a TYPE value of public and the other private.  If the former is accidentally updated to the custom schema name, then Gadget functionality will subsequently break and result in the return of an HTTP 500 code. 


要約

Essentially you need to ensure that:

  1. All Confluence objects are residing on the schema of your choice (if you're migrating your objects to a custom schema). In a new installation if all settings above are correct, they'll be created there.
  2. Confluence knows that it should use this schema (currentSchema parameter)
  3. PostgreSQL knows that it should use this schema (search_path adjustment)




最終更新日 2022 年 11 月 17 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.