作者:80后女孩香香521 | 来源:互联网 | 2014-05-27 20:14
拓扑图实验环境:4台ESXi上的ubuntu-11.04-server-i386虚拟机,每个存储节点上多有10G虚拟存储/dev/sdb个人感觉官方配置文档中的,通用配置部分,下面两句容易引起歧义,可以忽略exportSTORAGE_LOCAL_NET_IP10.1.2.3exportPROXY_LOCAL_NET_I
拓扑图
实验环境:4台ESXi上的ubuntu-11.04-server-i386
虚拟机,每个存储节点上多有10G虚拟存储/dev/sdb
个人感觉官方配置文档中的,通用配置部分,下面两句容易引起歧义,可以忽略
export STORAGE_LOCAL_NET_IP=10.1.2.3
export PROXY_LOCAL_NET_IP=10.1.2.4
|
1)配置代理节点
"EN-US">perl -pi -e "s/-l 127.0.0.1/-l
192.168.1.37/" /etc/memcached.conf
Vim /etc/proxy-server.conf
[DEFAULT]
cert_file = /etc/swift/cert.crt
key_file = /etc/swift/cert.key
bind_port = 443
workers = 8
user = root
[pipeline:main]
pipeline = healthcheck cache swauth proxy-server
[app:proxy-server]
use = egg:swift#proxy
allow_account_management = true
[filter:swauth]
use = egg:swauth#swauth
default_swift_cluster = local#https://192.168.1.37:443/v1
super_admin_key = password
[filter:healthcheck]
use = egg:swift#healthcheck
[filter:cache]
use = egg:swift#memcache
memcache_servers = 192.168.1.37:11211
|
使用swauth认证,具体安装参考:http://blog.sina.com.cn/s/blog_4b8481f70100x9kk.html
Vim ring.sh
#!/bin/bash
a=1
swift-ring-builder account.builder create 18 $a 1
swift-ring-builder container.builder create 18 $a 1
swift-ring-builder object.builder create 18 $a 1
echo "swift-ring-builder 18 $a 1 done"
|
注a 表示为备份数目
Vim addring.sh
#!/bin/bash
ip=192.168.1.60
z=2
export
ZOnE=$z #
set the zone number for that storage device
export STORAGE_LOCAL_NET_IP=$ip # and
the IP address
export
WEIGHT=100 #
relative weight (higher for bigger/faster disks)
export DEVICE=sdb1
swift-ring-builder account.builder add
z$ZONE-$STORAGE_LOCAL_NET_IP:6002/$DEVICE $WEIGHT
swift-ring-builder container.builder add
z$ZONE-$STORAGE_LOCAL_NET_IP:6001/$DEVICE $WEIGHT
swift-ring-builder object.builder add
z$ZONE-$STORAGE_LOCAL_NET_IP:6000/$DEVICE $WEIGHT
|
备注:ip 和z选项需对应变化,
如ip=192.168.1.69, z=0; ip=192.168.1.82,z=1;
ip=192.168.1.60,z=2
表示每台服务器对应一个zone。
Vim verify.sh
#!/bin/bash
swift-ring-builder account.builder
swift-ring-builder container.builder
swift-ring-builder object.builder
|
Vim rebalance.sh
#!/bin/bash
swift-ring-builder account.builder rebalance
swift-ring-builder container.builder rebalance
swift-ring-builder object.builder rebalance
|
2)配置存储节点
所有的存储节点配置大径相同,本文以Storage1:192.168.1.69为例
1.必要存储节点安装包
apt-get install swift-account swift-container swift-object
xfsprogs
2创建XFS卷
fdisk /dev/sdb (set up a single partition)
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
chown -R swift:swift /srv/node
|
注:我做实验的时候改成chown ?R root:root /srv/node ,会出现错误
root@swift-proxy:/usr/src/lyq/swauth# swauth-prep -K
password -A https://127.0.0.1/auth/
Auth subsystem prep failed: 500 Server Error
|
Vim /etc/rsyncd.conf
uid = root
gid = root
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
address = 192.168.1.69
[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
|
vim account-server.conf
[DEFAULT]
bind_ip = 192.168.1.69
workers = 2
[pipeline:main]
pipeline = account-server
[app:account-server]
use = egg:swift#account
[account-replicator]
[account-auditor]
[account-reaper]
|
vim container-server.conf
[DEFAULT]
bind_ip = 192.168.1.69
workers = 2
[pipeline:main]
pipeline = container-server
[app:container-server]
use = egg:swift#container
[container-replicator]
[container-updater]
[container-auditor]
|
vim object-server.conf
[DEFAULT]
bind_ip = 192.168.1.69
workers = 2
[pipeline:main]
pipeline = object-server
[app:object-server]
use = egg:swift#object
[object-replicator]
[object-updater]
[object-auditor]
|
注:与上述的过程类似,可以成功的将所有的服务多装在任一台机器上,这就和官网上的SAIO的功能相同了,而且比官网的配置过程简单