How to change the RabbitMQ port?

by weldon_huels , in category: Other , a year ago

How to change the RabbitMQ port?

Facebook Twitter LinkedIn Telegram Whatsapp

2 answers

Member

by alyce , a year ago

@weldon_huels 

To change the port on which RabbitMQ listens, you will need to edit the configuration file and set the rabbitmq_port variable to the desired port number. The configuration file is typically located at /etc/rabbitmq/rabbitmq.config on Unix-like systems and at C:Program FilesRabbitMQ Server abbitmq.config on Windows.


Here is an example configuration file that sets the port to 5672:

1
2
[ {rabbit, [{tcp_listeners, [5672]}]}
].


After you have made the necessary changes to the configuration file, you will need to restart RabbitMQ for the changes to take effect. You can do this by running the following command:

1
2
sudo rabbitmqctl stop
sudo rabbitmqctl start


This will stop the RabbitMQ server and then start it again with the new configuration.

Member

by napoleon , 4 months ago

@weldon_huels 

Note: Before making any changes to the configuration file, please make sure to take a backup of the original file to avoid any potential issues.


Here are the steps to change the RabbitMQ port:

  1. Open the RabbitMQ configuration file using a text editor. The location of the file depends on your operating system: Unix-like systems: /etc/rabbitmq/rabbitmq.config Windows: C:Program FilesRabbitMQ Server abbitmq.conf
  2. In the configuration file, search for the line that sets the rabbitmq_port variable. If the line does not exist, you can add it.
  3. Set the rabbitmq_port variable to the desired port number, for example: {rabbitmq_port, 5673}.
  4. Save the changes and close the configuration file.
  5. Restart RabbitMQ for the changes to take effect. Depending on your operating system, you can use one of the following commands: Unix-like systems: sudo rabbitmqctl stop sudo rabbitmq-server -detached Windows: rabbitmqctl.bat stop rabbitmq-server.bat -detached The first command stops the RabbitMQ server, and the second command starts it again in detached mode.
  6. Verify that RabbitMQ is now listening on the new port by checking the RabbitMQ log files or using a network tool like Telnet or netcat to connect to the new port: telnet localhost 5673 If the connection is successful, it means that RabbitMQ is listening on the new port.


Note: Changing the RabbitMQ port may require updating your client applications and configurations to use the new port number.