1. 程式人生 > >從零開始安裝openstack swift

從零開始安裝openstack swift

安裝環境

所需軟體及版本

         VMware®Workstation 11.1.0 build-2496824(桌面虛擬計算機軟體)

         ubuntu-12.04.5-desktop-amd64.iso(ubuntu14.04桌面版,server版也可)

         SSH(linux遠端連線工具,putty之類的也可)

環境安裝

         安裝VMware®Workstation(儘量不要安裝在固態硬碟上,偶爾會報錯誤)

         新建ubantu虛擬機器(選擇之前的ubuntu映象進行安裝即可,硬碟分了20個G)

                   Ssh使用root使用者連線:

ubuntu預設是不啟用root使用者也不允許root遠端登入的,通過如下步驟解決。

                                     啟用root使用者:sudopasswd root      //修改密碼後就啟用了。

                                    在此之前先執行apt-getupdate

安裝OpenSSHserver:

1. 使用apt命令安裝opensshserver

$ sudo apt-get install openssh-server

2. 可以對 openssh server進行配置

$ sudo vi /etc/ssh/sshd_config(如果這一步顯示newfile則sshclient未安裝上)

找到PermitRootLoginno一行,改為PermitRootLogin yes

3. 重啟 openssh server

$ sudo service ssh restart

安裝過程

1. 安裝依賴包和核心程式碼

1. 以root身份登入。

# sudo su - root

2. 安裝必須的依賴包、庫。

# apt-get install python-software-properties

# add-apt-repository ppa:swift-core/release//注掉

# apt-get update

# 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

# pip install mock

3. 建立swift使用者和組。在此,我們直接使用root作為使用者名稱和組名。

接下來,需要選擇使用一個分割槽作為儲存(Using a partition for storage)或使用一個迴環裝置作為儲存(Using a loopback device for storage),本文件使用迴環裝置作為儲存。若希望使用一個單獨的分割槽作為儲存,請參閱這裡

2. 使用迴環裝置作為儲存

1. 建立儲存資料夾。

# mkdir /srv //提示資料夾已存在

2. 調整seek的值,可以建立一個更大或更小的分割槽。

# dd if=/dev/zero of=/srv/swift-disk bs=1024 count=0 seek=1000000

# mkfs.xfs -i size=1024 /srv/swift-disk

3. 編輯/etc/fstab並新增如下一行。

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

4. 建立掛載資料夾,並掛載。

# mkdir /mnt/sdb1

# mount /mnt/sdb1

5. 建立4個子節點資料夾。

# mkdir /mnt/sdb1/1 /mnt/sdb1/2 /mnt/sdb1/3 /mnt/sdb1/4

6. 改變許可權,root:root對應<your-user-name>:<your-group-name>。

# chown root:root /mnt/sdb1/*

7. 為4個子節點建立同步連結。

# for x in {1..4}; do ln -s /mnt/sdb1/$x /srv/$x; done

8. 建立server等資料夾,並改編許可權。注意,不要忘記/etc/swift/srv/[1-4]/最後一個“/”。

# 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

# chown -R root:root /etc/swift /srv/[1-4]/ /var/run/swift

9. 編輯檔案/etc/rc.local,在exit 0 之前新增如下4行。

 mkdir -p /var/cache/swift /var/cache/swift2 /var/cache/swift3 /var/cache/swift4

chown root:root /var/cache/swift*

mkdir -p /var/run/swift

chown root:root /var/run/swift

3. 設定Rsync

1. 建立檔案/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

2. 編輯檔案/etc/default/rsync,設定引數RSYNC_ENABLE為true。

RSYNC_ENABLE=true

3. 啟動rsync服務

# service rsync restart

4. 設定獨立日誌(可選)

1. 建立檔案/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.*                ~

2. 編輯檔案/etc/rsyslog.conf,更改引數$PrivDropToGroup為adm。

$PrivDropToGroup adm

3. 建立swift每小時的資料夾。

# mkdir -p /var/log/swift/hourly

4. 更改swift的log資料夾許可權。

# chown -R syslog.adm /var/log/swift

# chmod -R g+w /var/log/swift

5. 重啟rsyslog服務。

# service rsyslog restart

5. 獲取程式碼並設定測試環境

若不打算在全root許可權下安裝Swift,則需要切換回guest許可權。此處,我們全部使用root安裝。

  1. 從github上檢出python-swiftclient客戶端程式碼:

cd $HOME; git clone https://github.com/openstack/python-swiftclient.git

  1. 安裝python-swiftclient

cd $HOME/python-swiftclient; sudo python setup.py develop; cd -

  1. 從github上檢出swift程式碼:

git clone https://github.com/openstack/swift.git

  1. 安裝swift:

cd $HOME/swift

