軟件安裝
Swift依賴以下軟件python-setuptools,xinetd, xfsprogs, pip, greenlet, eventlet, Paste, PasteDeploy, simplejson, WebOb,xattr, netifaces。 python-setuptools, xinetd和xfsprogs可通過在線或我原來提供的光盤安裝方法安裝,後面幾個除netifaces外在我原來提供的軟件包中都有。
yum install python-setuptools xinetd xfsprogs
tar zxpf pip-1.1.tar.gz && cd pip-1.1 && python setup.py install
cd ../pipdowns
pip install greenlet-0.3.4.zip eventlet-0.9.16.tar.gz Paste* simplejson-2.5.0.tar.gz WebOb-1.0.8.zip xattr-0.6.4.tar.gz
pip install netifaces
cd .. && tar zxpf swift-1.4.8.tar.gz && cd swift-1.4.8 && python setup.py install
創建swift使用的磁盤
我這裏以我的/dev/sdb爲例
fdisk /dev/sdb (依次輸入n<Enter>p<Enter>1<Enter><Enter><Enter>w<Enter>)
mkfs.xfs -i size=1024 /dev/sdb1
echo "/dev/sdb1 /srv/node/sdb1 xfs noatime,nodiratime,nobarrier,logbufs=8 0 0" >> /etc/fstab
mkdir -p /srv/node/sdb1
mount /srv/node/sdb1
useradd –Mr swift
chown -R swift:swift /srv/node
設置ntp
Ntp的設置同CentOS6.2下一步一步源代碼安裝OpenStack(七)安裝配置計算節點計算節點的ntp設置一樣。
設置rsync
創建文件/etc/rsyncd.conf
uid = swift
gid = swift
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
#address = <STORAGE_LOCAL_NET_IP>
[account]
max connections = 2
path = /srv/node/
read only = false
lock file = /var/lock/account.lock
[container]
max connections = 2
path = /srv/node/
read only = false
lock file = /var/lock/container.lock
[object]
max connections = 2
path = /srv/node/
read only = false
lock file = /var/lock/object.lock
修改/etc/xinetd.d/rsync
sed -i 's/yes/no/' /etc/xinetd.d/rsync
sed -i 's/IPv6/IPv4/' /etc/xinetd.d/rsync
啓動xinetd
service xinetd start
創建配置文件
mkdir /etc/swift
創建文件 /etc/swift/account-server.conf:
[DEFAULT]
#bind_ip = <STORAGE_LOCAL_NET_IP>
workers = 2
[pipeline:main]
pipeline = account-server
[app:account-server]
use = egg:swift#account
[account-replicator]
[account-auditor]
[account-reaper]
創建文件 /etc/swift/container-server.conf:
[DEFAULT]
#bind_ip = <STORAGE_LOCAL_NET_IP>
workers = 2
[pipeline:main]
pipeline = container-server
[app:container-server]
use = egg:swift#container
[container-replicator]
[container-updater]
[container-auditor]
創建文件 /etc/swift/object-server.conf: [DEFAULT]
#bind_ip = <STORAGE_LOCAL_NET_IP>
workers = 2
[pipeline:main]
pipeline = object-server
[app:object-server]
use = egg:swift#object
[object-replicator]
[object-updater]
[object-auditor]
[object-expirer]
將代理節點產生的account.ring.gz, container.ring.gz和 object.ring.gz及swift.conf拷到/etc/swift並更改文件用戶chown –R swift:swift /etc/swift
以上配置文件中有一項bind_ip設置,目的是隻監聽內網ip的相應端口,但是這樣把配置文件拷到每個存儲節點時都要修改,我覺得可以把這項去掉,這樣所有存儲節點的配置就是一樣了,直接用就是,真需要考慮安全的話可以在iptables上只開放內網的ip及端口即可。
啓動存儲節點
swift-init object-serverstart
swift-init object-replicator start
swift-init object-updater start
swift-init object-auditor start
swift-init container-server start
swift-init container-replicator start
swift-init container-updater start
swift-init container-auditor start
swift-init account-server start
swift-init account-replicator start
swift-init account-auditor start