Supervisorctl - Refused connection (even after specifying path -c)

8,277

If you're using the http method then be sure to check the following:

  1. Make sure supervisord is running
  2. Have these enabled (uncommented) in supervisord.conf file:
    a)

    [inet_http_server]         
    port=127.0.0.1:9001
    

    b)

    [supervisorctl]
    serverurl=http://127.0.0.1:9001
    

    c)

    [rpcinterface:supervisor]
    supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
    

Note: The host and port of the inet server and the one which supervisorctl is trying to connect to should be the same.

Share:
8,277

Related videos on Youtube

Milano
Author by

Milano

Updated on September 18, 2022

Comments

  • Milano
    Milano over 1 year

    I can't figure out how to run supervisorctl correctly. There is a supervisord running on my Ubuntu 16.04 server.

    The supervisord.conf path:

    /home/django/Bedueno/supervisord.conf
    

    When I run

    supervisorctl 
    

    or

    supervisorctl -c /home/django/Bedueno/supervisord.conf
    

    console returns

    django@Bedueno-beta-ubuntu-512mb-fra1-01:~$ supervisorctl -c /home/django/Bedueno/supervisord.conf 
    http://localhost:9001 refused connection
    supervisor> reread
    error: <class 'socket.error'>, [Errno 111] Connection refused: file: /usr/lib/python2.7/socket.py line: 575
    supervisor>
    

    Tried already with sudo which didn't help.

    Do you know where is the problem?

    supervisord.conf

    [program:daphne]
    command=/home/django/Bedueno/beduenovenv/bin/daphne Bedueno.asgi:channel_layer --bind 0.0.0.0 -p 8001 ;
    directory=/home/django/Bedueno/ ;
    autostart=true ;
    autorestart=true ;
    
    [program:daphne_worker]
    command=/home/django/Bedueno/beduenovenv/bin/python manage.py runworker ;
    directory=/home/django/Bedueno/ ;
    autostart=true ;
    autorestart=true ;
    [supervisord]
    [supervisorctl]
    

    EDIT

    I realised I have two supervisord.pid and supervisord.log files. Both of them are inside /tmp/ directory and in /home/django/Bedueno/ too. supervisor.sock is only inside /tmp/ directory.

    • Vomit IT - Chunky Mess Style
      Vomit IT - Chunky Mess Style about 6 years
      So the conf points to port 8001 and the connection error is based on port 9001.... seems like an issue to me, right? Be sure you are connecting to the correct port which is listening for the traffic. So --bind 0.0.0.0 -p 8001 in config but error states :9001 refused connection.
    • Milano
      Milano about 6 years
      @PimpJuiceIT 8001 is a port fo daphne asgi. 9001 is supervisors port so it can't be the same in my opinion.
    • Vomit IT - Chunky Mess Style
      Vomit IT - Chunky Mess Style about 6 years
      Okay, so from a web browser on the machine is applicable, see if you can access http://localhost:8001 and also try http://localhost:9001. See if you can telnet into that port and confirm it's listening and use netstat as well to confirm the expected ports are listening on the server. I'm not an Linux expert yet so I was just pointing out the obvious from what I see in the detail you provided. I would test to confirm that the "expected" port is listening to start with next I suppose.
    • Milano
      Milano about 6 years
      telnet 127.0.0.1 9001 returns this: Trying 127.0.0.1... telnet: Unable to connect to remote host: Connection refused and telnet 127.0.0.1 8001 Trying 127.0.0.1... Connected to 127.0.0.1.
    • Vomit IT - Chunky Mess Style
      Vomit IT - Chunky Mess Style about 6 years
      Look over netstat -ano and see if you see any processes listening on those ports from the Local Address column from the ** Active Internet connections (servers and established)** section. You should see <IP Address>:<port> in there somewhere so if it's not listening the something is not correct I would think like the server service is not running perhaps.
    • Milano
      Milano about 6 years
      There is nothing with port 9001. Tried also sudo netstat | grep 9001 which returned nothing.
    • Vomit IT - Chunky Mess Style
      Vomit IT - Chunky Mess Style about 6 years
      Isn't the [supervisorctl] section and perhaps the [supervisord] sections of the supervisord.conf file missing some parameters? Look over those sections per this here: supervisord.org/configuration.html and also read over supervisord.org/running.html if needed to just to ensure you don't see anything there that looks obvious. I think the configuration parameters are missing and maybe that's why it is not starting. Consider putting the logging level to trace or debug mode per that first link and looking over the logs when you try to start it.