问题
I know there are many resources regarding my question but still i am not able to figure out exact way to install 2 services of RabbitMQ on single windows machine.
I know there are two way to run rabbitmq. Either as service or application. When we install RMQ it will by default install one sevice under name "RabbitMQ" which we can always run. And other way you can use below commands and run another instance of RMQ.
set RABBITMQ_NODE_PORT=5673
set RABBITMQ_NODENAME=test1
set RABBITMQ_SERVICE_NAME=test1
set RABBITMQ_SERVER_START_ARGS=-rabbitmq_management listener [{port,15673}]
call rabbitmq-server -detached
Using above commands, i am able to run second instance but as soon as user log out, the RMQ will stop. So i tried creating bat file and register it as service and start it. But even after this, the RMQ is stopping as user is Logged out.
Can some one help me with exact steps to replicate on windows machine to run long lasting second instance of RMQ (may be bat file or any other guide)??
Is there any way to modify rabbitmq-service.bat to accomodate above variable changes?
I have visited almost every website regarding installing multiple instances of RMQ but no one clearly define fine grained steps to do so.
回答1:
You should carefully read this documentation: link
First, install RMQ as a Windows Service "normally", without any customization or environment configuration, using one administrative user on your server.
Then, create a second administrative account, and do the following:
Create the file %AppData%\RabbitMQ\rabbitmq-env-conf.bat
file with these contents (be sure to replace HOSTNAME
with your actual host name!):
set SERVICENAME=RabbitMQ Server (2)
set NODENAME=rabbit2@HOSTNAME
set NODE_PORT=5673
Create the file %AppData%\RabbitMQ\rabbitmq.conf
with these contents:
management.listener.port = 15673
Open a "RabbitMQ command prompt (sbin)" command prompt, and run this command:
rabbitmq-service.bat install
rabbitmq-service.bat start
You should see a second service running in the service manager.
Note that I have not tested these steps at all. If you run into issues, I'm happy to help out further on the mailing list. Thanks.
NOTE: the RabbitMQ team monitors the rabbitmq-users mailing list and only sometimes answers questions on StackOverflow.
回答2:
You just need to change the ports and the node name in rabbitmq-defaults
, rabbitmq-env
and config files. One can run as a service by default and the you can just download it and create the service after you have changed the ports and node name.
Here is a detailed guide on how to do that. It's pretty easy and straightforward.
来源:https://stackoverflow.com/questions/51986234/rabbitmq-installing-multiple-services-on-windows-machine