[仅做备份]Openstack 学习记录 (1 Swift SAIO安装)

安装于:UBUNTU64D 使用ubuntu12.04.1,包含eclipse+pydev。仅做为个人SAIO尝试安装的记录。以免后面忘记

安装环境为虚拟机,预分配8G空间磁盘,安装过程完成后虚拟磁盘直接拷贝出来备份,以免今后操作破坏环境而再次安装。

安装的结果并没有完全达到预期,仅仅是完成了一个基本可用的SAIO安装的swift。

===============================================================

root@aaron218VM1:/# apt-get install python-software-properties

正在读取软件包列表... 完成
正在分析软件包的依赖关系树       
正在读取状态信息... 完成       
python-software-properties 已经是最新的版本了。

升级了 0 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 14 个软件包未被升级。

大概是使用apt-get update/upgrade更新整个系统的时候完成了全部的更新


root@aaron218VM1:/# add-apt-repository ppa:swift-core/release
You are about to add the following PPA to your system:
 
 More info: https://launchpad.net/~swift-core/+archive/release
Press [ENTER] to continue or ctrl-c to cancel adding it

gpg: 钥匙环‘/tmp/tmpX9D_3A/secring.gpg’已建立
gpg: 钥匙环‘/tmp/tmpX9D_3A/pubring.gpg’已建立
gpg: 下载密钥‘562598B4’,从 hkp 服务器 keyserver.ubuntu.com
gpg: /tmp/tmpX9D_3A/trustdb.gpg:建立了信任度数据库
gpg: 密钥 562598B4:公钥“Launchpad Swift Packages”已导入
gpg: 合计被处理的数量:1
gpg:               已导入:1  (RSA: 1)

OK

增加源

root@aaron218VM1:/# apt-get update

内容省略,中间会获取一些软件包,更新一些数据。有时候会有一些无法下载的问题,可以尝试重复执行命令。

root@aaron218VM1:/# apt-get install curl gcc git-core memcached python-coverage python-dev python-nose python-setuptools python-simplejson python-xattr sqlite3 xfsprogs python-eventlet python-greenlet python-pastedeploy python-netifaces python-pip
正在读取软件包列表... 完成
正在分析软件包的依赖关系树       
正在读取状态信息... 完成       
gcc 已经是最新的版本了。
python-simplejson 已经是最新的版本了。
将会安装下列额外的软件包:
  git git-man liberror-perl libexpat1-dev libreadline5 libssl-dev libssl-doc
  python-formencode python-openid python-paste python-pastescript python-scgi
  python2.7-dev zlib1g-dev
建议安装的软件包:
  git-daemon-run git-daemon-sysvinit git-doc git-el git-arch git-cvs git-svn
  git-email git-gui gitk gitweb libcache-memcached-perl libmemcached
  libjs-jquery-tablesorter python-dns python-greenlet-doc python-greenlet-dev
  python-greenlet-dbg python-nose-doc python-pastewebkit libapache2-mod-wsgi
  libapache2-mod-python libapache2-mod-scgi python-pgsql libjs-sphinxdoc
  libjs-mochikit python-flup python-cherrypy python-cheetah sqlite3-doc
  xfsdump attr quota
下列【新】软件包将被安装:
  curl git git-core git-man liberror-perl libexpat1-dev libreadline5
  libssl-dev libssl-doc memcached python-coverage python-dev python-eventlet
  python-formencode python-greenlet python-netifaces python-nose python-openid
  python-paste python-pastedeploy python-pastescript python-pip python-scgi
  python-setuptools python-xattr python2.7-dev sqlite3 xfsprogs zlib1g-dev
升级了 0 个软件包,新安装了 29 个软件包,要卸载 0 个软件包,有 14 个软件包未被升级。
需要下载 42.6 MB 的软件包。
解压缩后会消耗掉 75.7 MB 的额外空间。

更新 安装所依赖的软件包,同样,如果出现错误,可以尝试重复执行命令。

root@aaron218VM1:/# pip install mock
Downloading/unpacking mock
  Downloading mock-1.0.1.tar.gz (818Kb): 818Kb downloaded
  Running setup.py egg_info for package mock
    
    warning: no files found matching '*.png' under directory 'docs'
    warning: no files found matching '*.css' under directory 'docs'
    warning: no files found matching '*.html' under directory 'docs'
    warning: no files found matching '*.js' under directory 'docs'
Installing collected packages: mock
  Running setup.py install for mock
    
    warning: no files found matching '*.png' under directory 'docs'
    warning: no files found matching '*.css' under directory 'docs'
    warning: no files found matching '*.html' under directory 'docs'
    warning: no files found matching '*.js' under directory 'docs'
Successfully installed mock
Cleaning up...
安装mock,其后根据需要安装ssh等

root@aaron218VM1:~# mkdir /srv
root@aaron218VM1:/srv# dd if=/dev/zero of=/srv/swift-disk bs=1024 count=0 seek=1000000
root@aaron218VM1:/srv# mkfs.xfs -i size=1024 /srv/swift-disk
meta-data=/srv/swift-disk        isize=1024   agcount=4, agsize=62500 blks
         =                       sectsz=512   attr=2, projid32bit=0
data     =                       bsize=4096   blocks=250000, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0
log      =internal log           bsize=4096   blocks=1216, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =无                    extsz=4096   blocks=0, rtextents=0
创建一个xfs的分区。


编辑文件 /etc/fstab 并写入

/srv/swift-disk /mnt/sdb1 xfs loop,noatime,nodiratime,nobarrier,logbufs=8 0 0

root@aaron218VM1:/srv# mkdir /mnt/sdb1
root@aaron218VM1:/srv# mount /mnt/sdb1
root@aaron218VM1:/srv# mkdir /mnt/sdb1/1 /mnt/sdb1/2 /mnt/sdb1/3 /mnt/sdb1/4
root@aaron218VM1:/srv# chown root:root /mnt/sdb1/*
root@aaron218VM1:/srv# for x in {1..4}; do ln -s /mnt/sdb1/$x /srv/$x; done
root@aaron218VM1:/srv# mkdir -p /etc/swift/object-server /etc/swift/container-server /etc/swift/account-server /srv/1/node/sdb1 /srv/2/node/sdb2 /srv/3/node/sdb3 /srv/4/node/sdb4 /var/run/swift
root@aaron218VM1:/srv# chown -R root:root /etc/swift /srv/[1-4]/ /var/run/swift
创建按照loopback方式创建的分区,并且分配目录和权限。
编辑文件 /etc/rc.local。并且在内容的exit 0 之前加入以下内容:

