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