GFS基本構成インストール
基本概念
GFSスケーラブルな分散ファイルシステム、大規模なため、データアプリケーションへのアクセスの分散、大量。これは、安価なコモディティ・ハードウェア上で実行され、フォールトトレランスを提供します。これは、多数のユーザーにサービスの高い総合的な性能を提供することができます。
基本的な展開手順
まず、実験の準備
名前 | 役割 | IPアドレス |
---|---|---|
centos7-1 | ノード1 | 192.168.142.66 |
centos7-2 | ノード2 | 192.168.142.77 |
centos7-3 | ノード3 | 192.168.142.132 |
centos7-4 | ノード4 | 192.168.142.136 |
centos7分 | クライアント | 192.168.142.172 |
第二には、インストールを開始します
(1)実験の目的を満たすためにハードドライブを追加します
centos7-1
/dev/sdb1 20G 33M 20G 1% /mnt/sdb1
/dev/sdc1 20G 33M 20G 1% /mnt/sdc1
/dev/sdd1 20G 33M 20G 1% /mnt/sdd1
/dev/sde1 20G 33M 20G 1% /mnt/sde1
centos7-2
/dev/sdb1 20G 33M 20G 1% /mnt/sdb1
/dev/sdc1 20G 33M 20G 1% /mnt/sdc1
/dev/sdd1 20G 33M 20G 1% /mnt/sdd1
/dev/sde1 20G 33M 20G 1% /mnt/sde1
centos7-3
/dev/sdb1 20G 33M 20G 1% /mnt/sdb1
/dev/sdc1 20G 33M 20G 1% /mnt/sdc1
/dev/sdd1 20G 33M 20G 1% /mnt/sdd1
/dev/sde1 20G 33M 20G 1% /mnt/sde1
centos7-4
/dev/sdb1 20G 33M 20G 1% /mnt/sdb1
/dev/sdc1 20G 33M 20G 1% /mnt/sdc1
/dev/sdd1 20G 33M 20G 1% /mnt/sdd1
/dev/sde1 20G 33M 20G 1% /mnt/sde1
(2)設置GFS(すべてのストレージノードのインストールが必要)
簡単に識別のためのローカルhostsファイルを変更します
[root@node1 yum.repos.d]# vim /etc/hosts
192.168.142.66 node1
192.168.142.77 node2
192.168.142.132 node3
192.168.142.136 node4
ローカルYUMソースを設定
(YUM需要満たすことができないオリジナルの倉庫が付属しています)
[root@node1 mnt]# cd /etc/yum.repos.d/
[root@node1 yum.repos.d]# mkdir bak
[root@node1 yum.repos.d]# mv CentOS-* bak/
[root@node3 zhy]# cp -r gfsrepo/ /mnt/
[root@node3 yum.repos.d]# vim GFSrep.repo
//手动添加
[GFSrep]
name=GFS
baseurl=file:///mnt/gfsrepo
gpgcheck=0
enabled=1
組み立てとインストールがオープンGFS
[root@node1 yum.repos.d]# yum -y install glusterfs glusterfs-server glusterfs-fuse glusterfs-rdma
//开启服务
[root@node1 yum.repos.d]# systemctl start glusterd
[root@node1 yum.repos.d]# systemctl enable glusterd
[root@node1 yum.repos.d]# systemctl stop firewalld.service
[root@node1 yum.repos.d]# setenforce 0
アリは、タイムサーバーと同期
[root@node1 yum.repos.d]# ntpdate ntp1.aliyun.com
18 Dec 19:55:56 ntpdate[2843]: adjust time server 120.25.115.20 offset 0.010820 sec
信頼されたストレージプール(ストレージノードを追加するのいずれかにのみ必要)を追加します
[root@node1 yum.repos.d]# gluster peer probe node2
peer probe: success.
[root@node1 yum.repos.d]# gluster peer probe node3
peer probe: success.
[root@node1 yum.repos.d]# gluster peer probe node4
peer probe: success.
[root@node1 yum.repos.d]# gluster peer status //查看各节点状态
第二に、分散ボリューム
特徴:(ハッシュアルゴリズムによって分散)
冗長性なしありません
単一障害点は、データが失われます
[root@node1 yum.repos.d]# gluster volume create fenbu node1:/mnt/sdb1 node2:/mnt/sdb1 force
//使用node1的sdb1和node2的sdb1作为节点,部署分布式卷,“force”强制执行
volume create: fenbu: success: please start the volume to access data
//查看分布式卷信息
[root@node1 yum.repos.d]# gluster volume info fenbu
Volume Name: fenbu
Type: Distribute
Volume ID: e7833052-a4c7-4c9f-9660-dc60db737543
。。。。。。
Bricks:
Brick1: node1:/mnt/sdb1
Brick2: node2:/mnt/sdb1
//查看卷组列表
[root@node1 yum.repos.d]# gluster volume list
//开启分布式卷
[root@node1 yum.repos.d]# gluster volume start fenbu
volume start: fenbu: success
第三に、ストライピングボリュームの確立
特長:
ファイルオフセットは、N個のブロック(ノードのN-2)に格納された各ポーリングブリックサーバ・ノードに分割されています
大きなファイルを格納し、特にパフォーマンス
冗長性、RAID0のを持っていません
[root@node1 mnt]# gluster volume create tiaodai stripe 2 node1:/mnt/sdc1 node2:/mnt/sdc1 force
//“stripe” 分为两个区
//开启条带卷
[root@node1 mnt]# gluster volume start tiaodai
volume start: tiaodai: success
//查看条带卷信息
[root@node1 yum.repos.d]# gluster volume info fenbu
Volume Name: tiaodai
。。。。。。
Status: Started
。。。。。。
Bricks:
Brick1: node1:/mnt/sdc1
Brick2: node2:/mnt/sdc1
Options Reconfigured:
第四に、複製されたボリュームの確立
特長:
支払うことになるのと同じ文書やコピーのコピーの保存
読み取りと書き込み速度が遅いです
冗長性
これは、2つの以上のデータベースで構成されなければなりません
[root@node1 mnt]# gluster volume create fuzhi replica 2 node3:/mnt/sdb1 node4:/mnt/sdb1 force
//“replica” 建立副本数
[root@node1 mnt]# gluster volume start fuzhi
volume start: fuzhi: success
[root@node1 mnt]# gluster volume info fuzhi
Volume Name: fuzhi
。。。。。。
Status: Started
。。。。。。
Bricks:
Brick1: node3:/mnt/sdb1
Brick2: node4:/mnt/sdb1
第五は、分散してストライプボリュームを構築します
特長:
アカウントに配布され、ストライプボリュームの機能を取ります
サイズの大きいファイルの処理のための
それは、少なくとも4台のサーバが必要です
[root@node1 mnt]# gluster volume create fenbu-tiao stripe 2 node1:/mnt/sdd1 node2:/mnt/sdd1 node3:/mnt/sdd1 node4:/mnt/sdd1 force
//“stripe” 具备条带卷功能,因此需要分片
[root@node1 mnt]# gluster volume start fenbu-tiao
volume start: fenbu-tiao: success
[root@node1 mnt]# gluster volume info fenbu-tiao
Volume Name: fenbu-tiao
。。。。。。
Status: Started
。。。。。。
Bricks:
Brick1: node1:/mnt/sdd1
Brick2: node2:/mnt/sdd1
Brick3: node3:/mnt/sdd1
Brick4: node4:/mnt/sdd1
第六に、分散複製ボリュームの確立
特長:
アカウントに配布され、複製されたボリュームの機能を取ります
冗長性
[root@node1 mnt]# gluster volume create fenbu-copy replica 2 node1:/mnt/sde1 node2:/mnt/sde1 node3:/mnt/sde1 node4:/mnt/sde1 force
[root@node1 mnt]# gluster volume start fenbu-copy
volume start: fenbu-copy: success
[root@node1 mnt]# gluster volume info fenbu-copy
Volume Name: fenbu-copy
。。。。。。
Status: Started
。。。。。。
Bricks:
Brick1: node1:/mnt/sde1
Brick2: node2:/mnt/sde1
Brick3: node3:/mnt/sde1
Brick4: node4:/mnt/sde1
七、クライアントの構成
ローカルHostsファイルを変更します
[root@node1 yum.repos.d]# vim /etc/hosts
192.168.142.66 node1
192.168.142.77 node2
192.168.142.132 node3
192.168.142.136 node4
ローカルYUMソースを設定
[root@node1 mnt]# cd /etc/yum.repos.d/
[root@node1 yum.repos.d]# mkdir bak
[root@node1 yum.repos.d]# mv CentOS-* bak/
[root@node3 zhy]# cp -r gfsrepo/ /mnt/
[root@node3 yum.repos.d]# vim GFSrep.repo
//手动添加
[GFSrep]
name=GFS
baseurl=file:///mnt/gfsrepo
gpgcheck=0
enabled=1
インストールするコンポーネントGFS
[root@node1 yum.repos.d]# yum -y install glusterfs glusterfs-fuse
GFSは、新しいボリュームをマウント
[root@client yum.repos.d]# mkdir -p /data/fenbu //新建分布式卷挂载点
[root@client yum.repos.d]# mkdir -p /data/tiaodai //新建条带卷挂载点
[root@client yum.repos.d]# mkdir -p /data/fuzhi //新建复制卷挂载点
[root@client yum.repos.d]# mkdir -p /data/fenbu-tiao //新建分布式条带卷挂载点
[root@client yum.repos.d]# mkdir -p /data/fenbu-copy //新建分布式复制卷
[root@client yum.repos.d]# mount.glusterfs node1:fenbu /data/fenbu/ //将分布卷进行挂载
[root@client yum.repos.d]# df -hT
文件系统 类型 容量 已用 可用 已用% 挂载点
node1:fenbu fuse.glusterfs 40G 65M 40G 1% /data/fenbu
[root@client yum.repos.d]# mount.glusterfs node1:tiaodai /data/tiaodai/ //挂载条带卷
[root@client yum.repos.d]# df -hT
文件系统 类型 容量 已用 可用 已用% 挂载点
node1:tiaodai fuse.glusterfs 40G 65M 40G 1% /data/tiaodai
[root@client yum.repos.d]# mount.glusterfs node3:fuzhi /data/fuzhi //挂载复制卷
[root@client yum.repos.d]# df -hT
文件系统 类型 容量 已用 可用 已用% 挂载点
node3:fuzhi fuse.glusterfs 20G 33M 20G 1% /data/fuzhi
[root@client yum.repos.d]# mount.glusterfs node1:fenbu-tiao /data/fenbu-tiao/ //挂载分布式条带卷
[root@client yum.repos.d]# df -hT
文件系统 类型 容量 已用 可用 已用% 挂载点
node1:fenbu-tiao fuse.glusterfs 80G 130M 80G 1% /data/fenbu-tiao
[root@client yum.repos.d]# mount.glusterfs node4:fenbu-copy /data/fenbu-copy/ //挂载分布式复制卷
[root@client yum.repos.d]# df -hT
文件系统 类型 容量 已用 可用 已用% 挂载点
node4:fenbu-copy fuse.glusterfs 40G 65M 40G 1% /data/fenbu-copy
テストの様々なタイプの8巻
6つのテストファイルの確立
[root@client data]# dd if=/dev/zero of=test1.log bs=10M count=10
[root@client data]# dd if=/dev/zero of=test2.log bs=10M count=10
[root@client data]# dd if=/dev/zero of=test3.log bs=10M count=10
[root@client data]# dd if=/dev/zero of=test4.log bs=10M count=10
[root@client data]# dd if=/dev/zero of=test5.log bs=10M count=10
[root@client data]# dd if=/dev/zero of=test6.log bs=10M count=10
さまざまなボリュームにファイルをコピーします。
[root@client data]# cp test* fenbu
[root@client data]# cp test* fenbu-copy/
[root@client data]# cp test* fenbu-tiao/
[root@client data]# cp test* fuzhi/
[root@client data]# cp test* tiaodai/
分散ボリュームをチェックします(ノード1:SDB1、ノード2:sdb1など)
//node1
[root@node1 mnt]# ll -h sdb1/
总用量 400M
-rw-r--r--. 2 root root 100M 12月 18 23:55 test1.log
-rw-r--r--. 2 root root 100M 12月 18 23:56 test2.log
-rw-r--r--. 2 root root 100M 12月 18 23:56 test4.log
-rw-r--r--. 2 root root 100M 12月 18 23:56 test6.log
//node2
[root@node2 mnt]# ll -h sdb1/
总用量 200M
-rw-r--r--. 2 root root 100M 12月 18 23:56 test3.log
-rw-r--r--. 2 root root 100M 12月 18 23:56 test5.log
ストライプボリュームを見る(ノード1:SDC1、ノード2:SDC1)
//将每个数据都分成两块存储(分成几份由建立时的stripe决定)
//node1
[root@node1 mnt]# ll -h sdc1/
总用量 300M
-rw-r--r--. 2 root root 50M 12月 18 23:57 test1.log
-rw-r--r--. 2 root root 50M 12月 18 23:57 test2.log
-rw-r--r--. 2 root root 50M 12月 18 23:57 test3.log
-rw-r--r--. 2 root root 50M 12月 18 23:57 test4.log
-rw-r--r--. 2 root root 50M 12月 18 23:57 test5.log
-rw-r--r--. 2 root root 50M 12月 18 23:57 test6.log
//node2
[root@node2 mnt]# ll -h sdc1/
总用量 300M
-rw-r--r--. 2 root root 50M 12月 18 23:57 test1.log
-rw-r--r--. 2 root root 50M 12月 18 23:57 test2.log
-rw-r--r--. 2 root root 50M 12月 18 23:57 test3.log
-rw-r--r--. 2 root root 50M 12月 18 23:57 test4.log
-rw-r--r--. 2 root root 50M 12月 18 23:57 test5.log
-rw-r--r--. 2 root root 50M 12月 18 23:57 test6.log
(:SDB1、ノード4:SDB1ノード3)閲覧ボリュームを複製し
//所有数据均复制一份存储
//node3
[root@node3 mnt]# ll -h sdb1/
总用量 600M
-rw-r--r--. 2 root root 100M 12月 18 23:57 test1.log
-rw-r--r--. 2 root root 100M 12月 18 23:57 test2.log
-rw-r--r--. 2 root root 100M 12月 18 23:57 test3.log
-rw-r--r--. 2 root root 100M 12月 18 23:57 test4.log
-rw-r--r--. 2 root root 100M 12月 18 23:57 test5.log
-rw-r--r--. 2 root root 100M 12月 18 23:57 test6.log
//node4
[root@node4 mnt]# ll -h sdb1/
总用量 600M
-rw-r--r--. 2 root root 100M 12月 18 23:57 test1.log
-rw-r--r--. 2 root root 100M 12月 18 23:57 test2.log
-rw-r--r--. 2 root root 100M 12月 18 23:57 test3.log
-rw-r--r--. 2 root root 100M 12月 18 23:57 test4.log
-rw-r--r--. 2 root root 100M 12月 18 23:57 test5.log
-rw-r--r--. 2 root root 100M 12月 18 23:57 test6.log
分散ストライプボリュームをチェックします(ノード1:SDD1、ノード2:SDD1、ノード3:SDD1、ノード4:SDD1)
//node1 & node2
[root@node1 mnt]# ll -h sdd1/
总用量 200M
-rw-r--r--. 2 root root 50M 12月 18 23:57 test1.log
-rw-r--r--. 2 root root 50M 12月 18 23:57 test2.log
-rw-r--r--. 2 root root 50M 12月 18 23:57 test4.log
-rw-r--r--. 2 root root 50M 12月 18 23:57 test6.log
[root@node2 mnt]# ll -h sdd1/
总用量 200M
-rw-r--r--. 2 root root 50M 12月 18 23:57 test1.log
-rw-r--r--. 2 root root 50M 12月 18 23:57 test2.log
-rw-r--r--. 2 root root 50M 12月 18 23:57 test4.log
-rw-r--r--. 2 root root 50M 12月 18 23:57 test6.log
//node3 & node4
[root@node3 mnt]# ll -h sdd1/
总用量 100M
-rw-r--r--. 2 root root 50M 12月 18 23:57 test3.log
-rw-r--r--. 2 root root 50M 12月 18 23:57 test5.log
[root@node4 mnt]# ll -h sdd1/
总用量 100M
-rw-r--r--. 2 root root 50M 12月 18 23:57 test3.log
-rw-r--r--. 2 root root 50M 12月 18 23:57 test5.log
分散複製されたボリュームをチェックします(ノード1〜4:SDE1)
//node1 & node2
[root@node1 mnt]# ll -h sde1/
总用量 400M
-rw-r--r--. 2 root root 100M 12月 18 23:56 test1.log
-rw-r--r--. 2 root root 100M 12月 18 23:56 test2.log
-rw-r--r--. 2 root root 100M 12月 18 23:56 test4.log
-rw-r--r--. 2 root root 100M 12月 18 23:56 test6.log
[root@node2 mnt]# ll -h sde1/
总用量 400M
-rw-r--r--. 2 root root 100M 12月 18 23:56 test1.log
-rw-r--r--. 2 root root 100M 12月 18 23:56 test2.log
-rw-r--r--. 2 root root 100M 12月 18 23:56 test4.log
-rw-r--r--. 2 root root 100M 12月 18 23:56 test6.log
//node3 & node4
[root@node3 mnt]# ll -h sde1/
总用量 200M
-rw-r--r--. 2 root root 100M 12月 18 23:56 test3.log
-rw-r--r--. 2 root root 100M 12月 18 23:56 test5.log
[root@node4 mnt]# ll -h sde1/
总用量 200M
-rw-r--r--. 2 root root 100M 12月 18 23:56 test3.log
-rw-r--r--. 2 root root 100M 12月 18 23:56 test5.log