码迷,mamicode.com
首页 > 编程语言 > 详细

用GlusterFS+Swift搭建对象存储

时间:2018-06-07 14:19:25      阅读:798      评论:0      收藏:0      [点我收藏+]

标签:-o   安装   wing   over   seq   发包   containe   ret   test   

在已经搭建好的GlusterFS服务器上(如不知道如何搭建GlusteFS请参考上一篇):

Create bricks:

# truncate -s 1GB /srv/disk{1..4}# for i in `seq 1 4`;do mkfs.xfs -i size=512 /srv/disk$i ;done# mkdir -p /export/brick{1..4}

Add the following lines to /etc/fstab to auto-mount the the bricks on system startup:

/srv/disk1    /export/brick1   xfs   loop,inode64,noatime,nodiratime 0 0
/srv/disk2    /export/brick2   xfs   loop,inode64,noatime,nodiratime 0 0
/srv/disk3    /export/brick3   xfs   loop,inode64,noatime,nodiratime 0 0
/srv/disk4    /export/brick4   xfs   loop,inode64,noatime,nodiratime 0 0

Mount the bricks:

# mount -a

You can now create and start the GlusterFS volume. Make sure your hostname is in /etc/hosts or is DNS-resolvable.

# gluster volume create swift-test-vol-01 replica 2 transport tcp cnsz22VLK5966.ossit.sfdc.com.cn:/export/brick{1..4}/data force
 
 
Mount the GlusterFS volume:
# mkdir -p /mnt/gluster-object/test-vol-01 
# mount -t glusterfs cnsz22VLK5966.ossit.sfdc.com.cn:swift-test-vol-01  /mnt/gluster-object/test-vol-01
 
 
Installing Openstack Swift
# yum install centos-release-openstack-newton    (http://mirrors.aliyun.com/centos/7/extras/x86_64/Packages/
# yum install openstack-swift-*   (http://mirrors.aliyun.com/centos/7/cloud/x86_64/openstack-newton/
 
 
Installing gluster-swift  (注意安装版本要与openstack swift版本一致)
# yum install epel-release     (http://mirrors.aliyun.com/centos/7/extras/x86_64/Packages/
#yum install python-prettytable     (安装python相关包过程中如果遇到gcc相关编译报错,请执行yum install python-devel 安装python开发包)
#yum install git
# git clone https://github.com/gluster/gluster-swift; cd gluster-swift
# python setup.py install
 
 
gluster-swift configuration files
# mkdir -p /etc/swift/
# cp etc/* /etc/swift/
# cd /etc/swift
# for tmpl in *.conf-gluster ; do cp ${tmpl} ${tmpl%.*}.conf; done
 
 
Export GlusterFS volumes over gluster-swift   
# gluster-swift-gen-builders [VOLUME] [VOLUME...](命令格式)
# gluster-swift-gen-builders swift-test-vol-01 (命令实例)
 
 
Start gluster-swift
# swift-init main start
 
 
Using gluster-swift
 
Create a container
# curl -i -X PUT http://localhost:8080/v1/AUTH_swift-test-vol-01/test-container-01
# ls /mnt/gluster-object/swift-test-vol-01/
 
Create an object
# echo "Hello Swift" > test.txt
#curl -i -X PUT -T test.txt http://localhost:8080/v1/AUTH_swift-test-vol-01/test-container-01/test.txt
# cat /mnt/gluster-object/swift-test-vol-01/test-container-01/test.txt
 
Request the object
# curl -i -X GET -o newTest.txt http://localhost:8080/v1/AUTH_swift-test-vol-01/test-container-01/test.txt
#cat newTest.txt
 
Delete the object
#curl -i -X DELETE http://localhost :8080/v1/AUTH_swift-test-vol-01/test-container-01/test.txt
 
如果不是GlusterFS服务器,需要先安装以下包:
 
Installing and starting GlusterFS
 
# yum install centos-release-gluster
# yum install glusterfs glusterfs-server  glusterfs-cli glusterfs-libs glusterfs-client glusterfs-fuse glusterfs-api

用GlusterFS+Swift搭建对象存储

标签:-o   安装   wing   over   seq   发包   containe   ret   test   

原文地址:https://www.cnblogs.com/chmyee/p/9149671.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!