Failed to run the swift after following the guide http://docs.openstack.org/developer/swift/development_saio.html

Asked by George Huang

Hello,
I used this docments http://docs.openstack.org/developer/swift/development_saio.html to install swift on Ubuntu12.04 in my virtual machine.I selected the loopback device for the storage and followed the configuration guides.

There is a little problem when excute "sudo pip install -r swift/test-requirements.txt",but it's all right when run the "cp ~/swift/test/sample.conf /etc/swift/test.conf" .and when it comes to run the shell "curl -v -H 'X-Storage-User: test:tester' -H 'X-Storage-Pass: testing' http://127.0.0.1:8080/auth/v1.0" ,it returns the "try 127.0.0.1 ... connecttion refused"

when run the commads as following:
root@qihuaVM:~/swift# swift -A http://127.0.0.1:8080/auth/v1.0 -U test:tester -K testing stat
No handlers could be found for logger "swiftclient"
[Errno 111] Connection refused

I don't know why,sorry for my poor description of my problem,any idea will be apreciated!

Question information

Language:
English Edit question
Status:
Answered
For:
OpenStack Object Storage (swift) Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Marcelo Martins (btorch) said :
#1

is the proxy hung listening on that port ? As root run "swift-init all stop" and then check if there is anything listening on 8080. if there is, check what it is and kill it. Then start everything back online with "swift-init all start" .. btw, what version is this ?

Revision history for this message
George Huang (ghuang) said :
#2

Hi Marcelo,

Thanks for your reply. I am using Ubuntu 10.04 and swift 1.4.0. I followed SAIO 1.4.0 to install and configure my swift. Here's my port stat:

ghuang@ubuntu:~$ nmap 127.0.0.1

Starting Nmap 5.00 ( http://nmap.org ) at 2011-06-26 18:52 PDT
Interesting ports on localhost (127.0.0.1):
Not shown: 993 closed ports
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
873/tcp open rsync
3260/tcp open iscsi
8080/tcp open http-proxy
8443/tcp open https-alt
9001/tcp open tor-orport

Does this look normal to you? Also, how do I change the http-proxy port not to be 8080?

Thanks.

Revision history for this message
George Huang (ghuang) said :
#3

ghuang@ubuntu:~$ netstat -an --tcp|grep 8080
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN

How do I kill http-proxy service?

Thanks.

Revision history for this message
Marcelo Martins (btorch) said :
#4

Hi

Although the nmap scan is helpful, it would be better if you provide a "netstat -ntpl" output run as root. I can't tell what is attached to port 8080, it could be any other real service and not swift.

Revision history for this message
Marcelo Martins (btorch) said :
#5

If run the command I mentioned as root and you will see the pid for it. Then you can make the decision to kill it if it's a bad swift-proxy hung. It could also be a legitimate service you already have listening on that port, if so change the swift-proxy port to something else.

Revision history for this message
George Huang (ghuang) said :
#6

Hi Marcelo,

Running "netstat -ntpl" as root really helps. Now I can see which process is really listening on port 8080. After killing that process, I can now starting swift proxy-server and run st command.

If I am going to change the swift-proxy port to say 8088, what configuration change do I need to make? Is it the bind_port in /etc/swift/proxy-server.conf the only place I need to modify? Do I need to do anything else after modifying /etc/swift/proxy-server.conf?

Thanks so much for your help!

Revision history for this message
Marcelo Martins (btorch) said :
#7

Hi George,

Yes you will need to change bind_port.

Are you using swauth for authentication ? If so you will also need to change/add the "default_swift_cluster" url to contain the correct port within the "[filter:swauth]" section of the proxy configuration.

Revision history for this message
George Huang (ghuang) said :
#8

Hi Marcelo,

I am trying to change the proxy port to say 8088 and here's my /etc/swift/proxy-server.conf:

[DEFAULT]
bind_port = 8088
user = ghuang
log_facility = LOG_LOCAL1

[pipeline:main]
pipeline = healthcheck cache swauth proxy-server

[app:proxy-server]
use = egg:swift#proxy
allow_account_management = true

[filter:swauth]
use = egg:swift#swauth
default_swift_cluster = local#http://127.0.0.1:8088/v1
# Highly recommended to change this.
super_admin_key = xxxxxxxx

[filter:healthcheck]
use = egg:swift#healthcheck

[filter:cache]
use = egg:swift#memcache

So after updating the bind_port and adding default_swift_cluster, I was able to start proxy-server to listen on port 8088, but when I tried the following, I got connection refused error. Any idea?

ghuang@ubuntu:~$ st -A http://127.0.0.1:8088/auth/v1.0 -U test:tester -K testing stat
Traceback (most recent call last):
  File "/usr/local/bin/st", line 7, in <module>
    execfile(__file__)
  File "/home/ghuang/swift/trunk/bin/st", line 1715, in <module>
    error_queue)
  File "/home/ghuang/swift/trunk/bin/st", line 1256, in st_stat
    headers = conn.head_account()
  File "/home/ghuang/swift/trunk/bin/st", line 764, in head_account
    return self._retry(head_account)
  File "/home/ghuang/swift/trunk/bin/st", line 742, in _retry
    rv = func(self.url, self.token, *args, **kwargs)
  File "/home/ghuang/swift/trunk/bin/st", line 273, in head_account
    conn.request('HEAD', parsed.path, '', {'X-Auth-Token': token})
  File "/usr/lib/python2.6/httplib.py", line 910, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib/python2.6/httplib.py", line 947, in _send_request
    self.endheaders()
  File "/usr/lib/python2.6/httplib.py", line 904, in endheaders
    self._send_output()
  File "/usr/lib/python2.6/httplib.py", line 776, in _send_output
    self.send(msg)
  File "/usr/lib/python2.6/httplib.py", line 735, in send
    self.connect()
  File "/home/ghuang/swift/trunk/swift/common/bufferedhttp.py", line 80, in connect
    return HTTPConnection.connect(self)
  File "/usr/lib/python2.6/httplib.py", line 716, in connect
    self.timeout)
  File "/usr/lib/pymodules/python2.6/eventlet/green/socket.py", line 59, in create_connection
    raise error, msg
