1. Install Rabbit MQ
1. Download and install Erlang : http://www.erlang.org/downloads
2. Download and install Rabbit MQ : http://www.rabbitmq.com/releases/rabbitmq-server/
The default installed Rabbit MQ listening port is 15672
2. Rabbit MQ configuration and operation
1. Activate the management plugin
Switch to the sbin directory and execute: rabbitmq-plugins enable rabbitmq_management
Restart the service to make it take effect: net stop RabbitMQ && net start RabbitMQ
2. Create a user
Create user admin with password admin123: rabbitmqctl add_user admin admin123
Give admin the role of administrator administrator: rabbitmqctl set_user_tags admin administrator
View the list of users: rabbitmqctl list_users
Create vhost: rabbitmqctl add_vhost /myhost
查看vhost:rabbitmqctl list_vhosts
Give the user admin the configuration, write and read permissions of all resources in the virtual host /myhost to manage the resources: rabbitmqctl set_permissions -p /myhost admin '.*' '.*' '.*'
common problem
1. Support using IP access
Add the following configuration to etc\rabbitmq.config.example:
{tcp_listeners, [15672]},
{loopback_users, ["admin"]},
2. Report the following exception
org.springframework.context.ApplicationContextException: Failed to start bean 'amqpTemplate.replyListener'; nested exception is org.springframework.amqp.AmqpIllegalStateException: Fatal exception on listener startup
Caused by: org.springframework.amqp.AmqpIllegalStateException: Fatal exception on listener startup
Caused by: org.springframework.amqp.rabbit.listener.FatalListenerStartupException: Cannot prepare queue for listener. Either the queue doesn't exist or the broker will not allow us to use it.
Caused by: com.rabbitmq.client.ShutdownSignalException: channel error; reason: {#method<channel.close>(reply-code=404, reply-text=NOT_FOUND - no queue '93bbbad7-4dcd-4f2c-930f-30f1fca50a26' in vhost '/xjsit', class-id=50, method-id=10), null, ""}
Solution: Visit http://localhost:15672/ and set the corresponding configuration and read and write permissions for the user in the Admin tab.