在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 ...
随机推荐
- jquery花式图片库——jqFancyTransitions
http://www.html580.com/3785 https://yq.aliyun.com/ziliao/4390 使用方法调用插件js文件: <script src="js/ ...
- linux学习笔记:关于环境变量
(摘自https://blog.csdn.net/llzk_/article/details/53813266之后整合) 1.linux系统的条件 Linux是一个多用户的操作系统,每个用户登录系统时 ...
- 自己测试项目中的log4j配置
日志生成的位置在项目名下 主要记录的是这样配置,日志的生成的地方 下边是配置文件的内容 log4j.rootLogger=WARN, stdout, file log4j.appender.stdou ...
- python3作业:模拟登录
__author__ = "bin007" customer = {}#存储用户信息#处理用户信息文件try: with open('login.txt','r',encoding ...
- python的re模块详解
一.正则表达式的特殊字符介绍 正则表达式 ^ 匹配行首 $ 匹配行尾 . 任意单个字符 [] 匹配包含在中括号中的任意字符 [^] 匹配包含在中括号中的字符之外的字符 [-] 匹配指定范围的任意单个字 ...
- Python基础-python流程控制之循环结构(五)
循环结构 循环结构可以减少源程序重复书写的代码量,用来描述重复执行某段算法的问题. Python中循环结构分为两类,分别是 while 和 for .. in. 一.while循环 格式1: whil ...
- Angular官方教程采坑
Angualar 7.0.1是现在的最新版本,教程总体来说还是不错的,但是我在跟着教程做英雄项目的时候出现了一个很明显的坑. 在教程的第6部分HTTP的内容中写到(见下图) 文档中特别注明了要使用0. ...
- pytest 一.安装和使用入门
pytest --fixtures Python版本: Python 2.7.3.4.3.5.3.6.Jython.PyPy-2.3 平台:Unix / Posix和windows PyPI包名称:p ...
- core里使用log4net
1. nuget 里安装 log4net 2. startup.cs里配置读取配置文件 public static ILoggerRepository repository { get; set; } ...
- AHK控制鼠标与键盘
F4::clicksleep 100MouseGetPos, xpos, ypos x:=xpos+30 click 1877,51sleep 100click 115,51sleep 100clic ...