socket.error: [Errno 111] ECONNREFUSED

Thanks.

Revision history for this message
Marcelo Martins (btorch) said :
#9

Hi George,

Try using curl to authenticate and see what Storage URL you are given back. If you have not changed the account storage url using "swauth-set-account-service" tool, then most likely you are getting back an url with the old port.

You could also run "swauth-list -K testing test" to see the URL given back.

Curl:
curl -i -H "X-Auth-User: test:tester" -H "X-Auth-Key: testing" http://127.0.0.1:8088/auth/v1.0

Revision history for this message
George Huang (ghuang) said :
#10

Hi Marcelo,

I tried curl -i -H "X-Auth-User: test:tester" -H "X-Auth-Key: testing" http://127.0.0.1:8088/auth/v1.0, but got:

ghuang@ubuntu:~$ curl -i -H "X-Auth_user: test:tester" -H "X-Auth-Key: testing" http://127.0.0.1:8088/auth/v1.0
HTTP/1.1 404 Not Found
Content-Length: 154
Content-Type: text/html; charset=UTF-8
Date: Tue, 28 Jun 2011 21:27:23 GMT

<html>
 <head>
  <title>404 Not Found</title>
 </head>
 <body>
  <h1>404 Not Found</h1>
  The resource could not be found.<br /><br />
 </body>
</html>
ghuang@ubuntu:~$

I then tried "swauth-set-account-service" tool, and got

ghuang@ubuntu:~$ swauth-set-account-service -K xxxxxxxx -A http://127.0.0.1:8088/auth/v1.0
Usage: swauth-set-account-service [options] <account> <service> <name> <value>

Sets a service URL for an account. Can only be set by a reseller admin.

Example: swauth-set-account-service -K swauthkey test storage local http://127.0.0.1:8080/v1/AUTH_018c3946-23f8-4efb-a8fb-b67aae8e4162

Options:
  -h, --help show this help message and exit
  -A ADMIN_URL, --admin-url=ADMIN_URL
                        The URL to the auth subsystem (default:
                        http://127.0.0.1:8080/auth/)
  -U ADMIN_USER, --admin-user=ADMIN_USER
                        The user with admin rights to add users (default:
                        .super_admin).
  -K ADMIN_KEY, --admin-key=ADMIN_KEY
                        The key for the user with admin rights to add users.
ghuang@ubuntu:~$ swauth-set-account-service -K xxxxxxxx -A http://127.0.0.1:8088/auth/v1.0 test storage local http://127.0.0.1:8088/auth/v1.0
Service set failed: 400 Bad Request

What did I do wrong? I think it's still using port 8080. What should I do?

Thanks.

Revision history for this message
George Huang (ghuang) said :
#11

BTW, I am using swift 1.4.0, not 1.4.2. I noticed the documentation on http://swift.openstack.org/development_saio.html is for 1.4.2. Where can I find the documentation on 1.4.0?

Thanks.

Revision history for this message
George Huang (ghuang) said :
#12

I think I have a typo on curl command I posted. Here's the correct one, but still got "404 Not Found":

ghuang@ubuntu:~$ curl -v -H "X-Auth-User: test:tester" -H "X-Auth-Key: testing" http://127.0.0.1:8088/auth/v1.0
* About to connect() to proxy 127.0.0.1 port 8088 (#0)
* Trying 127.0.0.1... connected
* Connected to 127.0.0.1 (127.0.0.1) port 8088 (#0)
> GET http://127.0.0.1:8088/auth/v1.0 HTTP/1.1
> User-Agent: curl/7.19.7 (x86_64-pc-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8k zlib/1.2.3.3 libidn/1.15
> Host: 127.0.0.1:8088
> Accept: */*
> Proxy-Connection: Keep-Alive
> X-Auth-User: test:tester
> X-Auth-Key: testing
>
< HTTP/1.1 404 Not Found
< Content-Length: 154
< Content-Type: text/html; charset=UTF-8
< Date: Tue, 28 Jun 2011 21:48:39 GMT
<
<html>
 <head>
  <title>404 Not Found</title>
 </head>
 <body>
  <h1>404 Not Found</h1>
  The resource could not be found.<br /><br />
 </body>
* Connection #0 to host 127.0.0.1 left intact
* Closing connection #0
</html>

Thanks.

Revision history for this message
Marcelo Martins (btorch) said :
#13

For "swauth-set-account-service ", you are providing an incorrect ADMIN_URL (check the example provided by --help) .. it should be "http://127.0.0.1:8088/auth/ " and not "http://127.0.0.1:8088/auth/v1.0"

I'm not sure about docs for 1.4.0, try asking in the #openstack channel. The person that generates those are always on the channel.

For the "404" that you received, check the syslog to find out what errors you are really getting.

A couple of other things you could try, is to use the swauth tools to see if you can list, create, delete accounts/users .. then if those work try using a new account to auth using url

Revision history for this message
Marcelo Martins (btorch) said :
#14

Hope it's working now.

Can you help with this problem?

Provide an answer of your own, or ask George Huang for more information if necessary.

To post a message you must log in.