这几天正在自己搭建一个swift的环境。看了一些资料,结合自己的实践,写下了它:
OpenStack Hands on lab系列相关文章 见 http://www.linuxidc.com/Linux/2013-08/88170.htm
相关阅读:
OpenStack 监控 - 整合Nagios 调研总结 http://www.linuxidc.com/Linux/2013-02/79931.htm
CentOS 6.4 安装OpenStack Nova http://www.linuxidc.com/Linux/2013-07/86981.htm
采用OpenStack HP推Cloud OS云操作系统 http://www.linuxidc.com/Linux/2013-06/86361.htm
1.物理环境说明:
- Linux系统版本:Ubuntu Server 12.04
- Proxy Server IP: 10.214.0.181
- Storage Server One: 10.214.0.179
- Storage Server Two: 10.214.0.180
- Storage Server three: 10.214.0.182
2.重要组件说明:
node:运行一个或多个object storage service
proxy node:运行 proxy services
auth node:运行Auth service
storage:运行account,container,and object services
Ring:是Openstack object storage 到物理设备的映射集合

在所有节点上的准备工作:
安装服务
- apt-get install swift openssh-server rsync memcached python-netifaces python-xattr python-memcache
配置路径
- mkdir -p /etc/swift
- chown -R swift:swift /etc/swift/
新建文件 vim /etc/swift/swift.conf
- [swift-hash]
- # random unique string that can never change (DO NOT LOSE)
- swift_hash_path_suffix = fLIbertYgibbitZ
3.安装和配置storage nodes
安装:Storage node packages,所有storage都要进行操作。
- aptitude install swift-account swift-container swift-object xfsprogs
新建xfs系统分区,当然,(这需要一个空分区),如果硬盘的分区已经被使用而数据你又不想要了,那就删除分区后进行下列操作。否则添加一块新硬盘是最方便的选择。所有storage都要进行操作。
- fdisk /dev/sdb
- Command (m for help): n
- Partition type:
- p primary (0 primary, 0 extended, 4 free)
- e extended
- Select (default p): p
- Partition number (1-4, default 1): 1
- First sector (2048-488281249, default 2048):
- Using default value 2048
- Last sector, +sectors or +size{K,M,G} (2048-488281249, default 488281249):
- Using default value 488281249
- Command (m for help): p
- Disk /dev/sdb: 250.0 GB, 250000000000 bytes
- 255 heads, 63 sectors/track, 30394 cylinders, total 488281250 sectors
- Units = sectors of 1 * 512 = 512 bytes
- Sector size (logical/physical): 512 bytes / 512 bytes
- I/O size (minimum/optimal): 512 bytes / 512 bytes
- Disk identifier: 0x00000081
- Device Boot Start End Blocks Id System
- /dev/sdb1 2048 488281249 244139601 83 Linux
- Command (m for help): w
- The partition table has been altered!
识别并挂载新的分区:
- partprobe#如果不行,就重启一下吧。
- mkdir -p /srv/node/sdb1
- mkfs.xfs -i size=1024 /dev/sdb1 -f
- echo "/dev/sdb1 /srv/node/sdb1 xfs noatime,nodiratime,nobarrier,logbufs=8 0 0" >> /etc/fstab
- mount /srv/node/sdb1
- chown -R swift:swift /srv/node
创建并配置 vim /etc/rsyncd.conf
- uid = swift
- gid = swift
- log file = /var/log/rsyncd.log
- pid file = /var/run/rsyncd.pid
- address = 10.214.0.179
- [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
注意:path 写你实际的(刚才新建的)分区的位置。address修改为当前storage的地址。
编辑vim /etc/default/rsync(即设置为了开机启动)
- RSYNC_ENABLE = true
重新/启动服务
- service rsync restart
创建或检查 vim /etc/swift/account-server.conf
- [DEFAULT]
- devices = /sdb1
- mount_check = false
- bind_port = 6002
- user = swift
- bind_ip = 0.0.0.0
- workers = 2
- [pipeline:main]
- pipeline = account-server
- [app:account-server]
- use = egg:swift#account
- [account-replicator]
- [account-auditor]
- [account-reaper]
创建或检查 vim /etc/swift/container-server.conf
- [DEFAULT]
- devices = /sdb1
- mount_check = false
- bind_ip = 0.0.0.0
- bind_port = 6001
- workers = 2
- [pipeline:main]
- pipeline = container-server
- [app:container-server]
- use = egg:swift#container
- [container-replicator]
- [container-updater]
- [container-auditor]
- [container-sync]
- 注意:[container-sync]这个是添加上去的,不要忘记了
