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.
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 cannot be managed using WebAdmin.
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.
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.
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 installDir\bin and installDir\lib.
The following is a setting example for environment variables in which "C:\Program Files\Fujitsu\symfoserver64" is used as the installation folder:
> SET PATH=C:\Program Files\Fujitsu\symfoserver64\bin;C:\Program Files\Fujitsu\symfoserver64\lib;%PATH%
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.
> initdb -D D:\database\inst1 --xlogdir=E:\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.
Messages may not display correctly if a value other than "C" is specified as the display language for messages.
Specify "C" for collation and character category. Performance deteriorates if you specify a value other than "C" , 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 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.
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, "26500" is selected.
Register the specified port numbers in the /etc/services file if WebAdmin is used to create other instances. WebAdmin uses the services file to check if port numbers specified as available candidates have been duplicated.
Register any name as the service name.
Note
Make a note of the port number for use in the Windows firewall settings.
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.
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.
Registering an instance in the Windows service
Use the register mode of the pg_ctl command to register an instance in the Windows service.
Specify the service name, user name, password and path to the instance in the pg_ctl command, and register the instance in the Windows service.
The following is a setting example, in which the service name to register is "inst1", the user name is "symfo", and the storage destination directory of the database cluster is "D:\database\inst1":
> pg_ctl register -N "inst1" -U symfo -P ******** -D D:\database\inst1 -w
Note
Registration should be performed by an instance administrator with "Administrator" privileges.
For the following reasons, a user name and password must always be specified:
Because the Windows service is started up by the Network Service account, all user resources are created as resources of that account. This can result in error events such as failing to access database resources and not being able to perform backups/recovery.
Note that if not specifying a user name and password for security reasons, you should specify the account from the Windows services list immediately after registering the instance in Windows services.
When entering the password that is specified in the pg_ctl command, for security reasons, you should be careful not to allow other users to access it.
This completes registration of an instance in the Windows service.
Commands such as sc query can be used to check the registration status.
Starting an instance
Use the following procedure to start the service:
Display the [Services] window.
In Windows, select [Administrative Tools], and then click [Services].
Start the service
From the services list, select the instance name that you wish to start, and click [Start Service].
If using commands to start the service, specify the service name using either the net start command or sc start command from the command prompt.