Top
Enterprise Postgres 17 Installation and Setup Guide for Server

4.3.2 Using the initdb Command

This section describes the procedure to create an instance using the initdb command.

Note

If a port is blocked (access permissions have not been granted) by a firewall, enable use of the port by granting access. Refer to the vendor document for information on how to grant port access permissions.
Consider the security risks carefully when opening ports.


4.3.2.1 Editing Kernel Parameters

Refer to "Appendix H Configuring Kernel Parameters" prior to editing these settings.

After the settings are complete, check the command specifications of the relevant operating system and restart the system if required.

4.3.2.2 Creating an Instance

Create an instance, with the database cluster storage destination specified in the PGDATA environment variable or in the -D option. Furthermore, the user that executed the initdb command becomes the instance administrator.

Note

  • Instances created using the initdb command (command line instances) can be managed using WebAdmin, however, they must first be imported into WebAdmin. Refer to "4.3.1.5 Importing Instances" for details.

  • If creating multiple instances, ensure that there is no duplication of port numbers or the directories that store database clusters.

See

Refer to "initdb" in "Reference" in the PostgreSQL Documentation for information on the initdb command.

The procedure to create an instance is described below.

  1. Use the OS user account that you want as the instance administrator.

    Connect with the server using the OS user account that you want as the instance administrator.

    You cannot use the OS superuser (root).

    The following example shows the OS superuser connected to the server being changed to the OS user account "fsepuser".

    Example
    # su fsepuser
  2. Configure the environment variables

    Configure the environment variables in the server with the newly created instance.

    Set the following environment variables:

    • PATH environment variables

      Add the installation directory "/bin".

    • MANPATH environment variables

      Add the installation directory "/share/man".

    Example

    The following example configures environment variables when the installation directory is "/opt/fsepv<x>server64".

    Note that "<x>" indicates the product version.

    sh, bash
    $ PATH=/opt/fsepv<x>server64/bin:$PATH ; export PATH
    $ MANPATH=/opt/fsepv<x>server64/share/man:$MANPATH ; export MANPATH
    csh, tcsh
    $ setenv PATH /opt/fsepv<x>server64/bin:$PATH
    $ setenv MANPATH /opt/fsepv<x>server64/share/man:$MANPATH
  3. Create a database cluster

    Create the database cluster with the initdb command, specifying the storage destination directory.

    Specify the transaction log storage destination and the locale setting option as required.

    Example
    $ initdb -D /database/inst1 --waldir=/transaction/inst1 --lc-collate="C" --lc-ctype="C" --encoding=UTF8

    Point

    In some features, instance names are requested, and those names are required to uniquely identify the instance within the system. These features allow names that conform to WebAdmin naming conventions, so refer to the following points when determining the names:

    • Maximum of 16 characters

    • The first character must be ASCII alphabetic character

    • The other characters must be ASCII alphanumeric characters

    Note

    • To balance I/O load, consider deploying the transaction log storage destination to a disk device other than the database cluster storage destination and the backup data storage destination.

    • Specify "C" or "POSIX" for collation and character category. Performance deteriorates if you specify a value other than "C" or "POSIX", although the behavior will follow the rules for particular languages, countries and regions. Furthermore, this may need to be revised when running applications on systems with different locales.
      For example, specify as follows:

      initdb --locale="C" --lc-messages="C"
      initdb --lc-collate="C" --lc-ctype="C"
    • Specify the same string in the LANG environment variable of the terminal that starts Fujitsu Enterprise Postgres as was specified in lc-messages of initdb (lc_messages of postgresql.conf). If the same string is not specified, messages displayed on the terminal that was started, as well as messages output to the log file specified in the -l option of the pg_ctl command or the postgres command used for startup, may not be output correctly.

    • Specify an encoding system other than SQL_ASCII for the database. If SQL_ASCII is used, there is no guarantee that the encryption system for data in the database will be consistent, depending on the application used to insert the data.

    See

    Refer to "Locale Support" in "Localization" in "Server Administration" in the PostgreSQL Documentation for information on locales.

  4. Set port number.

    Specify a port number in the port parameter of postgresql.conf. Ensure that the specified port number is not already used for other software. If a port number is not specified, "27500" is selected.

    Register the specified port numbers in the /etc/services file if WebAdmin is used to create other instances. WebAdmin uses the /etc/services file to check if port numbers specified as available candidates have been duplicated.

    Register any name as the service name.

  5. Set the corefile output destination.

    Specify the output destination of the corefile, which can later be used to collect information for investigation, by setting the core_directory and core_contents parameters of postgresql.conf.

    See

    Refer to "Parameters" in the Operation Guide for information on the settings for these parameters.

  6. Set the backup storage destination.

    Specify the backup data storage destination and other backup settings when backup is to be performed as a provision against database errors.

    See

    Refer to "Backup Methods" in the Operation Guide for information on specifying backup settings.

  7. Start an instance.

    Start with the start mode of the pg_ctl command.

    If either of the following conditions are met, the message "FATAL:the database system is starting up(11189)" may be output.

    • An application, command, or process connects to the database while the instance is starting

    • An instance was started without the -W option specified

    This message is output by the pg_ctl command to check if the instance has started successfully.
    Therefore, ignore this message if there are no other applications, commands, or processes that connect to the database.

    Example
     $ pg_ctl start -D /database/inst1

    See

    Refer to "pg_ctl" in "Reference" in the PostgreSQL Documentation for information on the pg_ctl command.

    Note

    If the -W option is specified, the command will return without waiting for the instance to start. Therefore, it may be unclear as to whether instance startup was successful or failed.