在CentOS 7上安装和使用GlusterFS
GlusterFS aggregates various storage servers over Ethernet or Infiniband RDMA interconnect into one large parallel network file system. It is free software, with some parts licensed under the GNU General Public License(GPL) v3 while others are dual licensed under either GPL v2 or the Lesser General Public License (LGPL) v3. GlusterFS is based on a stackable user space design.
GlusterFS has a client and server component. Servers are typically deployed as storage bricks, with each server running a glusterfsd daemon to export a local file system as a volume. The glusterfs client process, which connects to servers with a custom protocol over TCP/IP, InfiniBand or Sockets Direct Protocol, creates composite virtual volumes from multiple remote servers using stackable translators. By default, files are stored whole, but striping of files across multiple remote volumes is also supported.
The final volume may then be mounted by the client host using its own native protocol via the FUSE mechanism, using NFS v3 protocol using a built-in server translator, or accessed via gfapi client library. Native-protocol mounts may then be re-exported e.g. via the kernel NFSv4 server, SAMBA, or the object-based OpenStack Storage (Swift) protocol using the “UFO” (Unified File and Object) translator.
I am using 2 CentOS 7 nodes with hostnames: glusterfs1 and glusterfs2 .
[root@glusterfs1 ~]# cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
[root@glusterfs2 ~]# cat /etc/os-release
N NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
Add this to both servers in /etc/hosts .
192.168.254.133 glusterfs1
192.168.254.134 glusterfs2
Installing in CentOS:
# wget -P /etc/yum.repos.d http://download.gluster.org/pub/gluster/glusterfs/LATEST/CentOS/glusterfs-epel.repo
# yum -y install glusterfs glusterfs-fuse glusterfs-server
# systemctl start glusterd
For glusterfs it is important to setup 2 identical partitions on all nodes. I will use /dev/sdb1 1 GB in size (Am using Vmware/Virtualbox in my case example).
fdisk /dev/sdb
Type ‘n’ for new partition. choose ‘p’ for primary, follow the wizard to complete, ‘w’ to write data to disk.
Create file system:
mkfs.ext4 /dev/sdb1
Create Sync directory on both machine:
mkdir -p /data/gluster/brick
mount /dev/sdb1 /data/gluster
You can add this to fstab to make it ready for the next reboot.
/dev/sdb1 /data/gluster ext4 default 1 2
Add iptable rules for glusterfs:
-A INPUT -mstate --state NEW -m tcp -p tcp -s 192.168.254.0/24 --dport 111 -j ACCEPT
-A INPUT -mstate --state NEW -m udp -p udp -s 192.168.254.0/24 --dport 111 -j ACCEPT
-A INPUT -mstate --state NEW -m tcp -p tcp -s 192.168.254.0/24 --dport 2049 -j ACCEPT
-A INPUT -mstate --state NEW -m tcp -p tcp -s 192.168.254.0/24 --dport 24007 -j ACCEPT
-A INPUT -mstate --state NEW -m tcp -p tcp -s 192.168.254.0/24 --dport 38465:38469 -j ACCEPT
-A INPUT -mstate --state NEW -m tcp -p tcp -s 192.168.254.0/24 --dport 49152 -j ACCEPT
Using GlusterFS
Added glusterfs2 in glusterfs1′s hosts file, and tested the config:
[root@glusterfs1 ~]# gluster peer probe glusterfs2
peer probe: success.
[root@glusterfs2 ~]# gluster peer probe glusterfs1
peer probe: success. Host glusterfs1 port 24007 already in peer list
At this time I can test the storage pool:
[root@glusterfs1 glusterfs]# gluster pool list
UUID Hostname State
4cf47688-74ba-4c5b-bf3f-3270bb9a4871 glusterfs2 Connected
a3ce0329-35d8-4774-a061-148a735657c4 localhost Connected
[root@glusterfs1 ~]# gluster volume status
No volumes present
Create a gluster volume and test replication:
[root@glusterfs1 ~]# gluster
gluster> volume create vol0 rep 2 transport tcp glusterfs1:/data/gluster/brick glusterfs2:/data/gluster/brick force
volume create: vol0: success: please start the volume to access data
gluster>
if vol creation fails for some reason, do # setfattr -x trusted.glusterfs.volume-id /data/gluster/brick and restart glusterd.
gluster> volume start vol0
volume start: vol0: success
Create mount point and mount the volume on both nodes:
[root@glusterfs1 ~]# mount -t glusterfs glusterfs1:/vol0 /mnt/gluster/
[root@glusterfs2 ~]# mount -t glusterfs glusterfs1:/vol0 /mnt/gluster/
[root@glusterfs1 ~]# cp /var/log/secure /mnt/gluster/
The content is automatically synced between nodes
[root@glusterfs1 ~]# ls /mnt/gluster/
secure
[root@glusterfs2 ~]# ls /mnt/gluster/
secure
在CentOS 7上安装和使用GlusterFS的更多相关文章
- 在CentOS 7上安装.NET Core R2跑Hello World
前言 在上个月.NET Core出了最新版本预览版,只是在Window系统上试验了一下.原本想等发布正式版的时候在linux系统上试试,可能还需要一段时间,刚好有空可以折腾一下. 由于之前安装的Ubu ...
- 如何在 CentOS 7 上安装 Redis 服务器
大家好,本文的主题是 Redis,我们将要在 CentOS 7 上安装它.编译源代码,安装二进制文件,创建.安装文件.在安装了它的组件之后,我们还会配置 redis ,就像配置操作系统参数一样,目标就 ...
- Linux Centos 系统上安装BT客户端 Transmission
Linux Centos 系统上安装BT客户端 Transmission Transmission是一种BitTorrent客户端,特点是一个跨平台的后端和其上的简洁的用户界面,以MIT许可证和G ...
- 在CentOS 7上安装phpMyAdmin
原文 在CentOS 7上安装phpMyAdmin phpMyAdmin是一款以PHP为基础,基于Web的MySQL/MariaDB数据库管理工具.虽然已经存在着一些诸如Adminer的轻量级数据库管 ...
- 在CentOS 6上安装Apache和PHP
本文演示如何在CentOS 6上安装Apache和PHP.CentOS 6自带的是Apache 2.2.3和PHP 5.1.6,您可以使用默认的CentOS包管理器进行安装yum.使用yum(而不是使 ...
- CentOS Linux上安装Oracle11g笔记
CentOS Linux上安装Oracle11g 到 otn.oracle.com 网站上下载 Linux版的oracle 11g 编辑 /etc/sysctl.conf : kernel.shmal ...
- 如何在CentOS 7上安装Munin
在CentOS 7上安装Munin 首先我们需要在我们的系统中添加EPEL仓库. yum install epel-release 步骤2.安装LAMP(Linux,Apache,MariaDB,PH ...
- centos 7 上安装 testlink 1.9.15/1.9.16/1.9.17/1.9.18 (mysql/php/httpd)
1.9.18 的System Requirements - server.注意,适用于 1.9.15 及以后. Server environment should consist of: web-se ...
- Jenkins安装 CentOS 7上安装Jenkins
CentOS 7上安装Jenkins Jenkins 安装 只安装不介绍 步骤1:更新CentOS 7 Linux系统管理员的最佳做法之一是使系统保持最新.安装最新的稳定包,然后重新启动. 1 2 ...
随机推荐
- mysql内容总体回顾
数据类型: 数值类型: 整形 浮点型 字符串: char(定长)\varchar(不定长) char(定长):插入数据或查询数据都快,因为char在磁盘上插入数据时的存储空间是固定的,简单粗暴,直接就 ...
- echarts水球
教程网址:https://echarts.baidu.com/blog/2017/02/21/echarts-liquidfill-chart-tutorial.html DEMO网址(引入js在di ...
- centos7 安装部署jenkins
一.简介 jenkins是一个Java开发的开源持续集成工具,广泛用于项目开发,具有自动化构建.测试和部署等功能,它的运行需要Java环境. 二.搭建环境准备:# cat /etc/redhat-re ...
- Java-Oracle数据库连接
Oracle数据库先创建一个表和添加一些数据,下面是连接数据库的具体实现.(导入jar包:ojdbc14.jar) import java.sql.Connection; import java.sq ...
- echarts 图表重新加载,原来的数据依然存在图表上
问题 在做一个全国地图上一些饼图,并且向省一级的地图钻取的时候,原来的饼图依然显示 原因 echars所有添加的图表都在一个series属性集合中,并且同一个echars对象默认是合并之前的数据的,所 ...
- 带缓冲I/O 和不带缓冲I/O的区别与联系
首先要明白不带缓冲的概念:所谓不带缓冲,并不是指内核不提供缓冲,而是只单纯的系统调用,不是函数库的调用.系统内核对磁盘的读写都会提供一个块缓冲(在有些地方也被称为内核高速缓存),当用write函数对其 ...
- golang项目:goa和micro
https://github.com/goadesign/goa http://www.cnblogs.com/zhangqingping/p/5531171.html https://github. ...
- Centos 安装 android sdk(转)
原文地址: https://blog.csdn.net/kai_1215/article/details/80731099 这个后面有个指令没有运行起来,我做了一些修改: 原文:sdkmanager ...
- pytest 一.安装和使用入门
pytest --fixtures Python版本: Python 2.7.3.4.3.5.3.6.Jython.PyPy-2.3 平台:Unix / Posix和windows PyPI包名称:p ...
- linux学习第十七天 (Linux就该这么学)
今天12月14日学习比较少点,等了一会,主要讲了squid代理,1,正向代理 2反向代理 正向代表分为:标准的正向代理,透明的正向代理 ,这个比较实用, 还讲了RHCE考试的中的内容 iscsi 是 ...