pip install -r requirements.txt; sudo python setup.py develop; cd –

  1. 安裝swift的測試依賴性檔案(待核實):

cd $HOME/swift

 pip install -r test-requirements.txt

注:如果自己設定過pip源,則需要在pip install後新增trust該站點說明

6. 編輯檔案~/.bashrc,並在檔案尾新增如下內容:

export SWIFT_TEST_CONFIG_FILE=/etc/swift/test.conf

export PATH=${PATH}:~/bin

7. 執行。

# . ~/.bashrc

6. 配置結點

1. 建立檔案/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

2. 建立檔案/etc/swift/swift.conf,檔案內容如下:

[swift-hash]

# random unique string that can never change (DO NOT LOSE)

swift_hash_path_suffix = jtangfs

3. 建立檔案/etc/swift/account-server/1.conf,檔案內容如下:

[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]

4. 建立檔案/etc/swift/account-server/2.conf,檔案內容如下:

[DEFAULT]

devices = /srv/2/node

mount_check = false

disable_fallocate = true

bind_port = 6022

user = root

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]

5. 建立檔案/etc/swift/account-server/3.conf,檔案內容如下:

[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]

6. 建立檔案/etc/swift/account-server/4.conf,檔案內容如下:

[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]

7. 建立檔案/etc/swift/container-server/1.conf,檔案內容如下:

[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]

8. 建立檔案/etc/swift/container-server/2.conf,檔案內容如下:

[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]

9. 建立檔案/etc/swift/container-server/3.conf,檔案內容如下:

[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]

10. 建立檔案/etc/swift/container-server/4.conf,檔案內容如下:

[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]

11. 建立檔案/etc/swift/object-server/1.conf,檔案內容如下:

[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]

12. 建立檔案/etc/swift/object-server/2.conf,檔案內容如下:

[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]

13. 建立檔案/etc/swift/object-server/3.conf,檔案內容如下:

[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]

14. 建立檔案/etc/swift/object-server/4.conf,檔案內容如下:

[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]

7. 建立Swift執行指令碼

1. 建立指令碼~/bin/resetswift,內容如下。注意,如果使用的是單獨分割槽儲存需要將/srv/swift-disk替換為/dev/sdb1;如果沒有建立rsyslog作為獨立日誌,則需要移除find /var/log/swift... 這一行。

#!/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 /srv/swift-disk

sudo mount /mnt/sdb1

sudo mkdir /mnt/sdb1/1 /mnt/sdb1/2 /mnt/sdb1/3 /mnt/sdb1/4

sudo chown root:root /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

2. 建立指令碼~/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

3. 建立指令碼~/bin/startmain,內容如下:

#!/bin/bash

swift-init main start

4. 建立指令碼~/bin/startrest,內容如下:

#!/bin/bash

swift-init rest start

5. 更改指令碼許可權。

# chmod +x ~/bin/*

6. 建立rings。

# remakerings

7. 執行功能單元測試,出現“Unable to read test config/etc/swift/test.conf – file not found”,可不必理會,或手動複製過去(配置檔案在swift/test/sample.conf)。

# cd ~/swift

# ./.unittests

8. 執行swift,出現“Unable to increasefile descriptor limit.  Running as non-root?”警告為正常現象,不必理會。

# startmain

8. 簡單使用

完成安裝部署後,可以使用swift --help命令檢視Swift幫助資訊。

# swift --help

Usage: swift <command> [options] [args]

Commands:

  stat [container] [object]

    Displays information for the account, container, or object depending on the

    args given (if any).

  list [options] [container]

    Lists the containers for the account or the objects for a container. -p or

    --prefix is an option that will only list items beginning with that prefix.

    -d or --delimiter is option (for container listings only) that will roll up

    items with the given delimiter (see Cloud Files general documentation for

    what this means).

  upload [options] container file_or_directory [file_or_directory] [...]

    Uploads to the given container the files and directories specified by the

    remaining args. -c or --changed is an option that will only upload files

    that have changed since the last upload. -S <size> or --segment-size <size>

    and --leave-segments are options as well (see --help for more).

  post [options] [container] [object]

    Updates meta information for the account, container, or object depending on

    the args given. If the container is not found, it will be created

    automatically; but this is not true for accounts and objects. Containers

    also allow the -r (or --read-acl) and -w (or --write-acl) options. The -m

    or --meta option is allowed on all and used to define the user meta data

    items to set in the form Name:Value. This option can be repeated. Example:

    post -m Color:Blue -m Size:Large

  download --all OR download container [options] [object] [object] ...

    Downloads everything in the account (with --all), or everything in a

    container, or a list of objects depending on the args given. For a single

    object download, you may use the -o [--output] <filename> option to

    redirect the output to a specific file or if "-" then just redirect to

    stdout.

  delete [options] --all OR delete container [options] [object] [object] ...

    Deletes everything in the account (with --all), or everything in a

    container, or a list of objects depending on the args given. Segments of

    manifest objects will be deleted as well, unless you specify the

    --leave-segments option.

