han8809 发表于 2019-2-1 13:04:48

分布式文件系统glusterfs

  块存储:
  单机存储:硬盘+LVM
直连存储:磁盘阵列(主机插卡PCI-E用专业的线),数据库用得比较多。
存储区域网:SAN(FC-SAN)主机用HBA卡
  分布式文件系统:
安装glusterfs
两台虚拟机同时
rpm -ivf https://mirrors.aliyun.com/epel/epel-release-latest-6.noarch.rpm
yum install centos-release-gluster
yum install glusterfs-server
  一台信任另外一台
gluster peer probe 192.168.56.21
  查看信任
gluster peer status
  #######################################################
分布式卷
A创建目录
mkdir /data/exp1 -p
B创建目录
mkdir /data/exp2 -p
  A操作
创建分布式卷test-volume(测试加proce因为只有一个磁盘,正常会新建磁盘)
gluster volume create test-volume 192.168.56.20://data/exp1 192.168.56.21://data/exp2 force
  查看卷信息
gluster volume info
  Volume Name: test-volume
Type: Distribute
Volume ID: 5330993e-7ef2-47a2-8a1c-b44bc5601fb2
Status: Created
Snapshot Count: 0
Number of Bricks: 2
Transport-type: tcp
Bricks:
Brick1: 192.168.56.20:/data/exp1
Brick2: 192.168.56.21:/data/exp2
Options Reconfigured:
transport.address-family: inet
performance.readdir-ahead: on
nfs.disable: on
  #######################################################
创建复制卷(raid1)
A创建目录
mkdir /data/exp3 -p
B创建目录
mkdir /data/exp4 -p
gluster volume create repl-volume replica 2 transport tcp 192.168.56.20://data/exp3 192.168.56.21://data/exp4 force
  #######################################################
创建调带卷(raid0)
  A创建目录
mkdir /data/exp5 -p
B创建目录
mkdir /data/exp6 -p
gluster volume create raid0-volume stripe 2 transport tcp 192.168.56.20://data/exp5 192.168.56.21://data/exp6 force
  #######################################################
查看卷的状态
gluster volume status
  启动卷
# gluster volume start raid0-volume
volume start: raid0-volume: success
# gluster volume start repl-volume
volume start: repl-volume: success
# gluster volume start test-volume
volume start: test-volume: success
  #######################################################
挂载卷
创建挂载点
mkdir /mnt/g1 /mnt/g2 /mnt/g3
mount.glusterfs 192.168.56.20:/test-volume /mnt/g1
mount.glusterfs 192.168.56.20:/repl-volume /mnt/g2
mount.glusterfs 192.168.56.20:/raid0-volume /mnt/g3
  #######################################################
测试分布式卷,会写在其中一个
echo 1 > /mnt/g1/test1.txt
  测试复制卷,两个都会写
echo 1 > /mnt/g2/test1.txt
  测试调带卷,每个都写一部分
man tcp > /mnt/g3/tcp.man
  #######################################################
生产创建分布式复制卷(两台都有数据,在不同的文件夹中)
  A创建目录
mkdir /exp3
mkdir /exp4
B创建目录
mkdir /exp3
mkdir /exp4
  gluster volume create hehe1-volume replica 2 transport tcp 192.168.56.20:/exp3 192.168.56.21:/exp3 192.168.56.20:/exp4 192.168.56.21:/exp4 force
  gluster volume start hehe1-volume
  mkdir /mnt/g7
mount.glusterfs 192.168.56.20:/hehe1-volume /mnt/g7
  man tcp > /mnt/g7/tcp1.txt



页: [1]
查看完整版本: 分布式文件系统glusterfs