How to install two pgEdge nodes on same host with different port numbers

Creating a multi-node PostgreSQL pgEdge cluster on localhost

There is often requirement for test and other purpose to create a multi node cluster on the same localhost. This is now possible using a pgEdge CLI command localhost cluster-create, the cluster-create is used for creating a multi-node cluster on localhost. 

Please note that before you can use the cluster-create command to create cluster on localhost, you need to setup a passwordless SSH connection to the localhost. This can be done using the following commands :

ssh-keygen -t rsa
cd ~/.ssh
cat id_rsa.pub >> authorized_keys

Once that is done download pgEdge and run the following command to create a multi-node cluster by giving a cluster and giving number of nodes.

[pgedge@localhost pgedge]$ ./pgedge localhost cluster-create foo 2

The above command will create a 2 node PostgreSQL cluster with latest version of PostgreSQL and setup multi-master replication across the nodes. The command is using default values for port and pg version etc, however the user can specify flags for these parameters. 

The help show the flags that we can use with cluster-create to specify the other values :

pgedge@localhost pgedge]$ ./pgedge localhost cluster-create --help

SYNOPSIS
    ./pgedge localhost cluster-create CLUSTER_NAME NUM_NODES <flags>

FLAGS

--pg=PG
The postgreSQL version of the database.

--port1=PORT1
The starting port for this cluster. For local clusters, each node will have a port increasing by 1 from this port number.   

-U, --User=USER

-P, --Passwd=PASSWD

-d, --db=DB
        The database name.
   

Please also see pgEdge documentation for more details on create cluster on local host.

https://docs.pgedge.com/platform/installing_pgedge/local_json