`
jetway
  • 浏览: 485835 次
  • 性别: Icon_minigender_1
  • 来自: 武汉
社区版块
存档分类
最新评论

OpenStack Swift All In One安装部署流程与简单使用

 
阅读更多

简介

  本文详细描述使用单台服务器部署一个Swift开发版本的过程,单台服务器运行所有Swift服务,并模拟运行具有4个结点的Swift集群。其中,这里的“服务器”可以是物理机也可以是虚拟机。

  已验证的部署环境:

  • VMWare 7.1.2     Ubuntu-11.10-desktop-32位
  • PC物理机           Ubuntu-11.10-desktop-64位
  • PC物理机           Ubuntu-12.04-desktop-64位

版本说明

  本文档基于:

  请确保安装的Swift版本和本文档中的版本相同。如有问题,请参考官网的更新文档。


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. 创建文件夹。

# mkdir ~/bin

 

2. 从git上获取swift代码,下载到本地。

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

 

3. 安装Swift的开发版本。

# cd ~/swift

# python setup.py develop

# cd ..

 

4. 从git上获取python-swiftclient代码,下载到本地。

# git clone https://github.com/openstack/python-swiftclient.git

 

5. 安装python-swiftclient的开发版本。

# cd ~/python-swiftclient

# python setup.py develop

# cd ..

 

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 increase file 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上后,也是以嵌套目录的形式存在,下载后,会在当前目录创建一样的嵌套目录。


 补充说明:

  现在已经完成SAIO的部署了,下面介绍一下系统环境的改变:

  1. ~/swift目录下存放Swift与python-swiftclient的源代码与执行脚本。

  • ~/swift/bin目录下存放执行脚本。
  • ~/swift/swift_1.7.6目录下存放Swift的源代码。
  • ~/swift/python-swiftclient_1.2.0目录下存放Swift客户端的源代码。

  2. /usr/local/lib/python2.7/dist-packages、/usr/share/pyshared、/usr/bin、/usr/local/bin等目录下存放Swift与python-swiftclient安装后的程序文件。

  3. Swift的回环设备挂载在/mnt/sdb1目录上。

  4. 回环设备对应的文件为/srv/swift-disk。

  5. 四个存储节点对应的实际存储空间(即共享上述回环设备)——/mnt/sdb1/1、/mnt/sdb1/2、/mnt/sdb1/3、/mnt/sdb1/4。

  6. 四个存储节点指向实际存储空间的软链接——/srv/1、/srv/2、/srv/3、/srv/4。

  7. 四个存储节点的对应的虚拟挂载点——/srv/1/node/sdb1、/srv/2/node/sdb2、/srv/2/node/sdb2、/srv/2/node/sdb2。

  8. Swift运行时所需目录/var/run/swift,用于存放各个服务进程的pid文件等内容。

  9. Swift临时缓存的目录(姑且这么理解)——/var/cache/swift、/var/cache/swift2、/var/cache/swift3、/var/cache/swift4。

  10. /etc/swift目录中存放Swift自身的配置文件。

  • /etc/swift/object-server目录中存放四个存储节点的Object Server配置文件。
  • /etc/swift/container-server目录中存放四个存储节点的Container Server配置文件。
  • /etc/swift/account-server目录中存放四个存储节点的Account Server配置文件。
  • /etc/swift/proxy-server.conf为Proxy Server的配置文件。
  • /etc/swift/swift.conf为Swift哈希后缀的配置文件。
  • backups目录、*.builder文件和*.ring.rz文件都是Ring的相关文件,其中*.ring.rz文件记录了生成的Ring。
  • test.conf文件是Swift单元测试所需的文件。

  11. /var/log/swift目录下存放rsyslog独立日志工具输出的日志文件。

  12. 其他被创建的文件:

  • /etc/rsyncd.conf,作为rsync数据镜像备份工具的配置文件。
  • /etc/rsyslog.d/10-swift.conf,作为rsyslog独立日志工具的配置文件。

  13. 其他被修改的文件:

  • /etc/fstab,回环设备挂载相关配置文件。
  • /etc/rc.local,使得系统在启动时自动创建一些Swift所需的目录,这些目录可能在系统关闭后丢失。
  • /etc/default/rsync,使rsync能开机启动。
  • /etc/rsyslog.conf,改变rsyslog工具所在的Group。
  • ~/.bashrc,使新增的环境变量生效。
分享到:
评论

相关推荐

    openstack(queens)All-in-One安装教程.pdf

    本文档主要针对Queens版本的OpenStack All-in-One环境进行安装与部署。 知识点三:虚拟机平台Vmware-Workstation Vmware-Workstation是VMware公司的一款流行的虚拟机软件。它允许用户在一个物理机器上运行多个操作...

    OpenStack swift 安装文档

    在这个文档中,我们将详述如何在Ubuntu 10.04 Desktop环境下安装和配置Swift,特别是使用SAIO(Swift All In One)的方式,即在一个单一的机器上部署所有Swift组件。 首先,确保你的系统是Ubuntu 10.04,并且你的...

    OpenStack Kilo—CentOS安装指南 中文版

    《OpenStack Kilo—CentOS安装指南中文版》是一份详细介绍了如何在基于Red Hat Enterprise Linux 7、CentOS 7以及Fedora 20等操作系统上安装与配置OpenStack Kilo版本的手册。这份文档不仅为读者提供了安装步骤,还...

    OpenStack自动部署教程

    - **All-in-One部署**:将所有OpenStack组件部署在同一台服务器上,适用于测试和小型环境。 - **硬件配置要求**:至少配备2个硬盘(1个系统盘,1个数据盘),2个网络接口卡(1个管理网络,1个计算网络)。 - **...

    OpenStack平台安装部署.pptx

    Devstack是一个快速部署OpenStack的开源项目,适用于在Ubuntu环境下以All-in-one模式部署OpenStack Juno社区版本。其目标包括: 1. 提供一个最小化的OpenStack环境,用作教学和运维操作。 2. 使学员亲手实践,增强...

    openstack精华笔记

    OpenStack 可以采用多种方式进行部署,包括All-in-One(所有服务在一个节点上)、Multinode(多个节点分担不同服务)和Hypervisor-based(基于特定虚拟化技术的部署)。部署时通常会结合使用像Kolla、Fuel、Mirantis...

    openstack安装图解.docx

    ### 一、云计算与OpenStack概述 #### 1. 传统的信息中心 在云计算出现之前,传统的信息中心或数据中心通常采用物理...以上步骤为简化版的安装流程,实际操作过程中可能会遇到各种问题,建议参考官方文档进行详细配置。

    全套openstack视频、安装包、文档.zip

    这通常涉及选择合适的部署模型(如All-in-One或Multi-node),配置主机环境,安装必要的依赖,然后使用OpenStack的初始化工具如DevStack或Fuel进行安装。 7. **OpenStack组件详解**: - **Nova**:负责计算资源的...

    HCIP-OpenStack总结部分-PPT

    12. **OpenStack部署和配置**:PPT可能还会介绍不同的部署模型(如All-in-One、Multi-Node),以及如何使用工具如Fuel、Ansible或TripleO进行自动化部署。 13. **OpenStack的扩展性和高可用性**:讨论如何通过设计...

    16-搭建 OpenStack 实验环境 1

    最小化的 All-in-One 配置将所有节点功能整合在一个服务器上,而大规模生产环境则会将它们分散到多个物理服务器,以实现更好的性能、可扩展性和高可用性。 在我们的实验环境中,我们将使用两个虚拟机: - devstack-...

    联想ThinkCloud OpenStack方案介绍.pdf

    也意味着他们将为用户提供基于OpenStack的云服务,如联想Public Cloud,这是一个基于ECS(弹性计算服务)的公有云平台,以及ThinkCloud AIO(All-in-One),这是一种融合架构的云一体机,为企业提供便捷的私有云部署...

    SFO部署手册v1.01

    在部署SFO之前,需要准备一个完整的OpenStack-Swift集群,可以是All-in-One的集群,也可以是分布式集群。同时,需要配置recon功能,该功能在Swift的配置文件中启用。此外,还需要配置StatsD服务器,并将数据发送到...

    Openstack企业级云服务架构.pptx

    设计合理的部署架构至关重要,这可能涉及ALL IN ONE的开发测试环境、DevStack快速部署,以及企业级高可用的生产环境,比如使用Fuel、RDO或Juju工具。硬件选型、组网方案、超融合与分离部署的决策,以及基础服务的高...

    OpenStack技术源码模块解读.docx

    - **部署环境**:为了便于源码调试,需要搭建一个“all-in-one”的OpenStack开发环境,如RDO的Packstack quickstart或DevStack。 - **调试工具**:Python的debugging工具如pdb,对于跟踪代码执行路径至关重要。 3. ...

Global site tag (gtag.js) - Google Analytics