位置: 编程技术 - 正文
推荐整理分享CentOS 6.4如何安装及设置GlusterFS以解决网络存储的问题(centos6.5怎么安装),希望有所帮助,仅作参考,欢迎阅读内容。
文章相关热门搜索词:centos6.5怎么安装,centos6.6安装,centos6.2安装教程,centos6.5安装步骤,centos6.5怎么安装,centos6.5怎么安装,centos 6.5 安装,centos6.5怎么安装,内容如对您有帮助,希望把文章链接给更多的朋友!
GlusterFS因有很好的扩展性,使用的用户很多,使用GlusterFS能够解决网络存储、冗余备份等问题,那么在Linux下要如何安装GlusterFS呢?今天小编以CentOS6.4为例,给大家介绍下CentOS6.4安装配置GlusterFS的方法。
环境介绍:
OS: CentOS 6.4 x_ Minimal
Servers: sc2-log1,sc2-log2,sc2-log3,sc2-log4
Client: sc2-ads
具体步骤:
1. 在sc2-log{1-4}上安装GlusterFS软件包:
代码如下
# wget -P /etc/yum.repos.d # yum install -y glusterfs-3.4.2-1.el6 glusterfs-server-3.4.2-1.el6 glusterfs-fuse-3.4.2-1.el6
# /etc/init.d/glusterd start
# chkconfig glusterfsd on
2. 在sc2-log1上配置整个GlusterFS集群:
代码如下
[root@sc2-log1 ~]# gluster peer probe sc2-log1
1 peer probe: success: on localhost not needed
[root@sc2-log1 ~]# gluster peer probe sc2-log2
1 peer probe: success
[root@sc2-log1 ~]# gluster peer probe sc2-log3
1 peer probe: success
[root@sc2-log1 ~]# gluster peer probe sc2-log4
1 peer probe: success
[root@sc2-log1 ~]# gluster peer status
Number of Peers: 3
Hostname: sc2-log2
Port:
Uuid: af-bae9--9cbd-b5be5d
State: Peer in Cluster (Connected)
Hostname: sc2-log3
Port:
Uuid: a7b8d-e3b3--baf9-ee
State: Peer in Cluster (Connected)
Hostname: sc2-log4
Port:
Uuid: bfa---af-7a6bcafd9
State: Peer in Cluster (Connected)
3. 在sc2-log{1-4}上创建数据存放目录:
代码如下
# mkdir -p /usr/local/share/{models,geoip,wurfl}
# ls -l /usr/local/share/
1 total
2 drwxr-xr-x 2 root root Apr 1 : geoip
3 drwxr-xr-x 2 root root Apr 1 : models
4 drwxr-xr-x 2 root root Apr 1 : wurfl
4. 在sc2-log1上创建GlusterFS磁盘:
代码如下
[root@sc2-log1 ~]# gluster volume create models replica 4 sc2-log1:/usr/local/share/models sc2-log2:/usr/local/share/models sc2-log3:/usr/local/share/models sc2-log4:/usr/local/share/models force
1 volume create: models: success: please start the volume to access data
[root@sc2-log1 ~]# gluster volume create geoip replica 4 sc2-log1:/usr/local/share/geoip sc2-log2:/usr/local/share/geoip sc2-log3:/usr/local/share/geoip sc2-log4:/usr/local/share/geoip force
1 volume create: geoip: success: please start the volume to access data
[root@sc2-log1 ~]# gluster volume create wurfl replica 4 sc2-log1:/usr/local/share/wurfl sc2-log2:/usr/local/share/wurfl sc2-log3:/usr/local/share/wurfl sc2-log4:/usr/local/share/wurfl force
1 volume create: wurfl: success: please start the volume to access data
[root@sc2-log1 ~]# gluster volume start models
1 volume start: models: success
[root@sc2-log1 ~]# gluster volume start geoip
1 volume start: geoip: success
[root@sc2-log1 ~]# gluster volume start wurfl
1 volume start: wurfl: success
[root@sc2-log1 ~]# gluster volume info
Volume Name: models
Type: Replicate
Volume ID: bbbd-6d8c-c0-b-fa5af
Status: Started
Number of Bricks: 1 x 4 = 4
Transport-type: tcp
Bricks:
Brick1: sc2-log1:/usr/local/share/models
Brick2: sc2-log2:/usr/local/share/models
Brick3: sc2-log3:/usr/local/share/models
Brick4: sc2-log4:/usr/local/share/models
Volume Name: geoip
Type: Replicate
Volume ID: b0caa8-7c--beae-6fb1cffa3
Status: Started
Number of Bricks: 1 x 4 = 4
Transport-type: tcp
Bricks:
Brick1: sc2-log1:/usr/local/share/geoip
Brick2: sc2-log2:/usr/local/share/geoip
Brick3: sc2-log3:/usr/local/share/geoip
Brick4: sc2-log4:/usr/local/share/geoip
Volume Name: wurfl
Type: Replicate
Volume ID: cad-eeab--a-ccf7ba
Status: Started
Number of Bricks: 1 x 4 = 4
Transport-type: tcp
Bricks:
Brick1: sc2-log1:/usr/local/share/wurfl
Brick2: sc2-log2:/usr/local/share/wurfl
Brick3: sc2-log3:/usr/local/share/wurfl
Brick4: sc2-log4:/usr/local/share/wurfl
5. 在sc2-ads上部署客户端并mount GlusterFS文件系统:
[sc2-ads][root@sc2-ads ~]# wget -P /etc/yum.repos.d [sc2-ads][root@sc2-ads ~]# yum install -y glusterfs-3.4.2-1.el6 glusterfs-fuse-3.4.2-1.el6
[sc2-ads][root@sc2-ads ~]# mkdir -p /mnt/{models,geoip,wurfl}
[sc2-ads][root@sc2-ads ~]# mount -t glusterfs -o ro sc2-log3:models /mnt/models/
[sc2-ads][root@sc2-ads ~]# mount -t glusterfs -o ro sc2-log3:geoip /mnt/geoip/
[sc2-ads][root@sc2-ads ~]# mount -t glusterfs -o ro sc2-log3:wurfl /mnt/wurfl/
[sc2-ads][root@sc2-ads ~]# df -h
1 Filesystem Size Used Avail Use% Mounted on
2 /dev/mapper/vg_t-lv_root
3 G 7.7G G % /
4 tmpfs 3.9G 0 3.9G 0% /dev/shm
5 /dev/xvda1 M M M 8% /boot
6 sc2-log3:models G 8.6G G % /mnt/models
7 sc2-log3:geoip G 8.6G G % /mnt/geoip
8 sc2-log3:wurfl G 8.6G G % /mnt/wurfl
6. 相关数据读写可用性测试:
在sc2-ads挂载点上写入数据:
代码如下
[sc2-ads][root@sc2-ads ~]# umount /mnt/models
[sc2-ads][root@sc2-ads ~]# mount -t glusterfs sc2-log3:models /mnt/models/
[sc2-ads][root@sc2-ads ~]# echo “This is sc2-ads” 》 /mnt/models/hello.txt
[sc2-ads][root@sc2-ads ~]# mkdir /mnt/testdir
在sc2-log1数据目录中进行查看:
[root@sc2-log1 ~]# ls /usr/local/share/models/
1 hello.txt testdir
结果: 数据写入成功
在sc2-log1数据目录中直接写入数据:
代码如下
[root@sc2-log1 ~]# echo “This is sc2-log1” 》 /usr/local/share/models/hello.2.txt
[root@sc2-log1 ~]# mkdir /usr/local/share/models/test2
在sc2-ads挂载点上进行查看:
[sc2-ads][root@sc2-ads ~]# ls /mnt/models
[sc2-ads][root@sc2-ads ~]# ls -l /mnt/models
1 hello.txt testdir
结果: 数据写入失败
在sc2-log1挂载点上写入数据:
代码如下
[root@sc2-log1 ~]# mount -t glusterfs sc2-log1:models /mnt/models/
[root@sc2-log1 ~]# echo “This is sc2-log1” 》 /mnt/models/hello.3.txt
[root@sc2-log1 ~]# mkdir /mnt/models/test3
在sc2-ads挂载点上进行查看:
[sc2-ads][root@sc2-ads models]# ls /mnt/models
1 hello.2.txt hello.3.txt hello.txt test2 test3 testdir
结果: 数据写入成功,同时之前写入失败的数据也成功加载了。
最终结论:
在数据目录中直接写入数据,会导致其它节点因为得不到通知而使数据同步失败。
正确的做法是所有的读写操作都通过挂载点来进行。
7. 其它操作笔记:
删除GlusterFS磁盘:
代码如下
# gluster volume stop models
# gluster volume delete models
卸载GlusterFS磁盘:
代码如下
sc2-log4
ACL访问控制:
代码如下
# gluster volume set models auth.allow ..1.*,..1.*
添加GlusterFS节点:
代码如下
# gluster peer probe sc2-log5
# gluster peer probe sc2-log6
# gluster volume add-brick models sc2-log5:/data/gluster sc2-log6:/data/gluster
迁移GlusterFS磁盘数据:
代码如下
# gluster volume remove-brick models sc2-log1:/usr/local/share/models sc2-log5:/usr/local/share/models start
# gluster volume remove-brick models sc2-log1:/usr/local/share/models sc2-log5:/usr/local/share/models status
# gluster volume remove-brick models sc2-log1:/usr/local/share/models sc2-log5:/usr/local/share/models commit
修复GlusterFS磁盘数据(例如在sc2-log1宕机的情况下):
代码如下
# gluster volume replace-brick models sc2-log1:/usr/local/share/models sc2-log5:/usr/local/share/models commit -force
# gluster volume heal models full
通过本文的介绍,想必你已经对GlusterFS在CentOS6.4的安装配置有了一定的了解,除此之外,本文还介绍了GlusterFS的其他操作方法。
在CentOS中安装和配置Xen虚拟机的教程 注1:本次实验环境真机CentOS5.位,虚拟机CentOS5.位,真机IP:...注2:实验前一定要先记下真机的MAC地址,以免以后不能上网用,我这里的MAC是:
CentOS下查看硬件信息的命令整理 安装包命令查找:复制代码代码如下:yumwhatprovides*/lspci查看主板型号:复制代码代码如下:dmidecode|grep-A"SystemInformation$"内存槽及内存条:复制代码代码如
在CentOS下使用Munin来监控服务器运行的方法 Munin的介绍和原理Munin是一个服务器监控工具,基于perl写的,能通过网络,定期收集所有节点服务器的信息,将服务器的数据信息保存为RRD文件格式,并
标签: centos6.5怎么安装
本文链接地址:https://www.jiuchutong.com/biancheng/363301.html 转载请保留说明!友情链接: 武汉网站建设