End-to-end examples

Here are whole deployments, not individual commands. Each example is followed from top to bottom.

Single server

The simplest case: platform and database on one machine, database in a container.

bash install_ssh.sh --non-interactive \
     --host=192.168.0.10 --user=user \
     --ipaddress=192.168.0.10 --srvname=srv1 --postfix=_11 \
     --master=y --masterdomain=example.ru \
     --dopginstall=y --pgmode=d --usedockerhubpgimage=y \
     --pgport=5441

Shared directories are not configured: there is one node and nothing to mount. The installer will create local directories and put markers in them so that the platform does not consider the storage unavailable.

Three-server site

A master with a database, two nodes, shared directories served by the master.

Step 1. Master.

bash install_ssh.sh --non-interactive \
     --host=192.168.0.10 --user=user \
     --ipaddress=192.168.0.10 --srvname=srv1 --postfix=_11 \
     --master=y --masterdomain=example.ru \
     --dopginstall=y --pgmode=h --pghostmode=m \
     --pgport=5441 --usereplic=n \
     --installnfsserver=y --nfsclinetmask=192.168.0.0/24

Steps 2 and 3. Nodes.

for n in 11 12; do
  bash install_ssh.sh --non-interactive \
       --host="192.168.0.$n" --user=user \
       --ipaddress="192.168.0.$n" --srvname="srv$n" --postfix=_11 \
       --master=n --micaddress=mic@192.168.0.10 \
       --dopginstall=n --pghost=192.168.0.10 --pgport=5441 \
       --nfsserveraddr=192.168.0.10
done

Order matters: nodes look for the master at startup, so it must already be up.

Node commands do not have to be composed manually. If during master installation you answer on screen 10 that other servers are planned and list their names and addresses, the installer will print a ready command for each — with the node role, mic address, master database, and NFS server. See era_installer/install-local.adoc#era-installer-install-local-addservers.

You can verify that shared directories were mounted from the node log: the line mount -v 192.168.0.10:…​. If mounting failed, installation will not be interrupted, but the directory gets a nomount.sign file — and this is visible in the log as a warning.

Separate database server with a replica

Step 1. Database master.

bash install_pg_ssh.sh --non-interactive -y \
     --host=192.168.0.20 --user=user \
     --operation=install_host_master --postfix=_11 \
     --pgport=5441 --usereplic=y \
     --pgreplicauser=era_replica

Step 2. Replica.

bash install_pg_ssh.sh --non-interactive -y \
     --host=192.168.0.21 --user=user \
     --operation=install_host_slave --postfix=_11 \
     --pghost=192.168.0.20 --pgport=5441 \
     --pgreplicauser=era_replica

Step 3. Platform pointing to the database.

bash install_ssh.sh --non-interactive \
     --host=192.168.0.10 --user=user \
     --ipaddress=192.168.0.10 --srvname=srv1 --postfix=_11 \
     --master=y --masterdomain=example.ru \
     --dopginstall=n --pghost=192.168.0.20 --pgport=5441

--pghost sets only the initial connection string for the platform — the one that goes into the container on first start. After that the platform manages the list of strings itself: its configuration may contain several, both master and replica.

Check the roles:

ssh user@192.168.0.20 'sudo -u postgres /usr/lib/postgresql/17/bin/psql -p 5441 -c "SELECT pg_is_in_recovery();"'
# master -> f, replica -> t

Switching to the replica

The database master has failed.

Usually no intervention is required: the platform monitors the connection itself and, when it is lost, switches to another connection string from its configuration, moving the databases into the required role. The commands below are an additional path: they are needed when roles are assigned manually.

Promote the replica to master:

bash install_pg_ssh.sh --non-interactive -y \
     --host=192.168.0.21 --user=user \
     --operation=switch_to_master --postfix=_11

When the old master returns, it is demoted to a replica:

bash install_pg_ssh.sh --non-interactive -y \
     --host=192.168.0.20 --user=user \
     --operation=switch_to_slave --postfix=_11 \
     --pghost=192.168.0.21 --pgreplicauser=era_replica
Demotion re-fills the database from the new master. Data written to the old master after divergence remains only in the backup inside --pgbackupfolder.

Moving an instance to another server

Step 1 assumes the answers file is still on the old server. The installation may have happened long ago, and the distribution directory is often unpacked into /tmp — after a reboot neither logs nor .params remain there. Therefore save .params and .cmd immediately after installation to a place that will survive the server: with them, migration reduces to the commands below; without them, instance parameters have to be recovered from what remains on the server. When installing over ssh the copy is already with you — the wrapper fetches the target host log directory to logs/remote/<host>/. See era_installer/logs.adoc#era-installer-logs-where.

# 1. Fetch the command and parameters from the old server
scp user@192.168.0.10:/tmp/era_installer/logs/install_*.params ./srv1.params

# 2. Install on the new one, changing the address and name
bash install_ssh.sh --non-interactive \
     --answers-file=./srv1.params \
     --host=192.168.0.30 --user=user \
     --ipaddress=192.168.0.30 --srvname=srv1new

# 3. Make sure the new one works, and only then remove the old one
bash uninstall_ssh.sh --non-interactive \
     --host=192.168.0.10 --user=user \
     --eracontainername=era_11 --erainstancedatapath=/opt/era_11 \
     --douninstallpg=y --pgmode=h

Platform data is transferred separately — the installer does not copy it. It deploys the environment, while the content of volumes and the database is the task of data migration.

Reinstallation on the same server

bash era/scripts/uninstall.sh --non-interactive \
     --datapath=/opt --eracontainername=era_11 \
     --erainstancedatapath=/opt/era_11 --douninstallpg=y --pgmode=d

bash era/scripts/install.sh --non-interactive \
     --answers-file=logs/install_20260101-120000.params

Reinstallation relies on the same answers file, and here it lies on the same server being reinstalled. It is worth keeping it outside the server too: the installation may have been long ago, and by reinstallation time there is no longer anything from which to recover its parameters from memory.

Check --dry-run on removal before launching: the plan will show what exactly was found and how much space it occupies. An item marked "not found" almost always means a typo in the name.