mkdir -p /var/cache/swift /var/cache/swift2 /var/cache/swift3 /var/cache/swift4
chown : /var/cache/swift*
mkdir -p /var/run/swift
chown : /var/run/swift

配置RSYNC

创建文件 /etc/rsyncd.conf 并加入一下内容:

uid = root
gid = root
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
address = 127.0.0.1

[account6012]
max connections = 25
path = /srv/1/node/
read only = false
lock file = /var/lock/account6012.lock

[account6022]
max connections = 25
path = /srv/2/node/
read only = false
lock file = /var/lock/account6022.lock

[account6032]
max connections = 25
path = /srv/3/node/
read only = false
lock file = /var/lock/account6032.lock

[account6042]
max connections = 25
path = /srv/4/node/
read only = false
lock file = /var/lock/account6042.lock


[container6011]
max connections = 25
path = /srv/1/node/
read only = false
lock file = /var/lock/container6011.lock

[container6021]
max connections = 25
path = /srv/2/node/
read only = false
lock file = /var/lock/container6021.lock

[container6031]
max connections = 25
path = /srv/3/node/
read only = false
lock file = /var/lock/container6031.lock

[container6041]
max connections = 25
path = /srv/4/node/
read only = false
lock file = /var/lock/container6041.lock


[object6010]
max connections = 25
path = /srv/1/node/
read only = false
lock file = /var/lock/object6010.lock

[object6020]
max connections = 25
path = /srv/2/node/
read only = false
lock file = /var/lock/object6020.lock

[object6030]
max connections = 25
path = /srv/3/node/
read only = false
lock file = /var/lock/object6030.lock

[object6040]
max connections = 25
path = /srv/4/node/
read only = false
lock file = /var/lock/object6040.lock
然后,在Ubuntu系统下,修改/etc/default/rsync文件,将RSYNCENABLE改成true

创建文件/etc/rsyslog.d/10-swift.conf,写入以下内容:

# Uncomment the following to have a log containing all logs together
#local1,local2,local3,local4,local5.*   /var/log/swift/all.log

# Uncomment the following to have hourly proxy logs for stats processing
#$template HourlyProxyLog,"/var/log/swift/hourly/%$YEAR%%$MONTH%%$DAY%%$HOUR%"
#local1.*;local1.!notice ?HourlyProxyLog

local1.*;local1.!notice /var/log/swift/proxy.log
local1.notice           /var/log/swift/proxy.error
local1.*                ~

local2.*;local2.!notice /var/log/swift/storage1.log
local2.notice           /var/log/swift/storage1.error
local2.*                ~

local3.*;local3.!notice /var/log/swift/storage2.log
local3.notice           /var/log/swift/storage2.error
local3.*                ~

local4.*;local4.!notice /var/log/swift/storage3.log
local4.notice           /var/log/swift/storage3.error
local4.*                ~

local5.*;local5.!notice /var/log/swift/storage4.log
local5.notice           /var/log/swift/storage4.error
local5.*                ~
编辑文件/etc/rsyslog.conf,并修改以下内容

$PrivDropToGroup adm

root@aaron218VM1:/srv# mkdir -p /var/log/swift/hourly
root@aaron218VM1:/srv# chown -R syslog.adm /var/log/swift
root@aaron218VM1:/srv# chmod -R g+w /var/log/swift
root@aaron218VM1:/srv# service rsyslog restart
rsyslog stop/waiting
rsyslog start/running, process 3249
配置log服务并重启

获取代码并配置测试环境,下面的操作可以在来宾账户下面运行(或者其他需要开发测试的账户,本机上是aaron218)

aaron218@aaron218VM1:~$ mkdir ~/bin

aaron218@aaron218VM1:~$ git clone https://github.com/openstack/swift.git
Cloning into 'swift'...
remote: Counting objects: 16685, done.
remote: Compressing objects: 100% (4046/4046), done.
remote: Total 16685 (delta 12860), reused 16000 (delta 12373)
Receiving objects: 100% (16685/16685), 10.18 MiB | 688 KiB/s, done.
Resolving deltas: 100% (12860/12860), done.


aaron218@aaron218VM1:~$ cd ~/swift; sudo python setup.py develop
[sudo] password for aaron218:
running develop
Checking .pth file support in /usr/local/lib/python2.7/dist-packages/
/usr/bin/python -E -c pass
TEST PASSED: /usr/local/lib/python2.7/dist-packages/ appears to support .pth files
running egg_info
creating swift.egg-info
writing requirements to swift.egg-info/requires.txt
writing swift.egg-info/PKG-INFO
writing top-level names to swift.egg-info/top_level.txt
writing dependency_links to swift.egg-info/dependency_links.txt
writing entry points to swift.egg-info/entry_points.txt
writing manifest file 'swift.egg-info/SOURCES.txt'
reading manifest file 'swift.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'swift.egg-info/SOURCES.txt'
running build_ext
Creating /usr/local/lib/python2.7/dist-packages/swift.egg-link (link to .)
Adding swift 1.7.6 to easy-install.pth file
Installing swift-account-audit script to /usr/local/bin
Installing swift-account-auditor script to /usr/local/bin
Installing swift-account-reaper script to /usr/local/bin
Installing swift-account-replicator script to /usr/local/bin
Installing swift-account-server script to /usr/local/bin
Installing swift-bench script to /usr/local/bin
Installing swift-bench-client script to /usr/local/bin
Installing swift-container-auditor script to /usr/local/bin
Installing swift-container-replicator script to /usr/local/bin
Installing swift-container-server script to /usr/local/bin
Installing swift-container-sync script to /usr/local/bin
Installing swift-container-updater script to /usr/local/bin
Installing swift-dispersion-populate script to /usr/local/bin
Installing swift-dispersion-report script to /usr/local/bin
Installing swift-drive-audit script to /usr/local/bin
Installing swift-form-signature script to /usr/local/bin
Installing swift-get-nodes script to /usr/local/bin
Installing swift-init script to /usr/local/bin
Installing swift-object-auditor script to /usr/local/bin
Installing swift-object-expirer script to /usr/local/bin
Installing swift-object-info script to /usr/local/bin
Installing swift-object-replicator script to /usr/local/bin
Installing swift-object-server script to /usr/local/bin
Installing swift-object-updater script to /usr/local/bin
Installing swift-oldies script to /usr/local/bin
Installing swift-orphans script to /usr/local/bin
Installing swift-proxy-server script to /usr/local/bin
Installing swift-recon script to /usr/local/bin
Installing swift-recon-cron script to /usr/local/bin
Installing swift-ring-builder script to /usr/local/bin
Installing swift-temp-url script to /usr/local/bin

