4.安装swift
4.1 apt-get install安装
sudo apt-get install swift即可。
4.2源代码安装
从github上下载源代码。
git clone https://github.com/openstack/swift.gitswiftcd swiftgit checkout 1.4.8 #使用git tag 可以查看所有的版本sudo Python setup.py install --record log.txt # --record log.txt 可以记录安装信息,需要卸载的时候只需执行sudo cat file.txt | xargs rm -rf 。
注:使用apt-get install 安装的方式更利于维护和升级。如果要做二次开发的话,使用源代码安装比较好。
5.更改配置文件
所有的节点都需要配置文件如下:
/etc/rsyncd.conf #所有机器配置一样,系统中没有,见附件。/etc/default/rsync #系统自带,只需要将RSYNC_ENABLE=false更改为RSYNC_ENABLE=true。/etc/swift/swift.conf/etc/swift/account-server.conf/etc/swift/container-server.conf/etc/swift/object-server.conf
proxy server还要 /etc/swift/proxy-server.conf。除此之外,proxy-server需要安装memcached(sudo apt-get install memcached)做缓存。
其他的配置见附件。
6.启动服务
如果采用源代码安装,则需要添加swift用户(当然也可以不添加,在配置文件里面指定相应的用户名即可)
sudo groupadd swiftsudo useradd swift -g swift.
更改文件的所有者:
sudo chown -R swift:swift /etc/swiftsudo chown -R swift:swift /srv/node
所有节点启动服务:
sudo swift-init object-server startsudo swift-init object-replicator startsudo swift-init object-updater startsudo swift-init object-auditor startsudo swift-init container-server startsudo swift-init container-replicator startsudo swift-init container-updater startsudo swift-init container-auditor startsudo swift-init account-server startsudo swift-init account-replicator startsudo swift-init account-auditor start
启动proxy-server :
sudo swift-init proxy-server start
参考资料:
1.openstack 官方文档http://docs.openstack.org/trunk/openstack-object-storage/admin/content/ch_installing-openstack-object-storage.html
2. 使用Swauth认证多节点安装Swift http://www.linuxidc.com/Linux/2012-04/58100.htm
