Top
Symfoware Server V12.1.0 Cluster Operation Guide
FUJITSU Software

8.3.2 Creating, Setting, and Registering the Primary Server Instance

This section explains how to create, set, and register the primary server instance.

Note

  • Mirroring Controller supports instances that are registered in the Windows service.

  • When the database multiplexing mode is used, instances cannot be used together with WebAdmin.
    Additionally, an instance that has run the database multiplexing mode cannot be accessed from WebAdmin, even if the database multiplexing mode is stopped and changed to the single server mode.

See

  • Refer to "Client Authentication" in the PostgreSQL Documentation for information on the pg_hba.conf file.

  • Refer to "A.1 Parameters Set on the Primary Server" for information on the postgresql.conf file.

  • Refer to "mc_ctl" in Reference for information on the command.

Perform the following procedure:

  1. Refer to "Setup" in the Installation and Setup Guide for Server, and then perform the Symfoware Server setup and create the Symfoware Server instance.

    • Use ASCII characters in the data storage destination directory.

    • When registering an instance to the Windows service, perform the settings required to enable Mirroring Controller to start and stop the instance. Execute the pg_ctl command with the following specified for the register mode:

      • For the service name of the -N option, specify the name set for the db_instance_service_name parameter in the server definition file

      • Specify "demand" for the -S option, so that the service does not start automatically on startup of the system

      • Specify the -w option, so that the system waits for the start or stop process to complete

    Note

    Do not configure the Windows service of a multiplexed instance to perform automatic start, as it is started by Mirroring Controller.

  2. Configure the encryption settings for the storage data.

    Create the keystore file.

    Refer to "Database Multiplexing Mode" in the Operation Guide for details, and then configure the settings.

  3. Add the following entry to the pg_hba.conf file to authenticate connections from the standby server.

    Copy the file to the standby server later.

    # TYPE    DATABASE        USER        ADDRESS                       METHOD
      host    replication     symfo       standbyServerAddress       authenticationMethod
      host    replication     symfo       primaryServerAddress       authenticationMethod

    For the primary and standby server addresses, specify the IP address that will connect to the log transfer network.

    Additionally, all servers can be used as the primary server or the standby server, so add entries for the addresses of all servers that comprise the database multiplexing system.

    As the authentication method, set a method other than trust authentication.

    If the primary server becomes the standby server, to perform automatic authentication of connections to the primary server, create a password file (%APPDATA%postgresql\pgpass.conf), and then specify a password for the replication database. Accordingly, the instance administrator operating system user and the user registered in the database will be the same, so you can verify that the connection was not made by an unknown user. Additionally, the password that was set beforehand will be used in the authentication, so that the connection will be automatic.

    Note that you do not need to create the password file if the -P option is specified for the mc_ctl command in setup mode when building a standby server.

    Note

    If trust authentication is set, all OS users who can log in to the primary server will be able to connect, and if one of these is a malicious user, then that user can corrupt the standby server data, or cause the job system to fail, by sending an erroneous transaction log. Refer to "Authentication Methods" in the PostgreSQL Documentation for details on the authentication methods that can be set.

  4. Configure this setting to enable the instance administrator user of the primary server to connect as a database application.

    This setting enables the connection to the instance using the user name of the instance administrator user, so that Mirroring Controller can monitor instance errors. Configure this setting to enable the connection to the postgres database.

    As the authentication method, set a method other than trust authentication.

    • If password authentication is used

      In the db_instance_password parameter of the serverIdentifier.conf file, specify the password for the instance administrator user. This password is used to connect to the database instance. If a password is not specified in the db_instance_password parameter, the connection to the database instance from Mirroring Controller will fail, and it will not be possible to perform the process monitoring of the instance.

    • If password authentication is not used

      There is no need to specify the password in the db_instance_password parameter.

      Even if the password for the instance administrator user is specified in the db_instance_password parameter, it will be ignored.

    An example of setting the authentication method is shown below.

    # TYPE    DATABASE        USER        ADDRESS        METHOD
      host    postgres        symfo       127.0.0.1/32   authenticationMethod

    Refer to the note in step 3 for notes relating to trust authentication.

  5. To use database multiplexing mode, specify the parameters shown in the table below in the postgresql.conf file.

    The postgresql.conf file is copied when the standby server instance is created. Accordingly, set the required parameters in the standby server.

    To use database multiplexing mode, specify the parameters shown in the table below in the postgresql.conf file. After editing the postgresql.conf file, restart the instance.

    Table 8.2 Parameters

    Parameter

    Content specified

    Remarks

    wal_level

    Literal "hot_standby"

    max_wal_senders

    Number of standby servers + 1

    The number of standby servers (n) is 1, so 2 must be specified.

    synchronous_standby_names

    'standbyServerName'

    Specify the name that will identify the standby server.

    Enclose the name within single quotation marks (').

    The value specified for this parameter must also be specified in the --standby-name parameter when the mc_ctl command is executed in setup mode.

    Do not change this parameter while Mirroring Controller is running.

    hot_standby

    on

    Specify this to execute reference jobs on the standby server. (*1)

    wal_receiver_status_interval

    Time interval (seconds)

    This value must be smaller than the value set for replication_timeout in the postgresql.conf file of the primary server.

    wal_keep_segments

    Number of file segments

    If a delay exceeding the value set in this parameter occurs, the WAL segment required later by the primary server may be deleted.

    Additionally, if you stop a standby server (for maintenance, for example), consider the stop time and set a value that will not cause the WAL segment to be deleted.

    Setting this parameter requires consideration regarding stabilization of the database multiplexing mode (refer to "8.9.1 Tuning to Stabilize the Database Multiplexing Mode" for details).

    Refer to "Estimating Transaction Log Space Requirements" in the Installation and Setup Guide for Server for information on estimating the WAL segment.

    replication_timeout

    Timeout (seconds)

    Specify the time period after which it is determined that an error has occurred in the transaction log transfer.

    By aligning this value with the value of (heartbeat_interval + heartbeat_timeout) x heartbeat_retry of the serverIdentifier.conf file, you can unify the time after which it is determined that an error has occurred.

    archive_mode

    on

    Specify the archive log mode.

    archive_command

    'cmd /c ""installDir\\bin\\pgx_xlogcopy.cmd" "%p" "backupDataStorageDestinationDir\\archived_xlog\\%f""'

    Specify the command and storage destination to save the transaction log.

    backup_destination

    Backup data storage destination directory

    Specify the name of directory where to store the backup data.

    Set the privileges so that only the instance administrator user can access the specified directory.

    Specify the same full path on all servers, so that the backup data of other servers can be used to perform recovery.

    max_connections

    The limit value for the number of standby server connections + number of simultaneous executions of mc_ctl status (*2) + 2 + number of simultaneous client connections to the instance + superuser_reserved_connections

    The value specified is also used to restrict the number of connections from client applications and the number of connections for the management of instances.

    Refer to "When an Instance was Created with the initdb Command" in the Installation and Setup Guide for Server, and "Connections and Authentication" in the PostgreSQL Documentation, for details.

    *1: Used in the Mirroring Controller option feature.

    *2: Number of simultaneous executions of the mc_ctl command in the status mode.

  6. Start the Mirroring Controller process.

    When the Mirroring Controller option is used

    As the instance administrator user, execute the mc_ctl command in start mode with the -f option specified. This enables automatic switch or disconnection.

    If you start Mirroring Controller and the instance without specifying the -f option, automatic switch and disconnection will not be enabled. To enable both, start Mirroring Controller and then execute the mc_ctl command in enable-failover mode, or restart Mirroring Controller with the -f option specified.

    Example)
    > mc_ctl start -M D:\mcdir\inst1 -w -f
    When the Mirroring Controller option is not used

    As the instance administrator user, execute the mc_ctl command in start mode.

    Example)
    > mc_ctl start -M D:\mcdir\inst1 -w
  7. Obtain the backup.

    Use the pgx_dmpall command to collect the backup.