启动swift服务的时候出现Exception: Could not bind to 0.0.0.0:8080 after trying for 30 seconds

当修改服务器文件之后,需要重启swift服务。有时候使用sudo swift-init restart main的时候,会出现如下错误:

Traceback (most recent call last):
  File "/usr/local/bin/swift-proxy-server", line 10, in <module>
    execfile(__file__)
  File "/home/swift/swift/bin/swift-proxy-server", line 23, in <module>
    sys.exit(run_wsgi(conf_file, 'proxy-server', **options))
  File "/home/swift/swift/swift/common/wsgi.py", line 878, in run_wsgi
    error_msg = strategy.bind_ports()
  File "/home/swift/swift/swift/common/wsgi.py", line 480, in bind_ports
    self.sock = get_socket(self.conf)
  File "/home/swift/swift/swift/common/wsgi.py", line 201, in get_socket
    bind_addr[0], bind_addr[1], bind_timeout))
Exception: Could not bind to 0.0.0.0:8080 after trying for 30 seconds

这种情况很常见,就是端口占用的问题。解决办法:

swift@ubuntu:~$ sudo netstat -ltnp | grep 8080
tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN      3251/python     
swift@ubuntu:~$ ps -wlp 3251
F S   UID    PID   PPID  C PRI  NI ADDR SZ WCHAN  TTY          TIME CMD
0 S  1001   3251      1  1  80   0 - 22488 poll_s ?        00:01:28 swift-proxy-ser
swift@ubuntu:~$ sudo kill -9 3251
swift@ubuntu:~$ sudo netstat -ltnp | grep 8080
tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN      3256/python     
swift@ubuntu:~$ ps -wlp 3256
F S   UID    PID   PPID  C PRI  NI ADDR SZ WCHAN  TTY          TIME CMD
1 S  1001   3256      1  0  80   0 - 22950 poll_s ?        00:00:00 swift-proxy-ser
swift@ubuntu:~$ sudo kill -9 3256
swift@ubuntu:~$ sudo netstat -ltnp | grep 8080
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值