I am using RabbitMQ 3.7.6 and Erlang 20.2.3.
My rabbitmq configuration file is /etc/rabbitmq/rabbitmq.conf and contains the following:
## Whether or not to enable proxy protocol support.
## Once enabled, clients cannot directly connect to the broker
## anymore. They must connect through a load balancer that sends the
## proxy protocol header to the broker at connection time.
## This setting applies only to AMQP clients, other protocols
## like MQTT or STOMP have their own setting to enable proxy protocol.
## See the plugins documentation for more information.
##
proxy_protocol = true
I verified that it is using this configuration file, as the log file contains this snippet during startup:
home dir : /var/lib/rabbitmq
config file(s) : /etc/rabbitmq/rabbitmq.conf
cookie hash : GOeNNW1a8SksMTlXvAt2oQ==
I have approximately 90 connections to the rabbit server.
Of these client connections about 40 are shovels on other 3.7.6 (and Erlang 20.2.3 also) RabbitMQ servers and about 15 clients are Java Spring AMQP via Spring Boot version 1.5.10.RELEASE. All of these 55 connections are using the F5 VIP and are therefore proxied. Admittedly, I have an additional 35 shovel connections from a mixture of RabbitMQ version 3.6.10 and version 3.4.4 servers that are not (yet) configured to route through the load balancer; that is to say, they fail to connect because (and I realize this) that the proxy protocol says once activated all clients must go through the proxy. I just mention this in case you think it could be part of my problem (although I wouldn't know why).
So, the behavior I see is very strange. If the Rabbit server is running in this configuration, and new clients try to connect via the F5 proxy, I see entries like these in the rabbit log file:
client unexpectedly closed TCP connection
Meanwhile, the Spring Boot clients log these lines on every connection attempt (I have it configured to re-try every 15 seconds):
2018-07-05 09:25:25,220|INFO||SimpleAsyncTaskExecutor-1|org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer|||||Restarting Consumer@31a85f60: tags=[{}], channel=null, acknowledgeMode=AUTO local queue size=0
2018-07-05 09:25:25,227|INFO||SimpleAsyncTaskExecutor-2|org.springframework.amqp.rabbit.connection.CachingConnectionFactory|||||Attempting to connect to: tstsrvr.mycompanynamehere:5672
2018-07-05 09:25:25,227|WARN||AMQP Connection 10.5.120.47:5672|com.rabbitmq.client.impl.ForgivingExceptionHandler|||||An unexpected connection driver error occured (Exception message: Socket closed)
However, while the clients are trying to connect like this, repeatedly trying every so many seconds, if I restart the RabbitMQ server, all of the clients that were previously unable to connect, are able to connect! It does seem to take them a bit longer to connect than normal (with the proxy protocol turned on), but they do connect successfully just as the rabbit server starts up.
Have you ever heard of something like this? I have another server in this exact same configuration (same RabbitMQ and Erlang version too) and I don't see this behavior with that server. This other server has fewer total clients (43) and the other difference is that I don't have "bad" clients trying to connect to it directly (rather than going through the proxy).
I guess another question I have is what should I expect to see if a client tries to connect directly to a server that is configured with "proxy_protocol = true"? Should I see any connection attempt being logged?
I was just experimenting and set "proxy_protocol = false" but left the F5 configured with the proxyheader iRule and the Rabbit server very nicely logged these types of messages:
{bad_header,<<"PROXY TC">>}
So I clearly see what doing something like that will produce. But it leaves me wondering what I should see if a direct connection is attempted when proxy protocol is true.
thanks.. dave