Jump to content
Welcome to our new Citrix community!
  • 0

Change PostGreSQL port

Jeremy Gove


Someone wants to run a different program that seems hardcoded to use port 5432, which is also the default port for PostGreSQL.  Can we configure the V.D.A. to connect to PostgreSQL on a different port?


I tried modifying /var/lib/pgsql/data/postgresql.conf, but this didn't change the PostgreSQL listening port.  Next, I edited /usr/lib/systemd/system/PostgreSQL.service, ran systemctl daemon-reload, and restarted the "service", which made it listen on an alternate port; running 'lsof -I | grep LISTEN' confirmed this.  I also made sure that no firewall rules were blocking the alternate port.


Then, I tried to figure out how to make the V.D.A. use this alternate port.  It looks like /etc/xdl/ctx-vda.conf contains a J.D.B.C. connection line, so I modified it to:




Then, I tried to restart ctxvda and ctxhdx.  However, ctxhdx failed to restart.  After I rebooted the V.M., the daemons started, but /var/log/xdl/hdx.log was full of messages about an error connecting to the database.  Is there a way to configure it to use the alternate port?


Link to comment

4 answers to this question

Recommended Posts

  • 0

Hi, I have tried to modify listening port in /usr/lib/systemd/system/postgresql.service, there is a line "Environment=PGPORT=5432", you can change its value to what you want to use, then run 'systemctl daemon-reload' to reload units and 'service postgresql restart' to restart this service.


For /var/lib/pgsql/data/postgresql.conf, there is a line in this file : "Note: In RHEL/Fedora installations, you can't set the port number here; adjust it in the service file instead." So change in postgresql.conf doesn't work.



Qianqian Zu

Link to comment
  • 0

Thank you for your reply, Qianqian.  Yes, I managed to change the port that postgres listens on by editing the service file.  However, it seems like the V.D.A. is still trying to connect using the old port.  I thought that I might be able to change the J.D.B.C. connection string in /etc/xdl/ctx-vda.conf, but that didn't work, unfortunately.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...