Glusterfscentos7安装

centos7安装glusterfs


1.磁盘设置

[root@node1 ~]#fdisk /dev/sdb#格式化磁盘

2.设置磁盘格式挂载硬盘

(on

both nodes):Note: These examples are going to

assume the brick is going to reside on /dev/sdb1.(两节点都需要做)

[root@node1 ~]#mkfs.xfs -i size=512/dev/sdb1

[root@node1 ~]#mkdir -p /export/sdb1&& mount /dev/sdb1 /export/sdb1

[root@node1 ~]#echo"/dev/sdb1 /export/sdb1 xfs defaults 0 0">> /etc/fstab

[root@node1

~]#mount -a && mount

3..安装glusterfs

[root@node1 ~]#yuminstall centos-release-gluster#安装源

[root@node1 ~]#yuminstall glusterfs-server#安装glusterfs

4.启动glusterfs

[root@node1 ~]#systemctl start glusterd#后续加入开机启动

5.组建集群

Replace nodename with hostname of theother server in the cluster, or IP address if you don’t have DNS or /etc/hostsentries

注意关掉防火墙

[root@node1 ~]#systemctlstop firewalld

# Run thegluster peer probe command

[root@node1 ~]#glusterpeer probe node2

查看刚刚加入的节点

[root@node1 ~]#glusterpeer status

[root@node1 ~]#gluster peer probe node2

peer probe: success.

[root@node1 ~]#gluster peer status

Number of Peers: 1

Configure your Gluster volume

在俩个主机执行

[root@node1 ~]#mkdir -p/export/sdb1/brick

[root@node1~]#gluster volume create testvol replica 2 transport tcpnode1:/export/sdb1/brick node2:/export/sdb1/brick

volume create: testvol: success: please start the volume to accessdata

[root@node1 log]#gluster peer status

Number of Peers: 1

Hostname: node2

Uuid: 61fe987a-99ff-419d-8018-90603ea16fe7

State: Peer in Cluster (Connected)

[root@node1 log]#glustervolume info

Volume Name: testvol

Type: Replicate

Volume ID: bc637d83-0273-4373-9d00-d794a3a3d2e7

Status: Started

Snapshot Count: 0

Number of Bricks: 1 x 2 = 2

Transport-type: tcp

Bricks:

Brick1: node1:/export/sdb1/brick

Brick2: node2:/export/sdb1/brick

Options Reconfigured:

transport.address-family: inet

nfs.disable: on

[root@node1 ~]#gluster volume start testvol

volume start: testvol: success

[root@node1 gluster]#gluster volume info

Volume Name: testvol

Type: Replicate

Volume ID: bc637d83-0273-4373-9d00-d794a3a3d2e7

Status: Started

Snapshot Count: 0

Number of Bricks: 1 x 2 = 2

Transport-type: tcp

Bricks:

Brick1: node1:/export/sdb1/brick

Brick2: node2:/export/sdb1/brick

Options Reconfigured:

transport.address-family: inet

nfs.disable: on



挂载测试

[root@node1 ~]# mkdir/mnt/gluster/

[root@node1 ~]#mount -tglusterfs node1:/testvol /mnt/gluster/

你可能感兴趣的:(Glusterfscentos7安装)