Suervisor http://localhost:9001 refused 或 no such file [最全攻略]
Supervisor http://localhost:9001 refused 或 no such file [最全攻略]
造成該原因有以下幾種情況:
1 你沒有註釋掉配置檔案中內容
如果你想暴漏出埠進行http服務訪問,把9001改成9011或者別的埠試試
如果不想暴漏出來,不需要http服務就全註釋掉如下
2 啟動命令沒有加 配置檔案導致預設要釋出http服務
1 註釋掉如下內容
配置檔案: vim /etc/supervisor/supervisord.conf
2 執行啟動命令
supervisord -c /etc/supervisor/supervisord.conf
[unix_http_server] file=/var/run/supervisor.sock ; the path to the socket file ;chmod=0700 ; socket file mode (default 0700) ;chown=nobody:nogroup ; socket file uid:gid owner ;username=user ; default is no username (open server) ;password=123 ; default is no password (open server) ;[inet_http_server] ; inet (TCP) server disabled by default ;port=127.0.0.1:9001 ; ip_address:port specifier, *:port for all iface ;username=user ; default is no username (open server) ;password=123 ; default is no password (open server) [supervisorctl] serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket ;serverurl=http://127.0.0.1:9001 ; use an http:// url to specify an inet socket ;username=chris ; should be same as in [*_http_server] if set ;password=123 ; should be same as in [*_http_server] if set ;prompt=mysupervisor ; cmd line prompt (default "supervisor") ;history_file=~/.sc_history ; use readline history if available
常見錯誤
報錯:unix:///tmp/supervisor.sock no such file
意思就是沒有找到檔案,因為tmp中的檔案系統會自動清理所有可能導致報錯,
解決方法:
把檔案換位置,同時修改 supervisor.conf 中的檔案路徑
1、修改配置
vim /etc/supervisord.conf
進入配置檔案,修改所有的tmp的路徑
/tmp/supervisor.sock 修改 /var/run/supervisor.sock /tmp/supervisord.log 修改 /var/log/supervisor.log /tmp/supervisord.pid 修改 /var/run/supervisor.pid
2、修改檔案許可權
sudo chmod 777 /run
sudo chmod 777 /var/log
3、建立supervisor.sock,並修改許可權
sudo touch /var/run/supervisor.sock
sudo chmod 777 /var/run/supervisor.sock
然後啟動supervisor就可以
報錯:unix:///var/run/supervisor.sock refused connection
說明沒有啟動supervisor,
執行命令就可解決
supervisord -c /etc/supervisord.conf
常用命令
supervisorctl status //檢視所有程序的狀態 supervisorctl stop all //停止所有程序 supervisorctl start all //啟動所有程序 supervisorctl restart //重啟 supervisorctl update //配置檔案修改後使用該命令載入新的配置 supervisorctl reload //重新啟動配置中的所有程式
————————————————
最後大招
如果執行supervisorctl status 等命令不好使,還不好使
執行一下:supervisorctl reload
神奇的一幕出現!
再執行supervisorctl status 命令好使了!
————————————————
如果還不行,給我留言,或者看我其它文件,我打算把整個詳細安裝過程寫一系列,包括mongo、elasticsearch、redis、nginx 等等配置!