Installed /home/aaron218/swift
Processing dependencies for swift==1.7.6
Searching for python-swiftclient
Reading http://pypi.python.org/simple/python-swiftclient/
Reading https://github.com/openstack/python-swiftclient
Best match: python-swiftclient 1.2.0
Downloading http://pypi.python.org/packages/source/p/python-swiftclient/python-swiftclient-1.2.0.tar.gz#md5=07dd0b9e8f81a106031880e5e74879fd
Processing python-swiftclient-1.2.0.tar.gz
Running python-swiftclient-1.2.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-SmQ4NP/python-swiftclient-1.2.0/egg-dist-tmp-aEqtxa
zip_safe flag not set; analyzing archive contents...
Adding python-swiftclient 1.2.0 to easy-install.pth file
Installing swift script to /usr/local/bin

Installed /usr/local/lib/python2.7/dist-packages/python_swiftclient-1.2.0-py2.7.egg
Searching for xattr==0.6.2
Best match: xattr 0.6.2
Adding xattr 0.6.2 to easy-install.pth file
Installing xattr script to /usr/local/bin

Using /usr/lib/python2.7/dist-packages
Searching for simplejson==2.3.2
Best match: simplejson 2.3.2
Adding simplejson 2.3.2 to easy-install.pth file

Using /usr/lib/python2.7/dist-packages
Searching for PasteDeploy==1.5.0
Best match: PasteDeploy 1.5.0
Adding PasteDeploy 1.5.0 to easy-install.pth file

Using /usr/lib/python2.7/dist-packages
Searching for netifaces==0.6
Best match: netifaces 0.6
Adding netifaces 0.6 to easy-install.pth file

Using /usr/lib/python2.7/dist-packages
Searching for greenlet==0.3.1
Best match: greenlet 0.3.1
Adding greenlet 0.3.1 to easy-install.pth file

Using /usr/lib/python2.7/dist-packages
Searching for eventlet==0.9.16
Best match: eventlet 0.9.16
Adding eventlet 0.9.16 to easy-install.pth file

Using /usr/lib/python2.7/dist-packages
Finished processing dependencies for swift==1.7.6
完成下载swift源代码并创建运行环境(使用源代码中自带的程序进行安装)

aaron218@aaron218VM1:~$ git clone https://github.com/openstack/python-swiftclient.git
Cloning into 'python-swiftclient'...
remote: Counting objects: 413, done.
remote: Compressing objects: 100% (208/208), done.
remote: Total 413 (delta 207), reused 369 (delta 164)
Receiving objects: 100% (413/413), 93.98 KiB | 71 KiB/s, done.
Resolving deltas: 100% (207/207), done.

aaron218@aaron218VM1:~$ cd ~/python-swiftclient; sudo python setup.py develop
running develop
Checking .pth file support in /usr/local/lib/python2.7/dist-packages/
/usr/bin/python -E -c pass
TEST PASSED: /usr/local/lib/python2.7/dist-packages/ appears to support .pth files
running egg_info
creating python_swiftclient.egg-info
writing requirements to python_swiftclient.egg-info/requires.txt
writing python_swiftclient.egg-info/PKG-INFO
writing top-level names to python_swiftclient.egg-info/top_level.txt
writing dependency_links to python_swiftclient.egg-info/dependency_links.txt
writing manifest file 'python_swiftclient.egg-info/SOURCES.txt'
reading manifest file 'python_swiftclient.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'AUTHORS'
warning: no files found matching 'ChangeLog'
writing manifest file 'python_swiftclient.egg-info/SOURCES.txt'
running build_ext
Creating /usr/local/lib/python2.7/dist-packages/python-swiftclient.egg-link (link to .)
Removing python-swiftclient 1.2.0 from easy-install.pth file
Adding python-swiftclient 1.2.0.25.g7df9cad to easy-install.pth file
Installing swift script to /usr/local/bin

Installed /home/aaron218/python-swiftclient
Processing dependencies for python-swiftclient==1.2.0.25.g7df9cad
Searching for simplejson==2.3.2
Best match: simplejson 2.3.2
Adding simplejson 2.3.2 to easy-install.pth file

Using /usr/lib/python2.7/dist-packages
Finished processing dependencies for python-swiftclient==1.2.0.25.g7df9cad
完成下载swift-client并安装

修改用户的.bashrc文件,并在末尾加入以下内容:并运行bashrc

export SWIFT_TEST_CONFIG_FILE=/etc/swift/test.conf
export PATH=${PATH}:~/bin
aaron218@aaron218VM1:~/python-swiftclient$ . ~/.bashrc

对各个节点进行配置(这里按照root配置):

创建文件:/etc/swift/proxy-server.conf,写入以下内容:

[DEFAULT]
bind_port = 8080
user = root
log_facility = LOG_LOCAL1
eventlet_debug = true

[pipeline:main]
pipeline = healthcheck cache tempauth proxy-logging proxy-server

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

[filter:tempauth]
use = egg:swift#tempauth
user_admin_admin = admin .admin .reseller_admin
user_test_tester = testing .admin
user_test2_tester2 = testing2 .admin
user_test_tester3 = testing3

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

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

[filter:proxy-logging]
use = egg:swift#proxy_logging
创建/etc/swift/swift.conf并写入以下内容:

[swift-hash]
# random unique string that can never change (DO NOT LOSE)
swift_hash_path_suffix = changeme
创建文件 /etc/swift/account-server/1.conf,并写入以下内容。创建account-server配置

[DEFAULT]
devices = /srv/1/node
mount_check = false
disable_fallocate = true
bind_port = 6012
user = root
log_facility = LOG_LOCAL2
recon_cache_path = /var/cache/swift
eventlet_debug = true

[pipeline:main]
pipeline = recon account-server

[app:account-server]
use = egg:swift#account

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

[account-replicator]
vm_test_mode = yes

[account-auditor]

[account-reaper]
类似的还有/2.conf  /3.conf /4.conf按照下面的内容分别创建。

[DEFAULT]
devices = /srv/2/node
mount_check = false
disable_fallocate = true
bind_port = 6022
user = 
log_facility = LOG_LOCAL3
recon_cache_path = /var/cache/swift2
eventlet_debug = true

