码迷,mamicode.com
首页 > 其他好文 > 详细

openstack I版的搭建一十--基于glusterfs的云硬盘

时间:2014-08-27 19:01:48      阅读:4063      评论:0      收藏:0      [点我收藏+]

标签:openstack

计算节点和控制节点上都安装一下

cd /etc/yum.repos.d/

wget http://download.gluster.org/pub/gluster/glusterfs/3.4/3.4.3/CentOS/glusterfs-epel.repo

yum install glusterfs-server

验证一下两个节点是否安装成功

[root@linux-node1 ~]# glusterfs -V

glusterfs 3.4.5 built on Jul 24 2014 19:11:45

Repository revision: git://git.gluster.com/glusterfs.git

Copyright (c) 2006-2013 Red Hat, Inc. <http://www.redhat.com/>

GlusterFS comes with ABSOLUTELY NO WARRANTY.

It is licensed to you under your choice of the GNU Lesser

General Public License, version 3 or any later version (LGPLv3

or later), or the GNU General Public License, version 2 (GPLv2),

in all cases as published by the Free Software Foundation.


[root@linux-node2 yum.repos.d]# glusterfs -V

glusterfs 3.4.5 built on Jul 24 2014 19:11:45

Repository revision: git://git.gluster.com/glusterfs.git

Copyright (c) 2006-2013 Red Hat, Inc. <http://www.redhat.com/>

GlusterFS comes with ABSOLUTELY NO WARRANTY.

It is licensed to you under your choice of the GNU Lesser

General Public License, version 3 or any later version (LGPLv3

or later), or the GNU General Public License, version 2 (GPLv2),

in all cases as published by the Free Software Foundation.

启动



[root@linux-node1 ~]# /etc/init.d/gluster

glusterd    glusterfsd  

[root@linux-node1 ~]# /etc/init.d/glusterd start

Starting glusterd:                                         [确定]


[root@linux-node2 ~]# /etc/init.d/glusterd start

Starting glusterd:                                         [确定]



[root@linux-node1 ~]# cat /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4

::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.33.11 linux-node1.openstack.com linux-node1

192.168.33.12 linux-node2.openstack.com linux-node2

[root@linux-node2 ~]# cat /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4

::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.33.12 linux-node2.openstack.com linux-node2

192.168.33.11 linux-node1.openstack.com linux-node1



[root@linux-node1 ~]# mkdir /data/gg1

[root@linux-node2 ~]# mkdir /data/gg2

咱们创建一个复制的卷,复制两份


[root@linux-node2 ~]# gluster peer detach linux-node1.openstack.com

peer detach: success

[root@linux-node2 ~]# gluster peer status

peer status: No peers present


把另外一个节点加入到集群

把node1加入集群


glusterfs无中心的,对等的。

[root@linux-node2 ~]# gluster peer probe linux-node1.openstack.com

peer probe: success

[root@linux-node2 ~]# gluster peer status

Number of Peers: 1


Hostname: linux-node1.openstack.com

Port: 24007

Uuid: af7dd374-12c0-4201-8415-fe1a1e22f851

State: Peer in Cluster (Connected)

[root@linux-node2 ~]# gluster volume create demo replica 2 linux-node1.openstack.com:/data/gg1 linux-node2.openstack.com:/data/gg2 force

volume create: demo: success: please start the volume to access data


启动卷

[root@linux-node2 ~]# gluster vol start demo

volume start: demo: success


我们查看一下,我们可以看到,你的数据是放两份的

[root@linux-node2 ~]# gluster vol info

 

Volume Name: demo

Type: Replicate

Volume ID: ced081c2-a4de-4f00-8260-5fc0fb36ea9f

Status: Started

Number of Bricks: 1 x 2 = 2

Transport-type: tcp

Bricks:

Brick1: linux-node1.openstack.com:/data/gg1

Brick2: linux-node2.openstack.com:/data/gg2


我们要用这个卷,我们该怎么办?该修改配置文件

1830gg 

volume_driver=cinder.volume.drivers.glusterfs.GlusterfsDriver

1107 

glusterfs_shares_config=/etc/cinder/glusterfs_shares

1120 

glusterfs_mount_point_base=$state_path/mnt



我们要先把NFS卸载掉

umount 192.168.33.11:/data/nfs

查看一下

mount


重启一下cinder的相关服务

[root@linux-node1 ~]# for i in {api,scheduler,volume};do /etc/init.d/openstack-cinder-$i restart;done

停止 openstack-cinder-api:                                [确定]

正在启动 openstack-cinder-api:                            [确定]

停止 openstack-cinder-scheduler:                          [确定]

正在启动 openstack-cinder-scheduler:                      [确定]

停止 openstack-cinder-volume:                             [确定]

正在启动 openstack-cinder-volume:                         [确定]

[root@linux-node1 ~]# mount

/dev/sda3 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)

none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)

sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)

nfsd on /proc/fs/nfsd type nfsd (rw)

192.168.33.11:/demo on /var/lib/cinder/mnt/4ac2acc000ff60653979b4a905bdecb3 type fuse.glusterfs (rw,default_permissions,allow_other,max_read=131072)



创建云硬盘

bubuko.com,布布扣

bubuko.com,布布扣

bubuko.com,布布扣

我们查看一下云硬盘都存在哪

[root@linux-node1 ~]# cat /etc/cinder/glusterfs_shares

192.168.33.11:/demo

[root@linux-node1 ~]# mount

/dev/sda3 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)

none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)

sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)

nfsd on /proc/fs/nfsd type nfsd (rw)

192.168.33.11:/demo on /var/lib/cinder/mnt/4ac2acc000ff60653979b4a905bdecb3 type fuse.glusterfs (rw,default_permissions,allow_other,max_read=131072)

[root@linux-node1 ~]# ll /var/lib/cinder/mnt/4ac2acc000ff60653979b4a905bdecb3

总用量 4

-rw-rw-rw- 1 root root 1073741824 8月  27 15:58 volume-ca55ee76-956c-4fb6-96ce-d0a5d1f45aa9

[root@linux-node1 ~]# ll /data/gg1/

总用量 4

-rw-rw-rw- 2 root root 1073741824 8月  27 15:58 volume-ca55ee76-956c-4fb6-96ce-d0a5d1f45aa9


[root@linux-node2 ~]# ll /data/gg2/

总用量 4

-rw-rw-rw- 2 root root 1073741824 8月  27 15:58 volume-ca55ee76-956c-4fb6-96ce-d0a5d1f45aa9

一共有三份

挂载到虚拟机实例上


bubuko.com,布布扣

bubuko.com,布布扣

bubuko.com,布布扣

bubuko.com,布布扣

bubuko.com,布布扣

接下来,我们要对这块硬盘进行格式化

sudo fdisk /dev/vdb

bubuko.com,布布扣bubuko.com,布布扣

sudo mkfs.ext3 /dev/vdb1

bubuko.com,布布扣

bubuko.com,布布扣

本地文件系统是最好的。

万兆网卡


本文出自 “8055082” 博客,谢绝转载!

openstack I版的搭建一十--基于glusterfs的云硬盘

标签:openstack

原文地址:http://8065082.blog.51cto.com/8055082/1545739

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