swift安装及开发调试环境.docx
《swift安装及开发调试环境.docx》由会员分享,可在线阅读,更多相关《swift安装及开发调试环境.docx(17页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、目录一、swift源码多机部署21 、为每一台机器安装依赖包22. 为每一台机器创建swift用户23. 下载源码(在swift用户下操作)34. 安装swauth和swift (在swift用户下操作)45. Proxy节点的设置46. 配置Storage节点77、 测试swift(在Proxy主机上测试)13二、Swift调试环境搭建:eclipse+pydev151、安装jdk152、安装eclipse153、配置PyDev154、导入swift项目16一、swift源码多机部署所有操作都是在Ubuntu Server 11.10 32位系统上通过验证。本文参考了Openstack-sw
2、ift的Instructions for a Multiple Server SwiftInstallation (Ubuntu)文档,具体信息如下:Linux系统版本:Ubuntu Server 11.10 32-bit Proxy Server IP: 192.168.1.129Storage Server One:192.168.1.130Storage Server Two:192.168.1.131Storage Server Three:192.168.1.132官方文档: www.openstack.org参考文档: http:/swift.openstack.org/howto
3、_installmultinode.htmlSwift版本: 1.4.8Swauth版本: 1.0.41 、为每一台机器安装依赖包sudo apt-get -option Dpkg:Options:=-force-confold -assume-yes updatesudo apt-get install pep8 pylint python-pip screen unzip wget psmisc git-core lsof openssh-server vim-nox locate python-virtualenv python-unittest2 iputils-ping wget c
4、url tcpdump euca2ools python-setuptools python-dev python-lxml python-pastescript python-pastedeploy python-paste sqlite3 python-pysqlite2 python-sqlalchemy python-mysqldb python-webob python-greenlet python-routes libldap2-dev libsasl2-dev python-bcrypt curl gcc python-configobj python-coverage pyt
5、hon-dev python-eventlet python-greenlet python-netifaces python-nose python-pastedeploy python-setuptools python-simplejson python-webob python-xattr sqlite3 xfsprogs2. 为每一台机器创建swift用户sudo useradd -mk /home/swift/ -s /bin/bash swiftsudo passwd swift #为swift用户添加密码,在此我将其设为了swift编辑/etc/sudoer文件,在文件末尾添加
6、如下代码swift ALL=(ALL) NOPASSWD:ALL3. 下载源码(在swift用户下操作)在Proxy机器中下载swauth和swift源码su swift#切换到swift用户sudo mkdir /home/swift/openstack#创建一个目录来存放cd /home/swift/openstackgit clone #下载swiftcd swiftgit checkout 1.4.8#使用1.4.8版本,在swift目录下你可以#使用git tag命令查看有多少个版本git clone #下载swauthcd swauthgit checkout 1.0.4在每一台S
7、torage节点的机器中下载swiftsu swift#切换到swift用户sudo mkdir /home/swift/openstack#创建一个目录来存放cd /home/swift/openstackgit clone #下载swiftcd swiftgit checkout 1.4.8#使用1.4.8版本,在swift目录下你可以使用git tag命令查看有多少个版本4. 安装swauth和swift (在swift用户下操作) 在Proxy机器中安装swauth和swiftcd /home/swift/openstack/swauthsudo python setup.py ins
8、tall -record file.txtcd /home/swift/openstack/swift#在Proxy节点中安装swift是为了使用swift的swift-proxy-serversudo python setup.py install -record file.txt注:file.txt文件记录了安装信息,要想删除所安装的软件通过命令sudo cat file.txt | xargs rm -rf即可删除,这一步可能会出现禁止删除问题,因此你需要使用root用户来操作。在每一台Storage节点的机器中安装swiftcd /home/swift/openstack/swifts
9、udo python setup.py install -record file.txt5. Proxy节点的设置1.sudo apt-get install memcached#安装缓存服务器修改/etc/ memcached.conf文件,将-l 127.0.0.1改为-l 192.168.1.129(这里我是根据我自己的情况设定的,具体原因见第一点中的图)sudo service memcached restartsudo mkdir /etc/swiftcd /etc/swiftsudo chown -R swift:swift /etc/swiftcp /home/swift/ope
10、nstack/swift/etc/proxy-server.conf /etc/swift/cp /home/swift/openstack/swift/etc/swift.conf /etc/swift/2.修改/etc/swift/proxy-server.conf文件,具体内容如下,原文件中没有的项需要自行增加DEFAULTbind_port = 8080user = swiftlog_facility = LOG_LOCAL0pipeline:mainpipeline = catch_errors healthcheck cache ratelimit swauth proxy-ser
11、verapp:proxy-serveruse = egg:swift#proxyallow_account_management = trueaccount_autocreate = truefilter:swauthuse = egg:swauth#swauth# Highly recommended to change this.super_admin_key = swauthkeydefault_swift_cluster = local#http:/192.168.1.129:8080/auth/v1.0 filter:healthcheckuse = egg:swift#health
12、checkfilter:cacheuse = egg:swift#memcache3.修改/etc/swift/swift.conf,红色部分是随意更改的,你可以根据自己的需要更改swift-hashswift_hash_path_suffix = tuletech4.生成相关ring以及builder文件,使用如下命令生成,红色部分是根据具体情况而更改的,具体原因见摘要说明里的图。每一台机器使用一个域(z1, z2, z3依次递增)sudo chown -R swift:swift /etc/swift/*cd /etc/swiftswift-ring-builder object.buil
13、der create 18 3 1swift-ring-builder container.builder create 18 3 1swift-ring-builder account.builder create 18 3 1export HOST_IP=192.168.1.130swift-ring-builder object.builder add z1-$HOST_IP:6010/sdb1 100swift-ring-builder container.builder add z1-$HOST_IP:6011/sdb1 100swift-ring-builder account.b
14、uilder add z1-$HOST_IP:6012/sdb1 100export HOST_IP=192.168.1.131swift-ring-builder object.builder add z2-$HOST_IP:6010/sdb1 100swift-ring-builder container.builder add z2-$HOST_IP:6011/sdb1 100swift-ring-builder account.builder add z2-$HOST_IP:6012/sdb1 100export HOST_IP=192.168.1.132swift-ring-buil
15、der object.builder add z3-$HOST_IP:6010/sdb1 100swift-ring-builder container.builder add z3-$HOST_IP:6011/sdb1 100swift-ring-builder account.builder add z3-$HOST_IP:6012/sdb1 100swift-ring-builder object.builder rebalanceswift-ring-builder container.builder rebalanceswift-ring-builder account.builde
16、r rebalance5.启动proxy服务swift-init proxy start6. 配置Storage节点因为每个Storage节点的设置基本上是相似的,所以在这里只拿其中一个节点做示例(192.168.1.130),其他节点只需要重复一下几步操作就可以了1.创建/etc/swift目录sudo mkdir /etc/swiftsudo chown -R swift:swift /etc/swift/*2.将Proxy节点上/etc/swift/中的account.ring.gz container.ring.gz object.ring.gz swift.conf拷贝到当前存储节点
17、(192.168.1.130)/etc/swift目录中,可使用如下命令scp swift192.168.1.129:/etc/swift/*.ring.gz /etc/swift/scp swift192.168.1.129:/etc/swift/swift.conf /etc/swift/sudo chown -R swift:swift /etc/swift/*3.更改/etc/rsyncd.conf文件,如果该文件不存在则需要自行创建,内容如下uid = swiftgid = swiftlog file = /var/log/rsyncd.logpid file = /var/run/
18、rsyncd.pidaddress = 192.168.1.130#这里也可以改为127.0.0.1accountmax connections = 2path = /srv/node/read only = falselock file = /var/lock/account.lockconainermax connections = 2path = /srv/node/read only = falselock file = /var/lock/container.lockobjectmax connections = 2path = /srv/node/read only = false
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- swift 安装 开发 调试 环境
限制150内