swift seting question by httplib.BadStatusLine

Asked by youkey

When I seting swauth happen the problem
the question like tienbm said
https://answers.launchpad.net/swift/+question/174458

 swauth-prep -K swauthkey
Traceback (most recent call last):
  File "/usr/local/bin/swauth-prep", line 5, in <module>
    pkg_resources.run_script('swauth==1.0.3.dev', 'swauth-prep')
  File "/usr/lib/python2.6/dist-packages/pkg_resources.py", line 467, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python2.6/dist-packages/pkg_resources.py", line 1200, in run_script
    execfile(script_filename, namespace, namespace)
  File "/usr/local/lib/python2.6/dist-packages/swauth-1.0.3.dev-py2.6.egg/EGG-INFO/scripts/swauth-prep", line 57, in <module>
    resp = conn.getresponse()
  File "/usr/lib/python2.6/dist-packages/swift/common/bufferedhttp.py", line 95, in getresponse
    response = HTTPConnection.getresponse(self)
  File "/usr/lib/python2.6/httplib.py", line 990, in getresponse
    response.begin()
  File "/usr/lib/python2.6/httplib.py", line 391, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python2.6/httplib.py", line 355, in _read_status
    raise BadStatusLine(line)

I do by Marcelo Martins (btorch) said
by the problem still happen
Please help me resolve this problem.
Thank.

Question information

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

Please provide you proxy config

Revision history for this message
youkey (lilac-lkd) said :
#2

this is my proxy-config
my proxy-server ip is 192.168.203.129 port 8088
I hange to 8080 the problem can't resolve

[DEFAULT]
cert_file = /etc/swift/cert.crt
key_file = /ect/swift/cert.key
bind_port = 8088
workers = 8
user = swift

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

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

[filter:swauth]
use = egg:swauth#swauth
set log_name = swauth
set log_level = DEBUG
set log_headers=true
default_swift_cluster = local#http://192.168.203.129:8088/v1#http://127.0.0.1:8088/v1
super_admin_key = swauthkey

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

[filter:cache]
use = egg:swift#memcache
memcache_servers = 192.168.203.129:11211

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

Hi youkey,

The first thing you have to do there is to change your "default_swift_cluster" URLs to use the correct protocol. Since you have SSL enabled, you need to have HTTPS and not HTTP.

Once you have made those changes and restarted the proxies, then try using a swauth command and also specify the AUTH_URL on the command line argument since you are no longer using the default URL.

Revision history for this message
youkey (lilac-lkd) said :
#4

I check my Environment,I have the HTTP protocol。
Because Use then https may produce error "socket.error: [Errno 104] Connection reset by peer"

more information
I use 5 nodes
these is my ring builder
root@ubuntuProxy:/etc/swift# swift-ring-builder account.builder
account.builder, build version 5
262144 partitions, 3 replicas, 5 zones, 5 devices, 0.00 balance
The minimum number of hours before a partition can be reassigned is 1
Devices: id zone ip address port name weight partitions balance meta
             0 1 192.168.203.130 6002 sdb1 100.00 157286 -0.00
             1 2 192.168.203.131 6002 sdb1 100.00 157287 0.00
             2 3 192.168.203.132 6002 sdb1 100.00 157286 -0.00
             3 4 192.168.203.133 6002 sdb1 100.00 157286 -0.00
             4 5 192.168.203.134 6002 sdb1 100.00 157287 0.00

root@ubuntuProxy:/etc/swift# swift-ring-builder container.builder
container.builder, build version 5
262144 partitions, 3 replicas, 5 zones, 5 devices, 0.00 balance
The minimum number of hours before a partition can be reassigned is 1
Devices: id zone ip address port name weight partitions balance meta
             0 1 192.168.203.130 6001 sdb1 100.00 157286 -0.00
             1 2 192.168.203.131 6001 sdb1 100.00 157286 -0.00
             2 3 192.168.203.132 6001 sdb1 100.00 157287 0.00
             3 4 192.168.203.133 6001 sdb1 100.00 157286 -0.00
             4 5 192.168.203.134 6001 sdb1 100.00 157287 0.00

