Database Cluster
This section guides you through the process of quickly setting up a PostgreSQL cluster with ECOX.
Note
Unless otherwise specified, the following operations should be performed on all database cluster nodes.
Hostname Resolution
This step is optional. To enable hostname resolution without DNS, add the
node IPs and names to /etc/hosts as follows:
cat <<EOF | sudo tee -a /etc/hosts
10.9.5.5 dcs01
10.9.5.6 dcs02
10.9.5.9 dcs03
10.9.9.68 ecox01
10.9.9.69 ecox02
10.9.9.70 ecox03
EOF
Create User
Databases generally do not support running under privileged accounts (root),
so a standard user account is necessary. The commands below create the
postgres user and group to run ECOX and the database instance. If a
postgres user already exists from a previous installation (e.g., via a
package manager), you can utilize that account instead.
Install PostgreSQL and ECOX
This guide assumes that PostgreSQL and ECOX are already installed. For installation steps, please consult the official PostgreSQL website and the ECOX installation guide.
Create Configuration File
The ECOX package provides a sample configuration file. Copy this template to create your initial configuration.
The example below shows a standard ECOX configuration. Ensure you modify node-specific values (such as node name, IP address) on each of the three servers.
Note
- If hostname resolution is not configured, you must use IP addresses for
dcs.hostsandglobal.pg_conninfo. - If VIP is enabled, see VIP Parameter Configuration.
Setup Firewall
If the system firewall is enabled, you must configure it to allow PostgreSQL traffic.
Testing
Info
Ensure the ECOX license is imported; otherwise, the service will not start.
Once the configuration is complete, ECOX is ready to manage the PostgreSQL cluster. The following are the basic commands:
su - postgres
export ECOX_CONFIG=/opt/ecox-6alpha1/etc/ecox.conf
export ECOX_LICENSE=/opt/ecox-6alpha1/LICENSE
ecox start
-
Automatic Initialization:
If started without an existing database instance, ECOX will automatically initialize the database.
-
Foreground Mode:
This command runs the service in the foreground. Press
Ctrl+Cto stop it.
Register Service
To simplify management, register ECOX as a system service using the following configuration:
Reload the system daemon configuration.