Jonathan Polansky

A pretty good webpage.

chef-server connection failed to rabbitmq using bunny protocol as user chef

I spent 4 hours troubleshooting the error:

merb : chef-server (api) : worker (port 4000) ~ Connection failed - user: chef - (Bunny::ProtocolError)

Turns out it was because the rabbitmq server hadn’t been configured for usage with chef yet. Somehow the chef wiki docs failed to mention this step in their CentOS install guide (perhaps this is supposed to be done automatically by the chef RPM? if so, it didn’t work on my install.) Here’s what you need to do:

# rabbitmqctl add_vhost /chef
# rabbitmqctl add_user chef
# rabbitmqctl set_permissions -p /chef chef ".*" ".*" ".*"


Tagged as , , + Categorized as Tech

12 Comments

  1. Thanks, this was very useful. We had the same problem on Ubuntu 10.10.

    Only difference is our add_user required a password. Wasn’t entirely obvious what password we had to give it so chef-server would be happy. I hacked the source to spit out the password with the error message in order to figure it out. (Naturally I removed that hack after it was working :) )

    Andy

  2. Thanks!

    Its weird that its not fixed yet (11.04 should be out soon and now packages for 10.10?)

    Ronen

  3. Thanks for the hint! It took me 2 hours instead :)
    I think you also need the password in the following command:

    rabbitmqctl add_user chef PASSWORD

    At least in RHEL derivatives, the password can be found in /etc/chef/amqp_passwd

  4. Thanks, this was driving me mad for hours! Oddly enough an installation on one server worked fine, but I ran into this error on the second system.

    In case anyone else is wondering, “rabbitmqctl add_user” requires a password: in this case, you should use the password set in “amqp_pass” in your Chef server.rb

  5. thanks for saving time :)

  6. Thank you! What was odd for me was that this was working fine for months on Ubuntu 11.04 then suddenly stopped working. Somehow rabbitmq forgot??? I don’t pretend to understand, but I appreciate your quick fix.

  7. Gerrrr.. Its still not fixed for Ubuntu 11.10
    Thanks

  8. I use chef-solo with http://s3.amazonaws.com/chef-solo/bootstrap-latest.tar.gz setup my chef server on Ubuntu 11.10. I encounter this problem after reboot my chef server. Thanks you save my time!

  9. Jesus M Movilla says:

    Just to remark that I had to reboot all the chef server components to allow the new rabbit configuration to be in place.
    Thanks a lot for your help!

  10. Happened after a EC2 server clone. Thanks for the tip.

  11. Thanks for sharing.
    Happened after rebooted our ec2 chef instance.

comment_type == "trackback" || $comment->comment_type == "pingback" || ereg("", $comment->comment_content) || ereg("", $comment->comment_content)) { ?>

Trackbacks & Pingbacks

  1. Andy

    Thanks, this was very useful. We had the same problem on Ubuntu 10.10.

    Only difference is our add_user required a password. Wasn’t entirely obvious what password we had to give it so chef-server would be happy. I hacked the source to spit out the password with the error message in order to figure it out. (Naturally I removed that hack after it was working :) )

    Andy

  2. comment_type == "trackback" || $comment->comment_type == "pingback" || ereg("", $comment->comment_content) || ereg("", $comment->comment_content)) { ?>

    Trackbacks & Pingbacks

    1. narkisr

      Thanks!

      Its weird that its not fixed yet (11.04 should be out soon and now packages for 10.10?)

      Ronen

    2. comment_type == "trackback" || $comment->comment_type == "pingback" || ereg("", $comment->comment_content) || ereg("", $comment->comment_content)) { ?>

      Trackbacks & Pingbacks

      1. Tair

        Thanks for the hint! It took me 2 hours instead :)
        I think you also need the password in the following command:

        rabbitmqctl add_user chef PASSWORD

        At least in RHEL derivatives, the password can be found in /etc/chef/amqp_passwd

      2. comment_type == "trackback" || $comment->comment_type == "pingback" || ereg("", $comment->comment_content) || ereg("", $comment->comment_content)) { ?>

        Trackbacks & Pingbacks

        1. Kristian

          Thanks, this was driving me mad for hours! Oddly enough an installation on one server worked fine, but I ran into this error on the second system.

          In case anyone else is wondering, “rabbitmqctl add_user” requires a password: in this case, you should use the password set in “amqp_pass” in your Chef server.rb

        2. comment_type == "trackback" || $comment->comment_type == "pingback" || ereg("", $comment->comment_content) || ereg("", $comment->comment_content)) { ?>

          Trackbacks & Pingbacks

          1. marek

            thanks for saving time :)

          2. comment_type == "trackback" || $comment->comment_type == "pingback" || ereg("", $comment->comment_content) || ereg("", $comment->comment_content)) { ?>

            Trackbacks & Pingbacks

            1. Vince CA

              Thank you! What was odd for me was that this was working fine for months on Ubuntu 11.04 then suddenly stopped working. Somehow rabbitmq forgot??? I don’t pretend to understand, but I appreciate your quick fix.

            2. comment_type == "trackback" || $comment->comment_type == "pingback" || ereg("", $comment->comment_content) || ereg("", $comment->comment_content)) { ?>

              Trackbacks & Pingbacks

              1. Millisami

                Gerrrr.. Its still not fixed for Ubuntu 11.10
                Thanks

              2. comment_type == "trackback" || $comment->comment_type == "pingback" || ereg("", $comment->comment_content) || ereg("", $comment->comment_content)) { ?>

                Trackbacks & Pingbacks

                1. v1nc3ntlaw

                  I use chef-solo with http://s3.amazonaws.com/chef-solo/bootstrap-latest.tar.gz setup my chef server on Ubuntu 11.10. I encounter this problem after reboot my chef server. Thanks you save my time!

                2. comment_type == "trackback" || $comment->comment_type == "pingback" || ereg("", $comment->comment_content) || ereg("", $comment->comment_content)) { ?>

                  Trackbacks & Pingbacks

                  1. Jesus M Movilla

                    Just to remark that I had to reboot all the chef server components to allow the new rabbit configuration to be in place.
                    Thanks a lot for your help!

                  2. comment_type == "trackback" || $comment->comment_type == "pingback" || ereg("", $comment->comment_content) || ereg("", $comment->comment_content)) { ?>

                    Trackbacks & Pingbacks

                    1. Laknath

                      Happened after a EC2 server clone. Thanks for the tip.

                    2. comment_type == "trackback" || $comment->comment_type == "pingback" || ereg("", $comment->comment_content) || ereg("", $comment->comment_content)) { ?>

                      Trackbacks & Pingbacks

                      1. Dorian

                        Thanks for sharing.
                        Happened after rebooted our ec2 chef instance.

                      2. comment_type == "trackback" || $comment->comment_type == "pingback" || ereg("", $comment->comment_content) || ereg("", $comment->comment_content)) { ?>

                        Trackbacks & Pingbacks

                        1. Chef server rabbitmq trouble with Ubuntu 12.04.1 (Bunny::ProtocolError) « Moments of clarity in code

                          [...] Jonathan Polansky to the rescue with the following: [...]

                        Leave a Reply