Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Sv translation
languageen


Section


Column

Preface

Info
iconfalse

These instructions will help you connect the BellaDati application to a PostgreSQL database.

We recommend using database engines  engine PostgreSQL 9.4 or PostgreSQL 9.5. Starting BellaDati version 2.9.3.5 PostgreSQL 9.6 database engine is tested and recommended too.12. This database engine is supported now.

PostgreSQL 12 is supported starting from BellaDati 2.10 release.



Column
width300px


Panel

On this page:

Table of Contents
maxLevel4
minLevel1



Create and Configure the PostgreSQL Database

Warning
titleSetup the pg_hba.conf file to allow accessing the database via TCP socket. Here is an example:


Code Block
host belladati_db belladati_dbuser 0.0.0.0/0 md5

 



  1. Create a database user which BellaDati will connect as (e.g. belladati_dbuser). Remember this database user name, as it will be used to configure BellaDati's connection to this database in subsequent steps. Do not forget to configure the pg_hba.conf file, which controls the database access.

    Code Block
    $ createuser -sDRP belladati_dbuser


  2. Create a database for BellaDati to be used as data warehouse (e.g. belladati_db) with Unicode collation.

    Code Block
    CREATE DATABASE belladati_db WITH ENCODING 'UNICODE' TEMPLATE template0;

    Or from the command-line:

    Code Block
    $ createdb -E UNICODE -O belladati_dbuser belladati_db -T template0


  3. Ensure that the user has permissions to connect to the database, and to create and write to tables in the database.

  4. Warning
    titleStep 4 can be skipped for PostgreSQL 10 and above

    Check if your database has the plpgsql language. If not, you can define it using

    this command

    command below(template0 has plpgsql installed so belladati_db database inherits it:

    Code Block
    CREATE LANGUAGE plpgsql

    Or from the command line (this option is no longer available since PostgreSQL 10. Use command above):

    Code Block
    $ createlang -U belladati_dbuser plpgsql belladati_db


    Note

    When using the default PostgreSQL configuration file pg_hba.conf, you have to execute this command by connecting via TCP socket:
    createlang -h 127.0.0.1 -U belladati_dbuser plpgsql belladati_db




Info

Remember the database name; it will be used to configure BellaDati's connection to the database in subsequent stepsthe applications server configuration.

PostgreSQL configuration

We strongly recommend performing the following PostgreSQL configuration changes in $POSTGRES_HOME/data/postgresql.conf. This example specifies parameters when you run the BellaDati application and database on a single server with 4GB memory. 2GB are allocated for the BellaDati application server running on Java (using the -Xmx parameter). The rest should be available for the operating system and database server.

Warning

This configuration may change according to real usage needs.

Example below shows the minimal configuration for single server installation.


    

Name

Value

Description

Note

max_connections

50

Sets the maximum number of concurrent connections.


shared_buffers

512MB

Sets the number of shared memory buffers used by the server.

min 1/4 RAM, 1/2 RAM recommended

temp_buffers

2MB

Sets the maximum number of temporary buffers used by each session.

per session

work_mem

16MB

Sets the maximum memory to be used for query workspaces.

min 16MB, RAM / 128 recommended

maintenance_work_mem

64MB

Sets the maximum memory to be used for maintenance operations.

min 64MB, RAM / 32 recommeneded

max_stack_depth

2MB

Sets the maximum stack depth, in kilobytes.


wal_buffers

512kB

Sets the number of disk-page buffers in shared memory for WAL.


effective_cache_size

512MB1024MB

Sets the planner's assumption about the size of the disk cache.

 RAM / 2 recommended

log_statement

none

Sets the type of statements logged.


autovacuumonStarts the autovacuum subprocess. 
autovacuum_analyze_scale_factor0.05Number of tuple inserts, updates, or deletes prior to analyze as a fraction of reltuples. 
autovacuum_analyze_threshold10Minimum number of tuple inserts, updates, or deletes prior to analyze. 
autovacuum_freeze_max_age200000000Age at which to autovacuum a table to prevent transaction ID wraparound. 
autovacuum_max_workers5Sets the maximum number of simultaneously running autovacuum worker processes. 
autovacuum_multixact_freeze_max_age400000000Multixact age at which to autovacuum a table to prevent multixact wraparound. 
autovacuum_naptime15sTime to sleep between autovacuum runs. 
autovacuum_vacuum_cost_delay10msVacuum cost delay in milliseconds, for autovacuum. 
autovacuum_vacuum_cost_limit1000Vacuum cost amount available before napping, for autovacuum. 
autovacuum_vacuum_scale_factor0.1Number of tuple updates or deletes prior to vacuum as a fraction of reltuples. 
autovacuum_vacuum_threshold25Minimum number of tuple updates or deletes prior to vacuum. 


Info

We recommend set the archive_mode parameter to off, using the pg_dump command instead.

Backup and restore

You can backup the BellaDati database using the PostgreSQL dump command:

Code Block
pg_dump -U user -F c -v -f "path_to_dump/dump.backup" belladati_db

To restore a backup, use the pg_restore command:

Code Block
pg_restore -v -c -O -d belladati_db -U user path_to_dump/dump.backup

Next steps

Installing BellaDati on Linux - continue  Installing BellaDati on Linux HIDDEN OLD, step "check that default ports"

 


Installing BellaDati WAR

continue installing the BellaDati.war application on your application server as described in:

 


Sv translation
languageja


Section


Column


Info

BellaDatiアプリケーションとPostgreSQLデータベースを接続するための手順を説明します。

これらの案内は、PostgreSQL 8.4+データベースにBellaDatiを接続するのに役立ちます。9.4または以上バージョンを使用することをお勧めします。このドキュメントはBellaDati WAR向けに使用されます。

始める前に

別のサーバーにBellaDatiの移行

別のサーバーにBellaDatiを移行する場合は、XMLバックアップとしてデータのエクスポートを作成します。次に、新しいデータベースに古いデータベースからデータを転送することができるようになります。

データベースエンジンPostgreSQL 12の使用を推奨します。このデータベースエンジンは現在サポートされています。

PostgreSQL 12は、BellaDati 2.10リリースからサポートされています。


Column
width300px


Panel

On this page:

Table of Contents
maxLevel4
minLevel1



PostgreSQLのデータベース作成と設定

Warning
titleTCPソケットを介してデータベースにアクセスできるようにpgTCPソケットでデータベースにアクセスできるようにpg_hba.confファイルを設定します。次に例 アイコンconfファイルを設定します。以下はその例です。


Code Block
host belladati_db belladati_dbuser 0.0.0.0/0 md5

 



  1. BellaDatiが接続するためのデータベースユーザー(例えばbelladatiBellaDatiが接続するデータベースユーザー(例:belladati_dbuser)を作成します。その後の工程でこのデータベースへのBellaDatiの接続を設定するためにこのデータベース・ユーザー名を覚えておいてください。データベースへのアクセスを制御するpg)を作成します。このデータベースユーザー名は、以降のステップでBellaDatiのこのデータベースへの接続を設定するために使用されますので、覚えておいてください。データベースへのアクセスを制御するpg_hba.confファイルを設定することを忘れないでください。confファイルの設定も忘れずに行ってください。

    Code Block
    $ createuser -SDRP belladati_dbuser


  2. Unicode照合順序で(例えばbelladati_db)データ・ウェアハウスとしてBellaDatiが使用するためのデータベースを作成します。

    Code Block
    CREATE DATABASE belladati_db WITH ENCODING 'UNICODE' TEMPLATE template0;

    または以下のコマンド行:または以下のコマンドライン:

    Code Block
    $ createdb -E UNICODE -O belladati_dbuser belladati_db -T template0


  3.  ユーザーがデータベースに接続する権限を持って、データベース内のテーブルに作成する及び書き込めることを確認してください

  4. Warning

    PostgreSQL 10 以降では、ステップ 4 は省略可能です。

    データベースがplpgsql言語を持っているかどうかを確認してください。ない場合は、このコマンドを使用して定義できます。

    Code Block
    CREATE LANGUAGE plpgsql

    または以下にコマンド行から

    Code Block
    $ createlang -U belladati_dbuser plpgsql belladati_db


Note

pg_hba.confファイル構成のPostgreSQLデフォルトを使用するときは、TCPソケット経由で接続することによりこのコマンドを実行する必要があります。
createlang -h 127.0.0.1 -U belladati_dbuser plpgsql belladati_db


Info

データベース名を覚えておいてください。以降のデータベースへのBellaDatiの接続を設定するために使用されます。

PostgreSQL構成

私たちは次のように$POSTGRES_HOME/data/postgresql.confにPostgreSQL構成の変更を行うことを強くお勧めします。この例では、4GBのメモリを備えた単一のサーバー上でBellaDatiアプリケーションとデータベースを実行する時にパラメータを指定します。 2GB以上(-Xmxパラメータを使用)は、Java上で動作しているBellaDatiアプリケーション・サーバー用に指定します。残りは、オペレーティングシステム及びデータベース・サーバに利用可能であるべきです。

Warning

この構成は、実際の使用状況のニーズに応じて変更されることがあります。

次の例では、単一サーバーインストールの最小限の構成を示します。


名前

説明

備考

max_connections

50

同時接続の最大数を設定すること 


shared_buffers

512MB

サーバにより使用した共有メモリバッファの数を設定すること

min 1/4 RAM, 1/2 RAM recommended

temp_buffers

2MB

各セッションが使用した一時バッファの最大数を設定すること。

セッションごと

work_mem

10MB16MB

クエリーワークスペースのために使用される最大メモリを設定すること。

クライアント接続ごと16MB以上、RAM128推奨

maintenance_work_mem

64MB

保守作業のために使用される最大メモリを設定すること。

 64MB以上、RAM32以上推奨

max_stack_depth

2MB

単位の最大スタックの深さを設定すること。

 


wal_buffers

512kB

WAL向けの共有したメモリにディスクページバッファの数を設定すること。 


effective_cache_size

512MB1024MB

ディスクキャッシュのサイズに関するプランナの推測を設定すること。

 RAM / 2を推奨

log_statement

none

ログしたステートメントタイプを設定すること。 


autovacuumon自動バキュームサブプロセスを起動すること。 
autovacuum_analyze_scale_factor0.05タプル挿入、更新数、またはreltuplesの一部として分析する前に削除すること。 
autovacuum_analyze_threshold10タプル挿入、更新の最小数、または分析の前に削除される事。 
autovacuum_freeze_max_age200000000トランザクションIDの周回を防ぐためにテーブルを自動バキュームする年齢です。 
autovacuum_max_workers5同時に実行されている自動バキュームワーカー・プロセスの最大数を設定すること。 
autovacuum_multixact_freeze_max_age400000000

周回を防ぐためにテーブルを自動バキュームするMultixact

年齢です。 

autovacuum_naptime15s自動バキューム実行の間にスリープ時間です 
autovacuum_vacuum_cost_delay10ms自動バキューム用ミリ秒に延長バキュームコストです。 
autovacuum_vacuum_cost_limit1000自動バキュームのため、昼寝前に使用可能なバキュームコストです 
autovacuum_vacuum_scale_factor0.1reltuplesの一部として真空の前に削除するまたはタプル更新数です。 
autovacuum_vacuum_threshold25真空の前に削除するまたはタプル更新の最小回数 


Info

代わりのpg_dumpコマンドを使用して、archive_modeパラメータをオフに設定することをお勧めします。

バックアップと復元

PostgreSQLのダンプ・コマンドを使用することでBellaDatiデータベースをバックアップできます:

Code Block
pg_dump -U user -F c -v -f "path_to_dump/dump.backup" belladati_db

バックアップを復元するには、pg_restoreのコマンドを使用します

Code Block
pg_restore -v -c -O -d belladati_db -U user path_to_dump/dump.backup

次のステップ

Installing BellaDati on Linux - continue  Installing BellaDati on Linux, step "check that default ports"

Installing BellaDati WAR

以下の説明したように、アプリケーションサーバー上でBellaDati WARの設定を続行します。