It’s possible to run multiple instances of the PostgreSQL service on the same server, but they each have to be on their own port. To register multiple instances of Postgres:
- Copy the existing database to a new location for each additional Postgres instance you want to create (you don’t need to copy any other files other than the database – i.e. you do not need to copy the binaries to run the program twice – for clarity, you do not need multiple copies of the exe’s to run multiple instances of Postgres, they all run from the one set of binaries).
- Right click the command prompt icon and run it as Administrator
- Run the following command, specifying a new port number and different PostgreSQLServiceName for each additional Postgres instance you wish to run:
pg_ctl.exe register -N PostgreSQLServiceName -U domain\usernames -P password -D “C:\Data\PostgreSQL\BackendDB” -o “-p 5433”
If the command returned nothing, that means it worked. Check your Windows Services (services.msc) and you should see the mutliple instances of Postgres in the list.
More information on pg_ctl.exe.