吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 1810|回复: 0
收起左侧

[其他转载] GlusterFS安装

  [复制链接]
mengjincn 发表于 2019-2-18 12:23

环境

CentOS 7.5

Using Storage SIG Yum Repos

yum install centos-release-gluster -y

Have at least two nodes

以下IP和hostname根据实际情况设置

# 修改hostname
hostnamectl set-hostname server1
# 修改hosts文件
tee /etc/hosts <<-'EOF'
192.168.161.131 server2
192.168.161.129 server1
EOF

添加硬盘

首先向Gluster节点上添加硬盘,使用fdisk -l命令查看,可以看到多出来的/dev/sdb

Format and mount the bricks

mkfs.xfs -i size=512 /dev/sdb
mkdir -p /bricks/brick1
vi /etc/fstab

添加如下内容:

/dev/sdb /bricks/brick1 xfs defaults 1 2

保存然后退出

mount -a && mount

Installing GlusterFS

yum install glusterfs-server -y
systemctl enable glusterd
systemctl start glusterd
firewall-cmd --zone=public --add-service=nfs --add-service=glusterfs --add-service=samba --add-service=samba-client --permanent
firewall-cmd --zone=public --add-port=111/tcp --add-port=139/tcp --add-port=445/tcp --add-port=965/tcp --add-port=2049/tcp --add-port=38465-38469/tcp --add-port=631/tcp --add-port=111/udp --add-port=963/udp --add-port=49152-49251/tcp  --permanent
firewall-cmd --zone=public --add-port=24010/tcp --permanent
firewall-cmd --reload
firewall-cmd --zone=public --list-all

Configure the trusted pool

From "server1"

gluster peer probe server2

Note: When using hostnames, the first server needs to be probed from one other server to set it's hostname.

From "server2"

gluster peer probe server1

Note: Once this pool has been established, only trusted members may probe new servers into the pool. A new server cannot probe the pool, it must be probed from the pool.

Set up a GlusterFS volume

On both server1 and server2:

mkdir /bricks/brick1/gv0

From any single server:

gluster volume create gv0 replica 2 server1:/bricks/brick1/gv0 server2:/bricks/brick1/gv0
gluster volume start gv0

Confirm that the volume shows "Started":

gluster volume info

Testing the GlusterFS volume

For this step, we will use one of the servers to mount the volume. Typically, you would do this from an external machine, known as a "client". Since using the method here would require additional packages to be installed on the client machine, we will use the servers as a simple place to test first.

mount -t glusterfs server1:/gv0 /mnt
for i in `seq -w 1 100`; do cp -rp /var/log/messages /mnt/copy-test-$i; done

First, check the mount point:

ls -lA /mnt | wc -l

You should see 100 files returned. Next, check the GlusterFS mount points on each server:

ls -lA /bricks/brick1/gv0

You should see 100 per server using the method we listed here. Without replication, in a distribute only volume (not detailed here), you should see about 50 each.

Using GlusterFS Client

On Ubuntu

Install glusterfs-client

sudo apt install -y glusterfs-client
# 修改hosts文件
tee /etc/hosts <<-'EOF'
192.168.161.131 server2
192.168.161.129 server1
EOF
sudo mkdir -p /mnt/glusterfs
sudo mount -t glusterfs server1:/gv0 /mnt/glusterfs

自动挂载

To mount a volume, edit the /etc/fstab file and add the following line:

server1:/gv0 /mnt/glusterfs glusterfs defaults,_netdev 0 0

https://wiki.centos.org/SpecialInterestGroup/Storage/gluster-Quickstart

GlusterFS Documents

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则 警告:本版块禁止灌水或回复与主题无关内容,违者重罚!

快速回复 收藏帖子 返回列表 搜索

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-5-14 04:34

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表