This spring guide on messaging with rabbitmq does not talk about the host port configurations. I followed the same and added these properties to application.properties to connect to rabbitmq broker installed on GCP
spring:
rabbitmq:
host: XXX.XXX.XXX.XX
port: 5672
username: user
password: bitnami
virtual-host: /
While running the app I am getting timeout exception while connecting to rabbitmq
2017-08-06 17:16:54.322 ERROR 7280 --- [ container-1] o.s.a.r.l.SimpleMessageListenerContainer : Failed to check/redeclare auto-delete queue(s).
org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection timed out: connect
at org.springframework.amqp.rabbit.support.RabbitExceptionTranslator.convertRabbitAccessException(RabbitExceptionTranslator.java:62) ~[spring-rabbit-1.7.2.RELEASE.jar:na]
at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:367) ~[spring-rabbit-1.7.2.RELEASE.jar:na]
at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.createConnection(CachingConnectionFactory.java:565) ~[spring-rabbit-1.7.2.RELEASE.jar:na]
at org.springframework.amqp.rabbit.core.RabbitTemplate.doExecute(RabbitTemplate.java:1430) ~[spring-rabbit-1.7.2.RELEASE.jar:na]
at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:1411) ~[spring-rabbit-1.7.2.RELEASE.jar:na]
at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:1387) ~[spring-rabbit-1.7.2.RELEASE.jar:na]
at org.springframework.amqp.rabbit.core.RabbitAdmin.getQueueProperties(RabbitAdmin.java:336) ~[spring-rabbit-1.7.2.RELEASE.jar:na]
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.redeclareElementsIfNecessary(SimpleMessageListenerContainer.java:1136) ~[spring-rabbit-1.7.2.RELEASE.jar:na]
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1387) [spring-rabbit-1.7.2.RELEASE.jar:na]
Tried the following but still same error:
Opened up tcp:5672 through GCP firewall configuration
Changed the rabbitmq config at /opt/bitnami/rabbitmq/etc/rabbitmq/rabbitmq.config to change the allowed ips from localhost (127.0.0.1) to 0.0.0.0
{
rabbit,
[{tcp_listeners, [{"0.0.0.0", 5672}, {"::", 5672}]},
{default_vhost, <<"/">>},
{default_user, <<"user">>},
{default_pass, <<"bitnami">>},
{default_permissions, [<<".*">>, <<".*">>, <<".*">>]}
}
What could be the problem here ?
Update
I have installed rabbitmq locally and everything works fine.
I doubt if the updates to config file is actually not getting reflected properly. This is how I did it.
updated the rabbitmq.config
rabbitmqctl stop_app
rabbitmqctl start_app
But still I see some difference under the 'Ports and contexts' section in the UI
localhost
gcp
Any pointers ? Or is it all looking fine and the problem is something different, like with GCP setup or something ?
After telnet-ing to the port and checking the port config through the GCP console I figured out that I did a mistake in setting the right tag name to the instance where I installed rabbitmq.
Please do verify that the 'target tag' mentioned in your firewall rule is indeed mapped to the vm instance where rabbitmq is installed
Otherwise the config mentioned in the question is enough to make it work from a remote client
Related
I'm new to RabbitMQ and docker. I'm running a Springboot app and I have a docker container that is running the management console on 15672. I'm able to get to that in my browser just fine, but I cannot connect to RabbitMQ when I start the application using this in my yml file:
rabbitmq:
username: test
password: test
host: localhost
port: 5672
test is a user I created with admin permissions same as guest.
When I change the user/password to guest, it tries over and over to connect to 5672 and finally times out. test/test just fails fast with this error:
Rabbit health check failed
org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused (Connection refused)
at org.springframework.amqp.rabbit.support.RabbitExceptionTranslator.convertRabbitAccessException(RabbitExceptionTranslator.java:61) ~[spring-rabbit-2.2.6.RELEASE.jar:2.2.6.RELEASE]
Any advice for a newbie would be greatly appreciated.
I'm expecting to connect to RabbitMQ using test/test on port 5672. But I must have something configured incorrectly.
Configuring a ELK stack version 8.1, based on two virtual machine which both run Oracle linux 8. I need to send logs from a VM to the other using rsyslog. On the recieving machine logs will be acquired using FileBeat. The file rsyslog.conf has been configured on the sending machine, adding target machine parameters. The file filebeat.yml has been configured to recieve logs from rsyslog like this:
- type: syslog
enabled: true
format: auto
protocol.tcp:
host: "X.X.X.X:10514"
The firewalld on the receiving machine has been configured opening the port 10514.
Since the reboot after configuration, the only thing I can get is the error:
cannot connect to X.X.X.X:10514: Connection refused
How can I solve this problem?
I'm new to RabbitMQ and I want to run a RabbitMQ server instance on centOS7 using the following command:
sudo systemctl start rabbitmq-server
The command seemed to take forever and when I stopped the process and checked the log files, everything was ok and it said that rabbit is up and running. But when I try to execute any command using rabbitmqctl I'm getting the following error:
Error: unable to perform an operation on node 'rabbit#hostname'. Please see diagnostics information and suggestions below.
Most common reasons for this are:
* Target node is unreachable (e.g. due to hostname resolution, TCP connection or firewall issues)
* CLI tool fails to authenticate with the server (e.g. due to CLI tool's Erlang cookie not matching that of the server)
* Target node is not running
In addition to the diagnostics info below:
* See the CLI, clustering and networking guides on https://rabbitmq.com/documentation.html to learn more
* Consult server logs on node rabbit#hostname
* If target node is configured to use long node names, don't forget to use --longnames with CLI tools
**DIAGNOSTICS**
attempted to contact: [rabbit#hostname]
rabbit#hostname:
* connected to epmd (port 4369) on hostname
* epmd reports node 'rabbit' uses port 25672 for inter-node and CLI tool traffic
* can't establish TCP connection to the target node, reason: timeout (timed out)
* suggestion: check if host 'hostname' resolves, is reachable and ports 25672, 4369 are not blocked by firewall
Current node details:
* node name: 'rabbitmqcli-806330-rabbit#hostname'
* effective user's home directory: /var/lib/rabbitmq
* Erlang cookie hash: KgAE7WR3dl5/FGAyWKE5LA==
I tried killing the processes manually but it didn't work.
every needed port is listening and I can telnet them. Can you please help me on where the problem might be?
The client machine cannot resolve the hostname pointing to the rabbitmq server.
If the IP address isn't publicly propagated, you have to put the IP/host combination in /etc/hosts file.
You could also try to connect to the IP address instead of the hostname to clear any other network related issues.
I am trying to use rabbit as my transporter in spring-xd. Earlier, I installed redis and configured redis properties in servers.yml and it was working.
Now, I moved to rabbitmq, and installed rabbitmq and able to run the service rabbitmq-server.
I made the following changes in servers.yml
xd:
transport: rabbit
#RabbitMQ properties
spring:
rabbitmq:
host: FQHN
port: 5672
username: guest
password: guest
virtual_host: /
But, when I am starting xd-admin and container, still container taking redis as a transporter.
Redis properties are commented in servers.yml.
Please help me on this.
Thanks,
-Suyodha
I use rabbit transport all the time, with no problems.
First, I suggest you move to the recent 1.0.0.RELEASE. The rabbit host and port are now provided in the addresses property
spring:
rabbitmq:
addresses: FQHN:5672
...
How are you launching the container and admin? Do you have any XD_ environment variables set? Using the supplied scripts, the servers.yml settings will normally override the application.yml. It must be on the classpath. If you can't figure it out, post a DEBUG log of the container startup somewhere (too big for here) with DEBUG enabled for org.springframework.
I am trying to connect to RabbitMQ with EasyNetQ.
RabbitMQ is on remote VM.
_rabbitBus = RabbitHutch.CreateBus(
string.Format("host={0};virtualhost={1}",
_hostSettings.Host, _hostSettings.VHost),
x => x.Register<IEasyNetQLogger>(l => _logger));
_rabbitBus.Subscribe<Message>(_topic, ReceiveMessage, m => m.WithTopic(_topic));
I get a TimeoutException The operation requested on PersistentChannel timed out..
Remote VM is replying to pings, ports 5672 and 15672 are opened (checked with nmap).
RabbitMQ management can be accessed from my host.
Also, if RabbitMQ is run on my local machine, it works fine.
I've tried connecting to RabbitMQ installed on my computer from other pc's in LAN, and it also works.
I've come to an assumption, that it's related to the fact it's on a virtual machine, and maybe there's something wrong in connection. But again, Rabbit's web management works fine.
Also tested on EasyNetQ Test application - works on localhost, but not on remote.
Output as following:
DEBUG: Trying to connect
ERROR: Failed to connect to Broker: '192.168.0.13', Port: 5672 VHost: '/'.
ExceptionMessage: 'None of the specified endpoints were reachable'
ERROR: Failed to connected to any Broker. Retrying in 5000 ms
EasyNetQ v0.28.4.242
As Mike suggested i had this and then checked the permissions. "guest" user can only connect via localhost (see RabbitMQ Access Control.) Try adding a user with permissions using the management interface and then connect as below
var _bus = RabbitHutch.CreateBus(string.Format("host={0};virtualhost={1};username={2};password={3}",
_hostSettings.Host, _hostSettings.VHost, _hostSettings.UserName, _hostSettings.Password));
Did you check your credentials. The default username and password is 'guest' and 'guest'. The error message is not very helpful. You get 'None of the specified endpoints were reachable' if there's an authentication error as well