首先要感謝liu大神的翻譯與試驗,http://www.cnblogs.com/yuki-lau/
簡介
本文詳細描述使用單台服務器部署一個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.7.6-dev documentation
- Swift版本:1.7.6
- python-swiftclient版本:1.2.0
請確保安裝的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,使新增的環境變量生效。