Example:

  swift -A https://auth.api.rackspacecloud.com/v1.0 -U user -K key stat

Options:

  --version             show program's version number and exit

  -h, --help            show this help message and exit

  -s, --snet            Use SERVICENET internal network

  -v, --verbose         Print more info

  -q, --quiet           Suppress status output

  -A AUTH, --auth=AUTH  URL for obtaining an auth token

  -V AUTH_VERSION, --auth-version=AUTH_VERSION

                        Specify a version for authentication. Defaults to 1.0.

  -U USER, --user=USER  User name for obtaining an auth token.

  -K KEY, --key=KEY     Key for obtaining an auth token.

  --os-username=<auth-user-name>

                        Openstack username. Defaults to env[OS_USERNAME].

  --os-password=<auth-password>

                        Openstack password. Defaults to env[OS_PASSWORD].

  --os-tenant-id=<auth-tenant-id>

                        OpenStack tenant ID. Defaults to env[OS_TENANT_ID]

  --os-tenant-name=<auth-tenant-name>

                        Openstack tenant name. Defaults to

                        env[OS_TENANT_NAME].

  --os-auth-url=<auth-url>

                        Openstack auth URL. Defaults to env[OS_AUTH_URL].

  --os-auth-token=<auth-token>

                        Openstack token. Defaults to env[OS_AUTH_TOKEN]

  --os-storage-url=<storage-url>

                        Openstack storage URL. Defaults to env[OS_STORAGE_URL]

  --os-region-name=<region-name>

                        Openstack region name. Defaults to env[OS_REGION_NAME]

  --os-service-type=<service-type>

                        Openstack Service type. Defaults to

                        env[OS_SERVICE_TYPE]

  --os-endpoint-type=<endpoint-type>

                        Openstack Endpoint type. Defaults to

                        env[OS_ENDPOINT_TYPE]

  --insecure            Allow swiftclient to access insecure keystone server.

                        The keystone's certificate will not be verified.

1. 獲取一個 X-Storage-Url 和 X-Auth-Token。

# 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

* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)

> GET /auth/v1.0 HTTP/1.1

> User-Agent: curl/7.19.7 (i486-pc-linux-gnu) libcurl/7.19.7 OpenSSL/0.9.8k zlib/1.2.3.3 libidn/1.15

> 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-Storage-Token: AUTH_tk6474e5ee0cb04832b9d2a168e1a164d8

< X-Auth-Token: AUTH_tk6474e5ee0cb04832b9d2a168e1a164d8

< Content-Length: 0

< Date: Mon, 04 Jul 2011 01:36:57 GMT

* Connection #0 to host 127.0.0.1 left intact

*Closing connection #0

2. 檢查賬戶。注意,X-Auth-Token:與<token-from-x-auth-token-above>之間存在一個空格,一定不能丟。

# curl -v -H 'X-Auth-Token: <token-from-x-auth-token-above>'  <url-from-x-storage-url-above>

3. 檢查Swift工作。

# 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

4. 建立container,建立一個名稱為container_test的container(目錄),注意使用當前的token。

# curl -X PUT -D -  -H "X-Auth_Token:AUTH_tk6474e5ee0cb04832b9d2a168e1a164d8" http://127.0.0.1:8080/v1/AUTH_test/container_test

  正確情況下,應該得到以下資訊:

HTTP/1.1 201 Created

Content-Length: 0

Content-Type: text/html; charset=UTF-8

Date: Mon, 04 Jul 2011 01:39:38 GMT

5. 檢視test使用者的container列表,發現只有一個目錄:container_test。

# swift -A http://127.0.0.1:8080/auth/v1.0 -U test:tester -K testing list

container_test

6. 上傳Object(檔案),上傳hello檔案到container_test目錄中。

# swift -A http://127.0.0.1:8080/auth/v1.0 -U test:tester -K testing upload container_test /root/hello

root/hello

7. 檢視目錄中的內容,檢視container_test目錄中的內容。

# swift -A http://127.0.0.1:8080/auth/v1.0 -U test:tester -K testing list container_test

root/hello

8. 下載Object(檔案)下載container_test下的object。

# swift -A http://127.0.0.1:8080/auth/v1.0 -U test:tester -K testing download  container_test

  將container_test目錄內的所有內容下載到目前所在目錄。注意:如果上傳檔案的時候,有巢狀目錄,則上傳到Swift上後,也是以巢狀目錄的形式存在,下載後,會在當前目錄建立一樣的巢狀目錄。

安裝遇到的問題