CentOS6.2下一步一步源代码安装OpenStack(九)Swift存储节点安装、配置及运行

软件安装

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

 


北方工业大学 | 云计算研究中心 | 姜永

你可能感兴趣的:(centos,python,object,File,存储,Path)