[pipeline:main]
pipeline = recon account-server

[app:account-server]
use = egg:swift#account

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

[account-replicator]
vm_test_mode = yes

[account-auditor]

[account-reaper]
[DEFAULT]
devices = /srv/3/node
mount_check = false
disable_fallocate = true
bind_port = 6032
user = root
log_facility = LOG_LOCAL4
recon_cache_path = /var/cache/swift3
eventlet_debug = true

[pipeline:main]
pipeline = recon account-server

[app:account-server]
use = egg:swift#account

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

[account-replicator]
vm_test_mode = yes

[account-auditor]

[account-reaper]
[DEFAULT]
devices = /srv/4/node
mount_check = false
disable_fallocate = true
bind_port = 6042
user = root
log_facility = LOG_LOCAL5
recon_cache_path = /var/cache/swift4
eventlet_debug = true

[pipeline:main]
pipeline = recon account-server

[app:account-server]
use = egg:swift#account

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

[account-replicator]
vm_test_mode = yes

[account-auditor]

[account-reaper]

创建文件/etc/swift/container-server/1.conf 创建container-server,类似上面所述的方式。同样创建类似的2 3 4文件

[DEFAULT]
devices = /srv/1/node
mount_check = false
disable_fallocate = true
bind_port = 6011
user = root
log_facility = LOG_LOCAL2
recon_cache_path = /var/cache/swift
eventlet_debug = true

[pipeline:main]
pipeline = recon container-server

[app:container-server]
use = egg:swift#container

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

[container-replicator]
vm_test_mode = yes

[container-updater]

[container-auditor]

[container-sync]
[DEFAULT]
devices = /srv/2/node
mount_check = false
disable_fallocate = true
bind_port = 6021
user = root
log_facility = LOG_LOCAL3
recon_cache_path = /var/cache/swift2
eventlet_debug = true

[pipeline:main]
pipeline = recon container-server

[app:container-server]
use = egg:swift#container

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

[container-replicator]
vm_test_mode = yes

[container-updater]

[container-auditor]

[container-sync]
[DEFAULT]
devices = /srv/3/node
mount_check = false
disable_fallocate = true
bind_port = 6031
user = root
log_facility = LOG_LOCAL4
recon_cache_path = /var/cache/swift3
eventlet_debug = true

[pipeline:main]
pipeline = recon container-server

[app:container-server]
use = egg:swift#container

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

[container-replicator]
vm_test_mode = yes

[container-updater]

[container-auditor]

[container-sync]
[DEFAULT]
devices = /srv/4/node
mount_check = false
disable_fallocate = true
bind_port = 6041
user = root
log_facility = LOG_LOCAL5
recon_cache_path = /var/cache/swift4
eventlet_debug = true

[pipeline:main]
pipeline = recon container-server

[app:container-server]
use = egg:swift#container

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

[container-replicator]
vm_test_mode = yes

[container-updater]

[container-auditor]

[container-sync]
创建 /etc/swift/object-server/1.conf ,安装配置object-server,类似的配置2 3 4 文件

[DEFAULT]
devices = /srv/1/node
mount_check = false
disable_fallocate = true
bind_port = 6010
user = root
log_facility = LOG_LOCAL2
recon_cache_path = /var/cache/swift
eventlet_debug = true

[pipeline:main]
pipeline = recon object-server

[app:object-server]
use = egg:swift#object

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

[object-replicator]
vm_test_mode = yes

[object-updater]

[object-auditor]
[DEFAULT]
devices = /srv/2/node
mount_check = false
disable_fallocate = true
bind_port = 6020
user = root
log_facility = LOG_LOCAL3
recon_cache_path = /var/cache/swift2
eventlet_debug = true

[pipeline:main]
pipeline = recon object-server

[app:object-server]
use = egg:swift#object

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

[object-replicator]
vm_test_mode = yes

[object-updater]

[object-auditor]
[DEFAULT]
devices = /srv/3/node
mount_check = false
disable_fallocate = true
bind_port = 6030
user = root
log_facility = LOG_LOCAL4
recon_cache_path = /var/cache/swift3
eventlet_debug = true

[pipeline:main]
pipeline = recon object-server

[app:object-server]
use = egg:swift#object

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

[object-replicator]
vm_test_mode = yes

[object-updater]

[object-auditor]
[DEFAULT]
devices = /srv/4/node
mount_check = false
disable_fallocate = true
bind_port = 6040
user = root
log_facility = LOG_LOCAL5
recon_cache_path = /var/cache/swift4
eventlet_debug = true

[pipeline:main]
pipeline = recon object-server

[app:object-server]
use = egg:swift#object

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

[object-replicator]
vm_test_mode = yes

[object-updater]

[object-auditor]

配置swift运行脚本和测试(在来宾账户下进行,本机是aaron218)

创建文件:~/bin/resetswift 写入以下内容:

#!/bin/bash

