Monday, August 31, 2015

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

I was deploying Swift using Seagate's Kinetic drives following the deployment guide in github https://github.com/swiftstack/kinetic-swift/wiki/Deployment

anfield@football:~$ sudo swift-init start main
[sudo] password for mayur:
Starting proxy-server...(/etc/swift/proxy-server.conf)
Starting container-server...(/etc/swift/container-server.conf)
Starting account-server...(/etc/swift/account-server.conf)
Starting object-server...(/etc/swift/object-server.conf)
Traceback (most recent call last):
  File "/usr/local/bin/swift-proxy-server", line 6, in <module>
    exec(compile(open(__file__).read(), __file__, 'exec'))
  File "/home/mayur/git/kinetic-swift/swift/bin/swift-proxy-server", line 23, in <module>
    sys.exit(run_wsgi(conf_file, 'proxy-server', **options))
  File "/home/mayur/git/kinetic-swift/swift/swift/common/wsgi.py", line 878, in run_wsgi
    error_msg = strategy.bind_ports()
  File "/home/mayur/git/kinetic-swift/swift/swift/common/wsgi.py", line 480, in bind_ports
    self.sock = get_socket(self.conf)
  File "/home/mayur/git/kinetic-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

I ran the 'netstat -lntp' command to see which process is using the port 8080.

anfield@football:~$ netstat -lntp
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:6002            0.0.0.0:*               LISTEN      -              
tcp        0      0 127.0.1.1:53            0.0.0.0:*               LISTEN      -              
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      -              
tcp        0      0 127.0.0.1:11211         0.0.0.0:*               LISTEN      -              
tcp        0      0 0.0.0.0:6000            0.0.0.0:*               LISTEN      -              
tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN      4303/python    
tcp        0      0 0.0.0.0:6001            0.0.0.0:*               LISTEN      -              
tcp6       0      0 ::1:631                 :::*                    LISTEN      -              
anfield@football:~$

The 1 indicates a HDD and 0 indicates SSD


 Now that I know which are SSDs and which are HDDs. Here is how I got detailed information on the HDD and SSD

anfield@football:~$ ps -ef | grep 4303
mayur     4303  1541  1 14:22 ?        00:00:03 /usr/bin/python /usr/local/bin/swift-proxy-server /etc/swift/proxy-server.conf
mayur     4308  4303  0 14:22 ?        00:00:00 /usr/bin/python /usr/local/bin/swift-proxy-server /etc/swift/proxy-server.conf
mayur     4375  2432  0 14:26 pts/1    00:00:00 grep --color=auto 4303
anfield@football:~$
anfield@football:~$
anfield@football:~$ kill -9 4303
anfield@football:~$
anfield@football:~$ ps -ef | grep 4303
mayur     4378  2432  0 14:26 pts/1    00:00:00 grep --color=auto 4303
anfield@football:~$

The screen shot above shows the Python process that is using port 8080. I killed the process, and then restarted Swift

The Swift process came up fine after that as shown below.

anfield@football:~$ netstat -lntp
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:6002            0.0.0.0:*               LISTEN      -
tcp        0      0 127.0.1.1:53            0.0.0.0:*               LISTEN      -
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      -
tcp        0      0 127.0.0.1:11211         0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:6000            0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:6001            0.0.0.0:*               LISTEN      -
tcp6       0      0 ::1:631                 :::*                    LISTEN      -

anfield@football:~$ sudo swift-init start main
Starting proxy-server...(/etc/swift/proxy-server.conf)
container-server running (4322 - /etc/swift/container-server.conf)
container-server already started...
account-server running (4323 - /etc/swift/account-server.conf)
account-server already started...
object-server running (4324 - /etc/swift/object-server.conf)
object-server already started...
anfield@football:~$


1 comment:

Anonymous said...

thanks !!!