title: Celery: Error in connecting to RabbitMQ Server
body: <p>I am starting to use celery by following this <a href="http://docs.celeryproject.org/en/latest/getting-started/first-steps-with-celery.html">"First Steps with Celery"</a>.
  I exactly used the tasks.py indicated on that link.
  However when I ran the task using,</p>
  
  <pre><code>celery -A tasks worker --loglevel=info
  </code></pre>
  
  <p>I am getting this error:</p>
  
  <pre><code>[2014-09-16 20:52:57,427: ERROR/MainProcess] consumer: Cannot connect to amqp://guest:**@127.0.0.1:5672//: Socket closed. Trying again in 2.00 seconds...
  </code></pre>
  
  <p>The rabbitmq server is for sure running and below is the snippet of the log regarding the error:</p>
  
  <pre><code>=ERROR REPORT==== 16-Sep-2014::20:53:09 ===
  exception on TCP connection &lt;0.235.0&gt; from 127.0.0.1:58162
  {channel0_error,starting,
              {amqp_error,access_refused,
                          "AMQPLAIN login refused: user 'guest' - invalid credentials",
                          'connection.start_ok'}}
  
  =INFO REPORT==== 16-Sep-2014::20:53:09 ===
  closing TCP connection &lt;0.235.0&gt; from 127.0.0.1:58162
  
  =INFO REPORT==== 16-Sep-2014::20:53:15 ===
  accepted TCP connection on [::]:5672 from 127.0.0.1:58163
  
  =INFO REPORT==== 16-Sep-2014::20:53:15 ===
  starting TCP connection &lt;0.239.0&gt; from 127.0.0.1:58163
  
  =ERROR REPORT==== 16-Sep-2014::20:53:18 ===
  exception on TCP connection &lt;0.239.0&gt; from 127.0.0.1:58163
  {channel0_error,starting,
              {amqp_error,access_refused,
                          "AMQPLAIN login refused: user 'guest' - invalid credentials",
                          'connection.start_ok'}}
  
  =INFO REPORT==== 16-Sep-2014::20:53:18 ===
  closing TCP connection &lt;0.239.0&gt; from 127.0.0.1:58163
  </code></pre>
  
  <p>With this, I did the following to ensure that the 'guest' user has permissions to / vhost:</p>
  
  <pre><code>sudo rabbitmqctl set_permissions -p / guest ".*" ".*" ".*"
  </code></pre>
  
  <p>And then I reloaded/restarted rabbitmq service to make sure the changes will take effect,
  then ran the task again. However, the error is still the same.</p>
  
  <p>I even tried creating a different vhost (jm-vhost) and user (jm-user1) and set the permission again to allow all:</p>
  
  <pre><code>sudo rabbitmqctl add_vhost jm-vhost
  sudo rabbitmqctl add_user jm-user1 ""   --&gt; "" to make it passwordless (is this correct?)
  sudo rabbitmqctl set_permissions -p /jm-vhost jm-user1 ".*" ".*" ".*"
  </code></pre>
  
  <p>And then modified tasks.py to this:</p>
  
  <pre><code>app = Celery('tasks', broker='amqp://jm-user1@localhost//jm-vhost')
  </code></pre>
  
  <p>But when I started the tasks, still, I get the same error.
  How should I resolve this? Thanks in advance!</p>