swift-init all stop
find /var/log/swift -type f -exec rm -f {} \;
sudo umount /mnt/sdb1
sudo mkfs.xfs -f -i size=1024 /dev/sdb1
sudo mount /mnt/sdb1
sudo mkdir /mnt/sdb1/1 /mnt/sdb1/2 /mnt/sdb1/3 /mnt/sdb1/4
sudo chown : /mnt/sdb1/*
mkdir -p /srv/1/node/sdb1 /srv/2/node/sdb2 /srv/3/node/sdb3 /srv/4/node/sdb4
sudo rm -f /var/log/debug /var/log/messages /var/log/rsyncd.log /var/log/syslog
find /var/cache/swift* -type f -name *.recon -exec rm -f {} \;
sudo service rsyslog restart
sudo service memcached restart
创建文件~/bin/remakerings 写入以下内容:

#!/bin/bash

cd /etc/swift

rm -f *.builder *.ring.gz backups/*.builder backups/*.ring.gz

swift-ring-builder object.builder create 18 3 1
swift-ring-builder object.builder add z1-127.0.0.1:6010/sdb1 1
swift-ring-builder object.builder add z2-127.0.0.1:6020/sdb2 1
swift-ring-builder object.builder add z3-127.0.0.1:6030/sdb3 1
swift-ring-builder object.builder add z4-127.0.0.1:6040/sdb4 1
swift-ring-builder object.builder rebalance
swift-ring-builder container.builder create 18 3 1
swift-ring-builder container.builder add z1-127.0.0.1:6011/sdb1 1
swift-ring-builder container.builder add z2-127.0.0.1:6021/sdb2 1
swift-ring-builder container.builder add z3-127.0.0.1:6031/sdb3 1
swift-ring-builder container.builder add z4-127.0.0.1:6041/sdb4 1
swift-ring-builder container.builder rebalance
swift-ring-builder account.builder create 18 3 1
swift-ring-builder account.builder add z1-127.0.0.1:6012/sdb1 1
swift-ring-builder account.builder add z2-127.0.0.1:6022/sdb2 1
swift-ring-builder account.builder add z3-127.0.0.1:6032/sdb3 1
swift-ring-builder account.builder add z4-127.0.0.1:6042/sdb4 1
swift-ring-builder account.builder rebalance
创建文件 ~/bin/startmain 并写入以下内容:

#!/bin/bash

swift-init main start
创建 文件  ~/bin/startrest 并写入以下内容:

#!/bin/bash

swift-init rest start
给予执行权限并尝试启动:

aaron218@aaron218VM1:~$ chmod +x ~/bin/*
aaron218@aaron218VM1:~$ remakerings
Traceback (most recent call last):
  File "/usr/local/bin/swift-ring-builder", line 7, in
    execfile(__file__)
  File "/home/aaron218/swift/bin/swift-ring-builder", line 614, in
    mkdir(backup_dir)
OSError: [Errno 13] Permission denied: 'backups'
Ring Builder file does not exist: object.builder
Ring Builder file does not exist: object.builder
Ring Builder file does not exist: object.builder
Ring Builder file does not exist: object.builder
Ring Builder file does not exist: object.builder
Traceback (most recent call last):
  File "/usr/local/bin/swift-ring-builder", line 7, in
    execfile(__file__)
  File "/home/aaron218/swift/bin/swift-ring-builder", line 614, in
    mkdir(backup_dir)
OSError: [Errno 13] Permission denied: 'backups'
Ring Builder file does not exist: container.builder
Ring Builder file does not exist: container.builder
Ring Builder file does not exist: container.builder
Ring Builder file does not exist: container.builder
Ring Builder file does not exist: container.builder
Traceback (most recent call last):
  File "/usr/local/bin/swift-ring-builder", line 7, in
    execfile(__file__)
  File "/home/aaron218/swift/bin/swift-ring-builder", line 614, in
    mkdir(backup_dir)
OSError: [Errno 13] Permission denied: 'backups'
Ring Builder file does not exist: account.builder
Ring Builder file does not exist: account.builder
Ring Builder file does not exist: account.builder
Ring Builder file does not exist: account.builder
Ring Builder file does not exist: account.builder

测试swift的运行情况,单元测试?

aaron218@aaron218VM1:~$ cd ~/swift; ./.unittests
Unable to read test config /etc/swift/test.conf - file not found
...................................................SSSSSSSS........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
Name                                    Stmts   Miss  Cover   Missing
---------------------------------------------------------------------
swift.account                               0      0   100%   
swift.account.auditor                      72     57    21%   34-45, 48-70, 74-89, 94-100, 109-124
swift.account.reaper                      225    179    20%   78-80, 84-86, 90-92, 100-107, 116-131, 146-174, 218-271, 309-384, 407-443
swift.account.replicator                    7      0   100%   
swift.account.server                      238     45    81%   72-73, 76, 79, 95-96, 99, 131, 157-158, 161, 176-178, 188, 202, 286-301, 310-311, 315, 319, 322, 337, 348-352, 356, 368, 376-378
swift.common                                0      0   100%   
swift.common.bench                        309    251    19%   38-39, 45-49, 55-64, 70, 84-86, 89, 92, 95-99, 102-104, 110-111, 114, 127-129, 132-170, 176-216, 222-223, 231-244, 247-257, 260, 290-299, 302-320, 324-342, 348-353, 356-365, 368, 371-382, 388-391, 394-411, 417-420, 423-440, 446-450, 453-486
swift.common.bufferedhttp                  63      9    86%   70-74, 99, 131-133
swift.common.constraints                   87      0   100%   
swift.common.daemon                        43      4    91%   48-50, 92
swift.common.db                           817    129    84%   139-140, 235, 246, 264, 283, 293-297, 321-325, 351-354, 389-395, 407-409, 460-462, 478, 523-527, 530-538, 553, 582-588, 600, 635, 647, 650, 704, 787-789, 805, 819-820, 827-829, 857-860, 892, 898, 900, 923-925, 932, 953-955, 977, 980-983, 1002, 1024-1030, 1075-1077, 1102, 1198, 1332, 1348-1349, 1356-1358, 1368-1370, 1403-1406, 1420-1422, 1457, 1463, 1465, 1485-1499, 1513-1515, 1542-1544, 1571-1573, 1595, 1656
swift.common.db_replicator                400    129    68%   63, 241, 249, 254-256, 284-289, 293-298, 307, 363-365, 372, 374-376, 378, 386-393, 420, 429-430, 434-435, 457-458, 481, 497, 508-509, 511-522, 525, 535-544, 559-579, 582-629, 640-648, 654-665
swift.common.direct_client                197    176    11%   36-38, 59-90, 107-126, 148-179, 184-193, 217-236, 256-284, 310-343, 361-370, 394-403, 426-460
swift.common.exceptions                    46      2    96%   26, 104
swift.common.http                          77      0   100%   
swift.common.internal_client              189      2    99%   218, 220
swift.common.manager                      328      2    99%   339-340
swift.common.memcached                    216     23    89%   32-33, 104-108, 124, 207-208, 244-246, 283-284, 305-306, 317-318, 341-344, 358-359
swift.common.middleware                     0      0   100%   
swift.common.middleware.acl                47      0   100%   
swift.common.middleware.catch_errors       38      5    87%   73-78
swift.common.middleware.cname_lookup       65     55    15%   32-33, 38, 73-82, 85-143
swift.common.middleware.domain_remap       56      5    91%   124-129
swift.common.middleware.formpost          256     13    95%   220, 356-357, 414-415, 426-427, 451-452, 487-488, 507, 511
swift.common.middleware.healthcheck        28      2    93%   54-56
swift.common.middleware.keystoneauth      127      4    97%   175-176, 244-245
swift.common.middleware.memcache           37      9    76%   41-42, 48-49, 69-75
swift.common.middleware.name_check         55      3    95%   65, 82, 104
swift.common.middleware.proxy_logging     110      0   100%   
swift.common.middleware.ratelimit         123      0   100%   
swift.common.middleware.recon             215     41    81%   26-27, 135, 139-143, 154, 158-159, 182, 214-229, 262-264, 268-272, 330-335
swift.common.middleware.staticweb         232      9    96%   115-116, 257, 375-377, 468, 473, 523, 551
swift.common.middleware.tempauth          290     65    78%   142-149, 203, 207-209, 212-230, 242-244, 308, 310-312, 321-326, 343-345, 350-351, 384-386, 412, 424-425, 429, 435-441, 450-452, 473, 476, 480, 485, 488, 493
swift.common.middleware.tempurl           189      5    97%   261-262, 342-343, 464
swift.common.ring                           2      0   100%   
swift.common.ring.builder                 372     20    95%   89-90, 106-117, 168, 192, 373, 402, 425, 842
swift.common.ring.ring                    131      6    95%   31-32, 74, 128, 162, 167
swift.common.ring.utils                    14      0   100%   
swift.common.swob                         528      6    99%   210, 255, 286, 556, 635, 812
swift.common.utils                        793    131    83%   37-38, 82-83, 99, 156, 169, 188, 194-195, 197, 200-203, 205, 227-230, 248, 630-631, 689-690, 696-700, 738-749, 873-874, 936-939, 959-960, 964-982, 1010-1012, 1039-1040, 1042-1054, 1065-1071, 1205-1207, 1243-1246, 1254, 1264, 1332, 1398-1418, 1426-1429, 1504, 1516-1526
swift.common.wsgi                         199     92    54%   86-88, 90, 116-200, 218-241, 278, 291-294, 379-380
swift.container                             0      0   100%   
swift.container.auditor                    71     56    21%   34-45, 48-69, 73-88, 93-99, 108-123
swift.container.replicator                 12      0   100%   
swift.container.server                    298     49    84%   115, 127-136, 151-152, 156, 159, 178, 181, 184, 194-195, 205, 207, 228, 244, 258-259, 262, 286, 301, 403-418, 432, 438, 440, 443, 464, 475-479, 491, 499-501
swift.container.sync                      211      2    99%   295, 394
swift.container.updater                   176     50    72%   81-82, 92, 109-111, 113-132, 135-139, 154-163, 211, 249, 254-255, 280-294
swift.obj                                   0      0   100%   
swift.obj.auditor                         130      2    98%   155-156
swift.obj.expirer                          81      0   100%   
swift.obj.replicator                      404     99    75%   68, 88, 103, 203-204, 286-289, 294-299, 301, 304, 339, 383-384, 386, 395-403, 419-480, 521-525, 534, 544-547, 563-564, 567-568, 589-590, 618-619, 621-623, 630-632, 654-668
swift.obj.server                          541     23    96%   230-231, 288-289, 386, 549, 556, 597, 697, 779, 821, 864-865, 868, 883, 894-898, 911, 917, 923-925
swift.obj.updater                         156     47    70%   65-107, 118-121, 145, 150, 153-158, 181-188, 203
swift.proxy                                 0      0   100%   
swift.proxy.controllers                     4      0   100%   
swift.proxy.controllers.account            78      6    92%   58-61, 127-130
swift.proxy.controllers.base              403     14    97%   54, 289, 340, 430, 527-531, 567, 573-577, 651
swift.proxy.controllers.container         104      4    96%   69, 93, 164, 205
swift.proxy.controllers.obj               629     79    87%   171-172, 210-211, 230-231, 276, 304-305, 367, 369-371, 381, 446, 537-538, 594-596, 600-608, 625-635, 641-642, 649-652, 665, 753, 757, 764, 766-770, 780-783, 785-789, 813-814, 818-820, 861-867, 886-905, 907-909, 919-920, 944
swift.proxy.server                        132     10    92%   146, 150-151, 182-184, 190, 248-250
---------------------------------------------------------------------
TOTAL                                   10651   1920    82%   
----------------------------------------------------------------------
Ran 1059 tests in 24.331s

OK (SKIP=8)
/home/aaron218/swift

在非root权限下运行,部分测试会失败,如下

aaron218@aaron218VM1:~/swift$ startmain
WARNING: Unable to increase file descriptor limit.  Running as non-root?
Starting proxy-server...(/etc/swift/proxy-server.conf)
Traceback (most recent call last):
  File "/usr/local/bin/swift-init", line 7, in
    execfile(__file__)
  File "/home/aaron218/swift/bin/swift-init", line 77, in
    sys.exit(main())
  File "/home/aaron218/swift/bin/swift-init", line 67, in main
    status = manager.run_command(command, **options.__dict__)
  File "/home/aaron218/swift/swift/common/manager.py", line 310, in run_command
    return f(**kwargs)
  File "/home/aaron218/swift/swift/common/manager.py", line 79, in wrapped
    rv = func(*a, **kw)
  File "/home/aaron218/swift/swift/common/manager.py", line 169, in start
    server.launch(**kwargs)
  File "/home/aaron218/swift/swift/common/manager.py", line 610, in launch
    pid = self.spawn(conf_file, **kwargs)
  File "/home/aaron218/swift/swift/common/manager.py", line 536, in spawn
    write_file(pid_file, proc.pid)
  File "/home/aaron218/swift/swift/common/utils.py", line 1209, in write_file
    with open(path, 'w') as f:
IOError: [Errno 13] Permission denied: '/var/run/swift/proxy-server.pid'

后续工作暂时无法完成,以下切换到root账户下对aaron218下面的目录进行操作:

root@aaron218VM1:/home/aaron218/bin# ./remakerings
Device z1-127.0.0.1:6010/sdb1_"" with 1.0 weight got id 0
Device z2-127.0.0.1:6020/sdb2_"" with 1.0 weight got id 1
Device z3-127.0.0.1:6030/sdb3_"" with 1.0 weight got id 2
Device z4-127.0.0.1:6040/sdb4_"" with 1.0 weight got id 3
Reassigned 262144 (100.00%) partitions. Balance is now 0.00.
Device z1-127.0.0.1:6011/sdb1_"" with 1.0 weight got id 0
Device z2-127.0.0.1:6021/sdb2_"" with 1.0 weight got id 1
Device z3-127.0.0.1:6031/sdb3_"" with 1.0 weight got id 2
Device z4-127.0.0.1:6041/sdb4_"" with 1.0 weight got id 3
Reassigned 262144 (100.00%) partitions. Balance is now 0.00.
Device z1-127.0.0.1:6012/sdb1_"" with 1.0 weight got id 0
Device z2-127.0.0.1:6022/sdb2_"" with 1.0 weight got id 1
Device z3-127.0.0.1:6032/sdb3_"" with 1.0 weight got id 2
Device z4-127.0.0.1:6042/sdb4_"" with 1.0 weight got id 3
Reassigned 262144 (100.00%) partitions. Balance is now 0.00.

root@aaron218VM1:/home/aaron218/bin# cd ..
root@aaron218VM1:/home/aaron218# cd swift
root@aaron218VM1:/home/aaron218/swift# ./.unittests
Unable to read test config /etc/swift/test.conf - file not found
...................................................SSSSSSSS........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
Name                                    Stmts   Miss  Cover   Missing
---------------------------------------------------------------------
swift.account                               0      0   100%   
swift.account.auditor                      72     57    21%   34-45, 48-70, 74-89, 94-100, 109-124
swift.account.reaper                      225    179    20%   78-80, 84-86, 90-92, 100-107, 116-131, 146-174, 218-271, 309-384, 407-443
swift.account.replicator                    7      0   100%   
swift.account.server                      238     45    81%   72-73, 76, 79, 95-96, 99, 131, 157-158, 161, 176-178, 188, 202, 286-301, 310-311, 315, 319, 322, 337, 348-352, 356, 368, 376-378
swift.common                                0      0   100%   
swift.common.bench                        309    251    19%   38-39, 45-49, 55-64, 70, 84-86, 89, 92, 95-99, 102-104, 110-111, 114, 127-129, 132-170, 176-216, 222-223, 231-244, 247-257, 260, 290-299, 302-320, 324-342, 348-353, 356-365, 368, 371-382, 388-391, 394-411, 417-420, 423-440, 446-450, 453-486
swift.common.bufferedhttp                  63      9    86%   70-74, 99, 131-133
swift.common.constraints                   87      0   100%   
swift.common.daemon                        43      4    91%   48-50, 92
swift.common.db                           817    129    84%   139-140, 235, 246, 264, 283, 293-297, 321-325, 351-354, 389-395, 407-409, 460-462, 478, 523-527, 530-538, 553, 582-588, 600, 635, 647, 650, 704, 787-789, 805, 819-820, 827-829, 857-860, 892, 898, 900, 923-925, 932, 953-955, 977, 980-983, 1002, 1024-1030, 1075-1077, 1102, 1198, 1332, 1348-1349, 1356-1358, 1368-1370, 1403-1406, 1420-1422, 1457, 1463, 1465, 1485-1499, 1513-1515, 1542-1544, 1571-1573, 1595, 1656
swift.common.db_replicator                400    129    68%   63, 241, 249, 254-256, 284-289, 293-298, 307, 363-365, 372, 374-376, 378, 386-393, 420, 429-430, 434-435, 457-458, 481, 497, 508-509, 511-522, 525, 535-544, 559-579, 582-629, 640-648, 654-665
swift.common.direct_client                197    176    11%   36-38, 59-90, 107-126, 148-179, 184-193, 217-236, 256-284, 310-343, 361-370, 394-403, 426-460
swift.common.exceptions                    46      2    96%   26, 104
swift.common.http                          77      0   100%   
swift.common.internal_client              189      2    99%   218, 220
swift.common.manager                      328      2    99%   339-340
swift.common.memcached                    216     23    89%   32-33, 104-108, 124, 207-208, 244-246, 283-284, 305-306, 317-318, 341-344, 358-359
swift.common.middleware                     0      0   100%   
swift.common.middleware.acl                47      0   100%   
swift.common.middleware.catch_errors       38      5    87%   73-78
swift.common.middleware.cname_lookup       65     55    15%   32-33, 38, 73-82, 85-143
swift.common.middleware.domain_remap       56      5    91%   124-129
swift.common.middleware.formpost          256     13    95%   220, 356-357, 414-415, 426-427, 451-452, 487-488, 507, 511
swift.common.middleware.healthcheck        28      2    93%   54-56
swift.common.middleware.keystoneauth      127      4    97%   175-176, 244-245
swift.common.middleware.memcache           37      9    76%   41-42, 48-49, 69-75
swift.common.middleware.name_check         55      3    95%   65, 82, 104
swift.common.middleware.proxy_logging     110      0   100%   
swift.common.middleware.ratelimit         123      0   100%   
swift.common.middleware.recon             215     41    81%   26-27, 135, 139-143, 154, 158-159, 182, 214-229, 262-264, 268-272, 330-335
swift.common.middleware.staticweb         232      9    96%   115-116, 257, 375-377, 468, 473, 523, 551
swift.common.middleware.tempauth          290     65    78%   142-149, 203, 207-209, 212-230, 242-244, 308, 310-312, 321-326, 343-345, 350-351, 384-386, 412, 424-425, 429, 435-441, 450-452, 473, 476, 480, 485, 488, 493
swift.common.middleware.tempurl           189      5    97%   261-262, 342-343, 464
swift.common.ring                           2      0   100%   
swift.common.ring.builder                 372     20    95%   89-90, 106-117, 168, 192, 373, 402, 425, 842
swift.common.ring.ring                    131      6    95%   31-32, 74, 128, 162, 167
swift.common.ring.utils                    14      0   100%   
swift.common.swob                         528      6    99%   210, 255, 286, 556, 635, 812
swift.common.utils                        793    130    84%   37-38, 82-83, 99, 156, 169, 188, 194-195, 197, 200-203, 205, 227, 229-230, 248, 630-631, 689-690, 696-700, 738-749, 873-874, 936-939, 959-960, 964-982, 1010-1012, 1039-1040, 1042-1054, 1065-1071, 1205-1207, 1243-1246, 1254, 1264, 1332, 1398-1418, 1426-1429, 1504, 1516-1526
swift.common.wsgi                         199     92    54%   86-88, 90, 116-200, 218-241, 278, 291-294, 379-380
swift.container                             0      0   100%   
swift.container.auditor                    71     56    21%   34-45, 48-69, 73-88, 93-99, 108-123
swift.container.replicator                 12      0   100%   
swift.container.server                    298     49    84%   115, 127-136, 151-152, 156, 159, 178, 181, 184, 194-195, 205, 207, 228, 244, 258-259, 262, 286, 301, 403-418, 432, 438, 440, 443, 464, 475-479, 491, 499-501
swift.container.sync                      211      2    99%   295, 394
swift.container.updater                   176     50    72%   81-82, 92, 109-111, 113-132, 135-139, 154-163, 211, 249, 254-255, 280-294
swift.obj                                   0      0   100%   
swift.obj.auditor                         130      2    98%   155-156
swift.obj.expirer                          81      0   100%   
swift.obj.replicator                      404     99    75%   68, 88, 103, 203-204, 286-289, 294-299, 301, 304, 339, 383-384, 386, 395-403, 419-480, 521-525, 534, 544-547, 563-564, 567-568, 589-590, 618-619, 621-623, 630-632, 654-668
swift.obj.server                          541     23    96%   230-231, 288-289, 386, 549, 556, 597, 697, 779, 821, 864-865, 868, 883, 894-898, 911, 917, 923-925
swift.obj.updater                         156     47    70%   65-107, 118-121, 145, 150, 153-158, 181-188, 203
swift.proxy                                 0      0   100%   
swift.proxy.controllers                     4      0   100%   
swift.proxy.controllers.account            78      6    92%   58-61, 127-130
swift.proxy.controllers.base              403     14    97%   54, 289, 340, 430, 527-531, 567, 573-577, 651
swift.proxy.controllers.container         104      4    96%   69, 93, 164, 205
swift.proxy.controllers.obj               629     79    87%   171-172, 210-211, 230-231, 276, 304-305, 367, 369-371, 381, 446, 537-538, 594-596, 600-608, 625-635, 641-642, 649-652, 665, 753, 757, 764, 766-770, 780-783, 785-789, 813-814, 818-820, 861-867, 886-905, 907-909, 919-920, 944
swift.proxy.server                        132     10    92%   146, 150-151, 182-184, 190, 248-250
---------------------------------------------------------------------
TOTAL                                   10651   1919    82%   
----------------------------------------------------------------------
Ran 1059 tests in 23.417s

OK (SKIP=8)
/home/aaron218/swift

在root权限下启动swift
root@aaron218VM1:/home/aaron218/bin# ./startmain
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)

在root账户下获取swift信息:

root@aaron218VM1:/home/aaron218/bin# curl -v -H 'X-Storage-User: test:tester' -H 'X-Storage-Pass: testing' http://127.0.0.1:8080/auth/v1.0
* About to connect() to 127.0.0.1 port 8080 (#0)
*   Trying 127.0.0.1... connected
> GET /auth/v1.0 HTTP/1.1
> User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
> Host: 127.0.0.1:8080
> Accept: */*
> X-Storage-User: test:tester
> X-Storage-Pass: testing
>
< HTTP/1.1 200 OK
< X-Storage-Url: http://127.0.0.1:8080/v1/AUTH_test
< X-Auth-Token: AUTH_tk5f023d9af54543b2ba1baff154a8ff47
< Content-Type: text/html; charset=UTF-8
< X-Storage-Token: AUTH_tk5f023d9af54543b2ba1baff154a8ff47
< Content-Length: 0
< Date: Wed, 19 Dec 2012 05:08:16 GMT
<
* Connection #0 to host 127.0.0.1 left intact
* Closing connection #0

