Skip to main content

Connection failed - user: chef - (Bunny::ProtocolError)


I was trying to setup chef server on my local box using Oracle Enterprise Linux 6.4.

After sucessfully installing all the required serivces chef-server was not running, so when I tried to start the service below error was displayed.

Chef-server dead but pid file exists

I tried to find the cause of this issue in logs but no clues in the logs as well.

Then I run the chef server in foreground using the below command, to debug the issue

#chef-server -C /etc/chef/server.rb -L /var/log/chef/server.log -p 4000 -e production -a thin -P /var/run/chef/server.pid -u chef -G chef

Below stack trace was displayed

merb : chef-server (api) : worker (port 4000) ~

Connection failed - user: chef - (Bunny::ProtocolError)

This issue was becuase chef server was unable to connect to rabbitmq using bunny protocal as user chef.

I had already run the below rabbitmq server configuration which is recommended in opscode site, but still it was failing to connect to rabbitmq

# rabbitmqctl add_vhost /chef
# rabbitmqctl add_user chef

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

Later I reset the rabbitmq configuration using the following command

# rabbitmqctl force_reset

The issue was due to password which was given in server.rb of chef server was different than what I had given while running the rabbitmq server configuration.

Basically we should use same password which is set in “amqp_pass” in the Chef server - server.rb file and if you have not given the password in server.rb then the default password is testing.

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

...at last I was able to start the chef server service and also able to connect to rabbitmq server.

Comments

Popular posts from this blog

Setup little kitchen using Chef 11 server on CentOS 6

To setup little kitchen (development environment), I created 2 win2k8 R2 VMs one for workstation and another for node. For chef server I downloaded the CentOS 6.4 and installed on my box using virtualbox. To configure network between CentOS VM and the 2 windows VMs; I selected adapter 1 as Host-only Adapter and Adapter 2 as NAT for each of VMs network settings in VirtualBox. Steps I followed to install Chef 11 server 1. Download the relevant platform package from the opscode site; you can use curl/wget. If you don't have wget then you can install by running #yum install -y wget" #wget https://opscode-omnibus-packages.s3.amazonaws.com/el/6/x86_64/chef-server-11.0.4-1.el6.x86_64.rpm 2. Install the downloaded package using rpm or yum #rpm -Uvh chef-server-11.0.4-1.el6.x86_64.rpm 3. Please add the hostname and the ip address of your chef server to the /etc/hosts file, to know your hostname run the #hostname. 4. After installation configure the

Check your knife configuration and network settings, unable to upload cookbooks

While uploading cookbook to chef 11 server (OEL), I was getting the below errors C:\Users\Administrator>knife cookbook upload testcookbook Uploading testcookbook [0.1.0] ERROR: Network Error: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. - connect(2) Check your knife configuration and network settings C:\Users\Administrator>knife cookbook upload testcookbook Uploading testcookbook1 [0.1.0] ERROR: Network Error: getaddrinfo: No such host is known. Check your knife configuration and network settings To find what is causing this issue, I ran knife cookbook upload in debug mode C:\Users\Administrator>knife cookbook upload testcookbook -s https://192.168.56.11 -V Uploading testcookbook [0.1.0] INFO: Validating ruby files INFO: Validating templates INFO: Syntax OK INFO: Saving testcookbook INFO: Uploading files I