2

I have two different PostgreSQL 10 servers running on the same system (using different ports) on a CentOS 6/7 system. Can someone tell me how to name these PostgreSQL services differently? Like when I run a ps on the system, it should show both the services running with different names. Right now it shows both the service names as postgres. Can someone tell me how to rename the postgres service on Linux?

I know how to do that on Windows pg_ctl.exe register -N Postgres_1 (The -N argument lets us choose the name of the Postgres service) So basically when we register the service, we can give it a custom name on Windows... but can someone tell me how to do the same on Linux?

Thanks in advance.

2 Answers 2

2

If you set cluster_name in postgresql.conf, you will see it in the args column of the ps output.

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks @Laurenz. Is there a way to change the process name completely?
Not unless you want to hack PostgreSQL. But I fail to see how cluster_name could not be sufficient.
Got it.. Thanks again for your help @Laurenz
1

If you just want to change the service name (you must know the service name), then here you go-

Browse to the service location and rename it, like this: On Centos 6 :

cd /etc/init.d/
mv postgresql postgresql5432

On Centos 7:

cd /usr/lib/systemd/system
mv postgresql.service postgresql5432.service
systemctl daemon-reload

(I am assuming you know what service is using port no. 5432)

But if you want to just figure out using ps then go for the solution of @Laurenz Albe.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.