Enable Fuse:
modprobe fuse
vzctl set CID --devices c:10:229:rw --save
vzctl exec CID mknod /dev/fuse c 10 229
vzctl set CID --capability sys_admin:on --save
Server 1:
yum update
yum install epel-release
yum install centos-release-gluster41
yum -y install glusterfs-server
systemctl enable glusterd.service
systemctl start glusterd.service
systemctl status glusterd.service
* glusterd.service - GlusterFS, a clustered file-system server
Loaded: loaded (/usr/lib/systemd/system/glusterd.service; enabled; vendor preset: disabled)
Active: active (running) since Sat 2018-09-01 20:15:28 UTC; 9h ago
Main PID: 1854 (glusterd)
CGroup: /system.slice/glusterd.service
|-1854 /usr/sbin/glusterd -p /var/run/glusterd.pid --log-level INFO
|-1986 /usr/sbin/glusterfsd -s data1 --volfile-id datavol.data1.data -p /var/run/gluster/vols/datavol/data1-data.pid -S /var/run/gluster/52b652b9976d3fea.soc...
|-2008 /usr/sbin/glusterfsd -s data2 --volfile-id datavol.vit2.data -p /var/run/gluster/vols/datavol/data2-data.pid -S /var/run/gluster/8d0878ede60c3f54.soc...
`-2031 /usr/sbin/glusterfs -s localhost --volfile-id gluster/glustershd -p /var/run/gluster/glustershd/glustershd.pid -l /var/log/glusterfs/glustershd.log..
glusterfsd -V
glusterfs 4.1.3
Server 1:
gluster peer probe data2
Server 2:
gluster peer probe data1
gluster peer status
Number of Peers: 1
Hostname: xx.xx.xx.xx
Uuid: xxxxxxx-xxxx-xxxx-xxxxx-xxxxxxxxxx
State: Peer in Cluster (Connected)
gluster volume create datavol replica 2 transport tcp data1:/data data2:/data force
volume create: datavol: success: please start the volume to access data
gluster volume start datavol
Because its TCP replica, you can check:
netstat -tap | grep glusterfsd
tcp 0 0 0.0.0.0:49152 0.0.0.0:* LISTEN 1986/glusterfsd
tcp 0 0 0.0.0.0:49153 0.0.0.0:* LISTEN 2008/glusterfsd
or
Some protection:
gluster volume set datavol auth.allow xx.xx.xx.* # 192.168.100.*
gluster volume info
Volume Name: testvol
Type: Replicate
Volume ID: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx
Status: Started
Snapshot Count: 0
Number of Bricks: 1 x 2 = 2
Transport-type: tcp
Bricks:
Brick1: data1:/data
Brick2: data2:/data
Options Reconfigured:
auth.allow: xx.xx.xx.*
transport.address-family: inet
nfs.disable: on
performance.client-io-threads: off
Mount data on server or client:
yum -y install glusterfs-client
mkdir /var/data
mount.glusterfs data1:/datavol /var/data
Save on boot:
vi /etc/rc.local
mount.glusterfs data1:/datavol /var/data