root@ubuntuProxy:/etc/swift# swift-ring-builder object.builder
object.builder, build version 5
262144 partitions, 3 replicas, 5 zones, 5 devices, 0.00 balance
The minimum number of hours before a partition can be reassigned is 1
Devices: id zone ip address port name weight partitions balance meta
             0 1 192.168.203.130 6000 sdb1 100.00 157286 -0.00
             1 2 192.168.203.131 6000 sdb1 100.00 157286 -0.00
             2 3 192.168.203.132 6000 sdb1 100.00 157287 0.00
             3 4 192.168.203.133 6000 sdb1 100.00 157287 0.00
             4 5 192.168.203.134 6000 sdb1 100.00 157286 -0.00

my swauth version is :gholt-swauth-1.0.2-14-ga33cbb8.tar.gz

one of then node seting

account-server.conf
[DEFAULT]
bind_ip = 192.168.203.131
workers = 2
[pipeline:main]
pipeline = account-server
[app:account-server]
use = egg:swift#account
[account-replicator]
[account-auditor]
[account-reaper]

container-server.conf
[DEFAULT]
bind_ip = 192.168.203.131
workers = 2
[pipeline:main]
pipeline = container-server
[app:container-server]
use = egg:swift#container
[container-replicator]
[container-updater]
[container-auditor]

object-server.conf
[DEFAULT]
bind_ip = 192.168.203.131
workers = 2
[pipeline:main]
pipeline = object-server
[app:object-server]
use = egg:swift#object
[object-replicator]
[object-updater]
[object-auditor]

Revision history for this message
youkey (lilac-lkd) said :
#5

First,very thanks for your answer。
Can't you tell my how to changen HTTP to HTTPS protocol?
How to seting the swauth?The part of swauth seting Confused me。

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

Hi youkey,

Since you have the "cert_file" & "key_file" enabled in the proxy configuration, you have SSL enabled and therefore you should be using HTTPS to talk to your proxies.

You need to change the URLs in the "default_swift_cluster" to use HTTPS:

From:
default_swift_cluster = local#http://192.168.203.129:8088/v1#http://127.0.0.1:8088/v1

To:
default_swift_cluster = local#https://192.168.203.129:8088/v1#https://127.0.0.1:8088/v1

Once you've done the changes above, restart the proxy-server service.
Then you can initialize the swauth system with "swauth-prep -K swauthkey -A https://127.0.0.1:8088/auth/"

From gholt''s README (w/ changes to AUTH URL):

6) Add an account/user swauth-add-user -A https://127.0.0.1:8088/auth/ -K swauthkey -a test tester testing

7) Ensure it works swift -A https://127.0.0.1:8088/auth/v1.0 -U test:tester -K testing stat -v

Let me know how that works :) hope it helps

Revision history for this message
youkey (lilac-lkd) said :
#7

Hi Marcelo Martins (btorch)
My proglem have resolved. Thanks a lot.
Your answer remind me. My HTTPS seting have proglem.But i don't know hao to resolved it.
So i change my proxy-server.conf.
change to:
[DEFAULT]
#cert_file = /etc/swift/cert.crt
#key_file = /ect/swift/cert.key
bind_port = 8088
workers = 8
user = swift

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

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

[filter:swauth]
use = egg:swauth#swauth
set log_name = swauth
set log_level = DEBUG
set log_headers=true
default_swift_cluster = local#http://192.168.203.129:8088/v1#http://127.0.0.1:8088/v1
super_admin_key = swauthkey

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

[filter:cache]
use = egg:swift#memcache
memcache_servers = 192.168.203.129:11211

Use HTTP get. It work.Thank you for your help!
First to contact with swift,Still have a lot questions,I hope to keep in touch with you.

If you know,Can you tell me how to seting https?

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

Hi youkey,

I'm glad all is working now... in regards to HTTPS just open a new question and we should be able to help you out. Make sure you provide what errors you see and any changes to the proxy config.