I have a RabbitMQ node on windows operating system. I want to create vhost on that node from command line of using a script with minimal pre-requisites.
EDIT: I tried to use the rabbitmqctl add_vhost but I always get an error.
rabbitmqctl add_vhost my_vhost
and
rabbitmqctl set_permissions -p my_vhost guest ".*" ".*" ".*"
I suggest to read this: https://www.rabbitmq.com/man/rabbitmqctl.1.man.html
So you have another error, about the node down read here
RabbitMQ has Nodedown Error
Related
What kind of health checks can be configured for rabbitmq in openshift?
I wasn't able to configure rabbitmqctl as suggested in [1] or [2] as it delivers errors when used with the images registry.centos.org/centos/rabbitmq or luiscoms/openshift-rabbitmq
Example:
$ rabbitmqctl cluster_status
Error: could not recognise command
...
Only root or rabbitmq should run rabbitmqctl
[1] https://github.com/docker-library/rabbitmq/pull/174#issuecomment-452002696
[2] https://github.com/rabbitmq/rabbitmq-peer-discovery-k8s/blob/master/examples/k8s_statefulsets/rabbitmq_statefulsets.yaml
I have installed rabbitmq-server on ubuntu , post installation I have checked if its running properly on the ports or not using netstat -lntu. Its running, plugins are enabled and same has been verified too. Even port 15672 is also open. What can be the reason that I am not able to acces web management console from the remote rabbitmq-server.
P.S : I have already created the admin user.
I have already tried allowing the port 15672 as mentioned in this question : How do I find my firewall is blocking mysql? | Ask Ubuntu. and also followed this one : Can't access RabbitMQ web management interface after fresh install | Stack Overflow and many more.
and lastly tried to edit rabbitmq-env.conf as suggested here : Web dispatch plugin | RabbitMQ.
By default, RabbitMQ creates a user named "guest" with password "guest”. You can also create your own administrator account on RabbitMQ server using following commands. Change password to your own password.
Step 1: Set the username and password by running the following commands
sudo rabbitmqctl add_user admin password
sudo rabbitmqctl set_user_tags admin administrator
sudo rabbitmqctl set_permissions -p / admin ".*" ".*" ".*"
Step 2: Enable and use the RabbitMQ management console
sudo rabbitmq-plugins enable rabbitmq_management
sudo chown -R rabbitmq:rabbitmq /var/lib/rabbitmq/
Next, you need to setup an administrator user account for accessing the RabbitMQ server management console. In the following commands, "mqadmin" is the administrator's username, "mqadminpassword" is the password. Remember to replace them with your own.
Step 3:: Add user and give the permission
sudo rabbitmqctl add_user mqadmin mqadminpassword
sudo rabbitmqctl set_user_tags mqadmin administrator
sudo rabbitmqctl set_permissions -p / mqadmin ".*" ".*" ".*"
Now open the http://[rabbitMQ-server-IP]:15672/ and You are Done 🎉🍾
For rabbitmq setup only need to do following things
1.install rabbitmq-server
sudo apt-get install rabbitmq-server
2.enable gui plugin
sudo rabbitmq-plugins enable rabbitmq_management
3.start rabbidmq-server
sudo rabbitmq-server start
4.see gui on browser(bellow information is given by default rabbitmq configuration)
http://localhost:15672/
username:guest
password:guest
I am having rabbitmq up and running in another machine with ip address 10.8.11.12 on port 15672 and in that i am having a queue named "hello". I want to purge hello queue from my machine using CLI (command line interface)
I have tried following to purge queue in localhost
rabbitmqctl purge_queue
it is working fine
and i am trying the same like this
rabbitmqctl purge_queue -p 10.8.11.12 hello
here i am considering 10.8.11.12 as vhost. is it correct?
what actually vhost means in rabbitmq?
Even a simple link will help.
you have to use -n parameter as:
rabbitmqctl -n rabbit#your_other_machine purge_queue hello
here is an example:
./rabbitmqctl -n rabbit#srv-rabbit-cent01 purge_queue my_queue_1
where rabbit#srv-rabbit-cent01 is the rabbitmq node name. ( srv-rabbit-cent01 is the hostname )
about the vhost please read here: https://www.rabbitmq.com/uri-spec.html
2.4. Vhost
The vhost component is used as the basis for the virtual-host field of
the connection.open AMQP 0-9-1 method. Any percent-encoded octets in
the vhost should be decoded before the it is passed to the server.
Using rabbitmq, we can install management plugin. Then we access via browser using http://localhost:55672/ using guest:guest.
The problem is, I can not login anymore because i changed password and entered blank for role.
Is there any way to reset user for rabbitmq management?
You can access the user-management with rabbitmqctl and use the command:
add_user {username} {password}
or more preferably maybe edit an existing user, or set the permissions for the new user with:
set_permissions [-p vhostpath] {user} {conf} {write} {read}
For example use the following commands: (it is important to perform these three steps even when creating a new user, if you want to be able to login to the UI console and for your programs to work without facing any permission issues)
rabbitmqctl add_user newadmin s0m3p4ssw0rd
rabbitmqctl set_user_tags newadmin administrator
rabbitmqctl set_permissions -p / newadmin ".*" ".*" ".*"
...to create a new administrator user with full access to the default / vhost.
You can find all this on the RabbitMQ homepage, and more specifically on this page
The simplest way I found is to use this command to reset the password for any user in RabbitMQ
rabbitmqctl change_password <USERNAME> <NEWPASSWORD>
This is specifically for aliveness test, but could apply to other apis as well
rabbitmqctl add_vhost statuscheckvhost
rabbitmqctl add_user heartbeat alive
rabbitmqctl set_permissions -p statuscheckvhost heartbeat ".*" ".*" ".*"
rabbitmqctl set_user_tags heartbeat management
curl -i -u heartbeat:alive http://127.0.0.1:55672/api/aliveness-test/statuscheckvhost
HTTP/1.1 200 OK
Server: MochiWeb/1.1 WebMachine/1.9.0 (someone had painted it blue)
Date: Thu, 21 Feb 2013 22:20:10 GMT
Content-Type: application/json
Content-Length: 15
Cache-Control: no-cache
{"status":"ok"}
If you have RabbitMQ on a docker container, you can first
docker exec -it <YOUR_CONTAINER> /bin/bash
Then you can do
rabbitmqctl change_password <USERNAME> <NEWPASSWORD>
such as #samtoddler pointed out
I was able to reset after this post. Thanks a lot.
rabbitmqctl add_user test password
rabbitmqctl set_user_tags test administrator
Then I went to browser console and login with this test account.
And from there I was able to reset pwd of admin account & guest account.
I am having server issues with getting rabbit to cluster.
I boot up two nodes on ec2.
On the the first node booted I do this.
rabbitmqctl stop_app
rabbitmqctl reset
rabbitmqctl start_app
I boot another node.
sudo service rabbitmq-server stop
#Copy cookie from the first server booted
sudo su - -c 'echo -n "cookie" > /var/lib/rabbitmq/.erlang.cookie'
rabbitmqctl stop_app
rabbitmqctl reset
rabbitmqctl cluster rabbit#server1
1) sever1 is running
2) What ports to need open? I have 22, 4369, 5672
sudo rabbitmqctl cluster rabbit#aws-rabbit-server-east-development-20121102162143
Clustering node 'rabbit#aws-rabbit-server-east-development-20121103033005' with ['rabbit#aws-rabbit-server-east-development-20121102162143'] ...
Error: {no_running_cluster_nodes,['rabbit#aws-rabbit-server-east-development-20121102162143'],
['rabbit#aws-rabbit-server-east-development-20121102162143']}
What could possibility be missing from there docs or what what am I missing?
I had a similar problem on EC2 with two windows machines. I eventually got it working but I'm not sure I did it in the correct way so there may be a better solution.
The issue I found was that the two nodes could not see each other when trying to cluster. Each time you start a Rabbit node it seemed to be assigned a port number dynamically.
This obviously makes it very difficult to know which port to open up in the security group so to solve this, I restricted the range of ports Rabbit chose from when assigning the port. I restricted this to a range of 1 port on each node so I always know which port was being assigned.
The easiest way I found to do this was by editing the sbin\rabbitmq-service.bat file.
find the line -kernel inet_default_connect_options "[{nodelay,true}]" ^
add the following two lines to the file underneath:
-kernel inet_dist_listen_min ##### ^
-kernel inet_dist_listen_max ##### ^
replacing ##### with your chosen port number.
So you should now open up the following ports:
5672 - RabbitMQ’s listening port
4369 - Erlang Port Mapper Daemon
##### - the chosen port number for the Erlang nodes to communicate via
Because Erlang does not recognise FQDNs you may need to modify the hosts file on all the servers to make sure they are all able to resolve all the Erlang node name to an IP address, e.g.
123.123.123.111 NODE1
123.123.123.222 NODE2
once this is done you should then be able to see each node from the other. you can do this by using calling the following from the command line (replacing rabbit#NODE2 with whichever node you want to see)
rabbitmqctl status -n rabbit#NODE2
Hope this give you some help, I'm no expert but found this got things working for me!