用GlusterFS+Swift搭建Object Storage Service

來源:互聯網
上載者:User

標籤:-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-scandir  (https://pypi.python.org/packages/77/3f/916f524f50ee65e3f465a280d2851bd63685250fddb3020c212b3977664d/scandir-1.6.tar.gz#md5=0180ddb97c96cbb2d4f25d2ae11c64ac)#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搭建Object Storage Service

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.