Brady Harper
Brady Harper

Reputation: 327

RabbitMQ: Handshake Terminated by server (ACCESS-REFUSED)

I'm trying to send RabbitMQ messages from my host machine to a Minikube instance with a RabbitMQ cluster deployed.

When running my send script, I get hit with this error:

Handshake terminated by server: 403 (ACCESS-REFUSED) with message "ACCESS_REFUSED - Login was refused 
using authentication mechanism PLAIN. For details see the broker logfile.

In the broker logfiles I can see this line:

Error on AMQP connection <0.13226.0> (172.17.0.1:40157 -> 172.17.0.8:5672, state: starting):
PLAIN login refused: user 'rabbitmq-cluster-default-user' - invalid credentials

I'm sure I have the correct credentials since I got them directly from the RabbitMQ pod, following the official documentation (link).

My send script is below:

const amqp = require('amqplib/callback_api');

const cluster = "amqp://rabbitmq-cluster-default-user:[email protected]:30861";

amqp.connect(cluster, function(error0, connection) 
{
    if (error0)
    {
        throw error0;
    }

    connection.createChannel(function(error1, channel) 
    {
        if (error1)
        {
            throw error1;
        }

        const queue = "files";
        var msg = {
            name: "Hello World"
        };

        var msgJson = JSON.stringify(msg);

        channel.assertQueue(queue, {
            durable: false
        });

        channel.sendToQueue(queue, Buffer.from(msgJson));
    });
});

I know the code works as I ran the exact same script for my localhost setup and it worked. The only thing I've changed is the URL (for the Minikube RabbitMQ service).

I've seen a few other posts that contain a similar issue but most solutions are about including the correct credentials in the URI, which I have done.

Any other ideas?

Upvotes: 0

Views: 4510

Answers (1)

Catastrophe
Catastrophe

Reputation: 350

You can use port forwarding the rabbitMQ service to your local machine and use UI login and check the password with the UI given by the RabbitMQ itself.

kubectl port-forward svc/rabbitmq UI-PORT:UI-PORT (must be 15672)

then from a browser

localhost:15762  

must be enough

For clearance you can check if you can login from the container itself. If the login from the container fails you can also check the yaml file or the helm chart you are using for login methods and credentials. Plain login may be disabled.

Another situation may be with the distrubution. When deploying RabbitMQ I try to use bitnami charts. I can suggest them.

If all these fails there is another way you can use. You can try to create another user with admin privileges to connect to RabbitMQ and then keep using it.

For more information, you can post container/pod logs for us to see. Good day.

Upvotes: 1

Related Questions