supervisorctl报错"error: <class 'socket.gaierror'>, [Errno -2] Name or service not known"的解决方法
2016-01-04 22:53
936 查看
如果用Python写过线上的后端服务,相信对Supervisor不会陌生,它包含两个主要工具:
1)supervisord: 用来实现进程守护
2)supervisorctl: 用来实现supervisord对其守护进程的控制,如reload配置文件、启/停其守护的子进程,等等
在使用supervisorctl执行如下命令时,
偶尔会遇到如下报错:
其中,socket.py第553行代码片段如下:
基础库报错?
于是,在第553行前面增加调试代码,print出host和port的值,发现port居然是”9212;”(其中9212是配置文件sup.xxx.conf中指定的supervisorctl的listen端口)
查看sup.xxx.conf文件,发现在supervisorctl的配置部分,配置serverurl时端口后面直接跟着分号,如下示例:
在端口号和注释符;之间加个空格就解决了:
supervisorctl加载配置文件时,居然没有正确解析出注释符,挖的一手好坑。。。
1)supervisord: 用来实现进程守护
2)supervisorctl: 用来实现supervisord对其守护进程的控制,如reload配置文件、启/停其守护的子进程,等等
在使用supervisorctl执行如下命令时,
## 其中sup.xxx.conf是supervisord的配置文件 $ supervisorctl -c conf/sup.xxx.conf
偶尔会遇到如下报错:
error: <class 'socket.gaierror'>, [Errno -2] Name or service not known: file: /home/slvher/python/2.7/lib/python2.7/socket.py line: 553
其中,socket.py第553行代码片段如下:
551 host, port = address 552 err = None 553 for res in getaddrinfo(host, port, 0, SOCK_STREAM): 554 af, socktype, proto, canonname, sa = res 555 sock = None 556 try: 557 sock = socket(af, socktype, proto) 558 if timeout is not _GLOBAL_DEFAULT_TIMEOUT: 559 sock.settimeout(timeout) 560 if source_address: 561 sock.bind(source_address) 562 sock.connect(sa) 563 return sock
基础库报错?
于是,在第553行前面增加调试代码,print出host和port的值,发现port居然是”9212;”(其中9212是配置文件sup.xxx.conf中指定的supervisorctl的listen端口)
查看sup.xxx.conf文件,发现在supervisorctl的配置部分,配置serverurl时端口后面直接跟着分号,如下示例:
[supervisorctl] ;serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket serverurl=http://127.0.0.1:9723; use an http:// url to specify an inet socket
在端口号和注释符;之间加个空格就解决了:
[supervisorctl] ;serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket serverurl=http://127.0.0.1:9723 ; use an http:// url to specify an inet socket
supervisorctl加载配置文件时,居然没有正确解析出注释符,挖的一手好坑。。。
相关文章推荐
- 出现( linker command failed with exit code 1)错误总结(http://blog.csdn.net/hengshujiyi/article/details/21182813)
- Contains Duplicate 数组中是否包含重复元素
- 行为树-学习笔记(2)-rain插件做简单的敌人AI(1)
- ORA-04098: trigger 'SYS.XDB_PI_TRIG' is invalid and failed re-validation
- 人工智能
- POJ3250 Bad Hair Day(单调栈)
- asiainfo亚信——实习日记
- 2048游戏-AI程序算法分析
- Pairing heap
- (实训第一天)讲一讲main函数返回值、参数argc、argv、并模仿登录功能
- 记录遇到的各种rails报错
- mkdir 0755 failed
- Conversion to Dalvik format failed: Unable to execute dex: Multiple dex files define Lcom/squareup/o
- chmod data/cache/zfcache/file.txt 0666 failed
- 自定义View时,用到Paint Canvas的一些温故,简单的帧动画(动画一 ,"掏粪男孩Gif"顺便再提提onWindowFocusChanged)
- 自定义View时,用到Paint Canvas的一些温故,简单的帧动画(动画一 ,"掏粪男孩Gif"顺便再提提onWindowFocusChanged)
- 【题解】QDUOJ.65.again and again
- Mailchimp VS Zoho Campaigns
- iPad Air/Air2/iPhone6 Plus跑分对比
- codeforces 463E . Caisa and Tree