使用 curl-v-H'X-Auth-Token: AUTH_tk5f023d9af54543b2ba1baff154a8ff47'http://127.0.0.1:8080/v1/AUTH_test (root账户)

root@aaron218VM1:/home/aaron218/bin# curl -v -H 'X-Auth-Token: AUTH_tk5f023d9af54543b2ba1baff154a8ff47' http://127.0.0.1:8080/v1/AUTH_test
* About to connect() to 127.0.0.1 port 8080 (#0)
*   Trying 127.0.0.1... connected
> GET /v1/AUTH_test HTTP/1.1
> User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
> Host: 127.0.0.1:8080
> Accept: */*
> X-Auth-Token: AUTH_tk5f023d9af54543b2ba1baff154a8ff47
>
< HTTP/1.1 204 No Content
< Content-Length: 0
< Accept-Ranges: bytes
< X-Timestamp: 1355893837.75705
< X-Account-Bytes-Used: 0
< X-Account-Container-Count: 0
< Content-Type: text/html; charset=UTF-8
< X-Account-Object-Count: 0
< Date: Wed, 19 Dec 2012 05:10:37 GMT
<
* Connection #0 to host 127.0.0.1 left intact
* Closing connection #0
以及其它的一些测试

root@aaron218VM1:/home/aaron218/bin# swift -A http://127.0.0.1:8080/auth/v1.0 -U test:tester -K testing stat
   Account: AUTH_test
Containers: 0
   Objects: 0
     Bytes: 0
Accept-Ranges: bytes
X-Timestamp: 1355893837.75311
Content-Type: text/plain; charset=utf-8

root@aaron218VM1:/home/aaron218/swift# ./.functests
Unable to read test config /etc/swift/test.conf - file not found
SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
----------------------------------------------------------------------
Ran 155 tests in 0.020s

OK (SKIP=155)
/home/aaron218/swift
Unable to read test config /etc/swift/test.conf - file not found
SKIPPING FUNCTIONAL TESTS DUE TO NO CONFIG
SSSSSSSSSSSSSSSSSS
----------------------------------------------------------------------
Ran 18 tests in 0.003s

OK (SKIP=18)
/home/aaron218/swift

部分测试没有完成。

root@aaron218VM1:/home/aaron218/swift# ./.probetests
Unable to read test config /etc/swift/test.conf - file not found
Traceback (most recent call last):
  File "/usr/local/bin/swift-object-server", line 7, in
    execfile(__file__)
  File "/home/aaron218/swift/bin/swift-object-server", line 22, in
    run_wsgi(conf_file, 'object-server', default_port=6000, **options)
  File "/home/aaron218/swift/swift/common/wsgi.py", line 124, in run_wsgi
    sock = get_socket(conf, default_port=kwargs.get('default_port', 8080))
  File "/home/aaron218/swift/swift/common/wsgi.py", line 92, in get_socket
    bind_addr[0], bind_addr[1], bind_timeout))
Exception: Could not bind to 0.0.0.0:6020 after trying for 30 seconds

当安装过程结束后,每次重新开机,可以通过在root权限下运行aaron218的~/bin下面的startmian脚本来开启Swift(其实也可以在root的home目录下添加这些文件,这里只是为了尽量和SAIO接近。)



你可能感兴趣的:(仅做备份)