Exception: Could not bind to 0.0.0.0:8080 after trying for 30 seconds

swift@vincent-virtual-machine /etc/swift $ sudo swift-init main restart
Signal proxy-server  pid: 5688  signal: 15
No proxy-server running
Signal container-server  pid: 5689  signal: 15
Signal container-server  pid: 5690  signal: 15
Signal container-server  pid: 5691  signal: 15
Signal container-server  pid: 5692  signal: 15
Signal account-server  pid: 5693  signal: 15
Signal account-server  pid: 5694  signal: 15
Signal account-server  pid: 5695  signal: 15
Signal account-server  pid: 5696  signal: 15
Signal object-server  pid: 5697  signal: 15
Signal object-server  pid: 5698  signal: 15
Signal object-server  pid: 5699  signal: 15
Signal object-server  pid: 5700  signal: 15
container-server (5689) appears to have stopped
container-server (5690) appears to have stopped
container-server (5691) appears to have stopped
container-server (5692) appears to have stopped
account-server (5696) appears to have stopped
account-server (5694) appears to have stopped
account-server (5695) appears to have stopped
object-server (5698) appears to have stopped
object-server (5700) appears to have stopped
account-server (5693) appears to have stopped
object-server (5697) appears to have stopped
object-server (5699) appears to have stopped
Starting proxy-server...(/etc/swift/proxy-server.conf)
Starting container-server...(/etc/swift/container-server/1.conf)
Starting container-server...(/etc/swift/container-server/2.conf)
Starting container-server...(/etc/swift/container-server/3.conf)
Starting container-server...(/etc/swift/container-server/4.conf)
Starting account-server...(/etc/swift/account-server/1.conf)
Starting account-server...(/etc/swift/account-server/2.conf)
Starting account-server...(/etc/swift/account-server/3.conf)
Starting account-server...(/etc/swift/account-server/4.conf)
Starting object-server...(/etc/swift/object-server/1.conf)
Starting object-server...(/etc/swift/object-server/2.conf)
Starting object-server...(/etc/swift/object-server/3.conf)
Starting object-server...(/etc/swift/object-server/4.conf)
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@vincent-virtual-machine /etc/swift $ sudo netstat -ltnp | grep 8080
tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN      3251/python     
swift@vincent-virtual-machine /etc/swift $ 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@vincent-virtual-machine /etc/swift $ sudo kill -9 3251
swift@vincent-virtual-machine /etc/swift $ sudo netstat -ltnp | grep 8080
tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN      3256/python     
swift@vincent-virtual-machine /etc/swift $ 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@vincent-virtual-machine /etc/swift $ sudo kill -9 3256
swift@vincent-virtual-machine /etc/swift $ sudo netstat -ltnp | grep 8080


原文地址:https://www.cnblogs.com/vincent4code/p/4905139.html