openstack-havana云平台实验(11)
时间:2016-10-10 09:32 来源:潇湘夜雨 作者:华嵩阳 点击:次
log =internal log bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
meta-data=/dev/sdd1 isize=1024 agcount=4, agsize=655149 blks
= sectsz=512 attr=2, projid32bit=0
data = bsize=4096 blocks=2620595, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0
log =internal log bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda5 16G 2.2G 13G 15% /
tmpfs 495M 0 495M 0% /dev/shm
/dev/sda1 190M 36M 145M 20% /boot
/dev/sda3 1.9G 3.0M 1.8G 1% /home
/dev/sdb1 10G 33M 10G 1% /srv/node/sdb1
/dev/sdc1 10G 33M 10G 1% /srv/node/sdc1
/dev/sdd1 10G 33M 10G 1% /srv/node/sdd1
[root@localhost ~]# mount
/dev/sda5 on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
/dev/sda1 on /boot type ext4 (rw)
/dev/sda3 on /home type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
/dev/sdb1 on /srv/node/sdb1 type xfs (rw,noatime,nodiratime,nobarrier,logbufs=8)
/dev/sdc1 on /srv/node/sdc1 type xfs (rw,noatime,nodiratime,nobarrier,logbufs=8)
/dev/sdd1 on /srv/node/sdd1 type xfs (rw,noatime,nodiratime,nobarrier,logbufs=8)
[root@localhost ~]# ls -lh /srv/
总用量 4.0K
drwxr-xr-x 5 swift swift 4.0K 10月 7 17:07 node
[root@localhost ~]# for SERVICE in account container object; do service openstack-swift-$SERVICE start; done
Starting openstack-swift-account: [确定]
Starting openstack-swift-container: [确定]
Starting openstack-swift-object: [确定]
[root@localhost ~]# for SERVICE in account container object; do chkconfig openstack-swift-$SERVICE on; done
6.3 安装配置Swift的代理节点
6.3.1 安装swift-proxy服务
# yum install openstack-swift-proxy memcached python-keystone openstack-utils python-keystoneclient
可以安装在单个节点上
6.3.2 启动memcached服务
通过/etc/sysconfig/memcached配置文件为memcached服务配置好合适的参数后即可启动此服务。
# service memcached start
# chkconfig memcached on
[root@localhost ~]# cat /etc/sysconfig/memcached
PORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="64"
OPTIONS=""
# cd /etc/swift #一定要进入到该目录执行下面的目录
# swift-ring-builder account.builder create 18 3 1
# swift-ring-builder container.builder create 18 3 1
# swift-ring-builder object.builder create 18 3 1
上面的命令后面三个参数中,18表示构建一致hash环时其环的大小,即使用2^18大小的环。实际使用中,可以根据节点数规模进行调整,最大为32;3表示为每个对象存储3个副本;最后的1表示多长时间可以移动一次某partiton。
6.3.5 将存储设备关系至ring
在ring文件创建完成后,还需要将每个存储设备添加至每个ring上,而且通常需要以account、container和object的顺序进行。其格式为:
# swift-ring-builder account.builder add z<ZONE>-<STORAGE_LOCAL_NET_IP>:6002/<DEVICE> 100
# swift-ring-builder container.builder add z<ZONE>-<STORAGE_LOCAL_NET_IP_1>:6001/<DEVICE> 100
# swift-ring-builder object.builder add z<ZONE>-<STORAGE_LOCAL_NET_IP_1>:6000/<DEVICE> 100
其中<ZONE>为zone编号,如z1表示第一个zone;<STORAGE_LOCAL_NET_IP>表示存储节点自己的IP地址;<DEVICE>表示对应设备的设备名称或挂载点名称(二者通常相同),如/dev/sdb1设备的挂载点为/srv/node/sdb1时,其<DEVICE>即为sdb1。因此,将sdb1、sdc1和sdd1三个设备添加至ring文件可通过如下命令实现。
# swift-ring-builder account.builder add z1-172.18.109.237:6002/sdb1 100
# swift-ring-builder container.builder add z1-172.18.109.237:6001/sdb1 100
# swift-ring-builder object.builder add z1-172.18.109.237:6000/sdb1 100
# swift-ring-builder account.builder add z2-172.18.109.237:6002/sdc1 100
# swift-ring-builder container.builder add z2-172.18.109.237:6001/sdc1 100
# swift-ring-builder object.builder add z2-172.18.109.237:6000/sdc1 100
# swift-ring-builder account.builder add z3-172.18.109.237:6002/sdd1 100
# swift-ring-builder container.builder add z3-172.18.109.237:6001/sdd1 100
# swift-ring-builder object.builder add z3-172.18.109.237:6000/sdd1 100
查看每个ring文件的内容,验正添加结果:
# swift-ring-builder account.builder
account.builder, build version 3
262144 partitions, 3.000000 replicas, 1 regions, 3 zones, 3 devices, 100.00 balance
The minimum number of hours before a partition can be reassigned is 1
Devices: id region zone ip address port replication ip replication port name weight partitions balance meta
0 1 1 172.18.109.237 6002 172.18.109.237 6002 sdb1 100.00 0 -100.00
1 1 2 172.18.109.237 6002 172.18.109.237 6002 sdc1 100.00 0 -100.00
2 1 3 172.18.109.237 6002 172.18.109.237 6002 sdd1 100.00 0 -100.00
[root@localhost ~]# swift-ring-builder container.builder
container.builder, build version 3
262144 partitions, 3.000000 replicas, 1 regions, 3 zones, 3 devices, 100.00 balance
The minimum number of hours before a partition can be reassigned is 1
Devices: id region zone ip address port replication ip replication port name weight partitions balance meta
0 1 1 172.18.109.237 6001 172.18.109.237 6001 sdb1 100.00 0 -100.00
1 1 2 172.18.109.237 6001 172.18.109.237 6001 sdc1 100.00 0 -100.00
2 1 3 172.18.109.237 6001 172.18.109.237 6001 sdd1 100.00 0 -100.00
[root@localhost ~]# swift-ring-builder object.builder
object.builder, build version 3
262144 partitions, 3.000000 replicas, 1 regions, 3 zones, 3 devices, 100.00 balance
The minimum number of hours before a partition can be reassigned is 1 (责任编辑:liangzh) |