给jumpserver双机配置glusterfs共享复制卷

为什么要使用glusterfs呢。

本身Haproxy+Keepalived对jumpserver进行了负载均衡和反向代理。但是真实的视频只会存储在一个节点上

否则播放视频的时候会出现找不到的情况

为了保证视频在2个节点上。不想再挂载nfs了。觉得glusterfs更合适

这里主要给挂载到视频目录上的

 

操作如下

yum install centos-release-gluster -y
yum install glusterfs-server -y

mkdir /data/gluster-data/rep/jump -p

systemctl start glusterd 
systemctl enable glusterd


gluster peer probe 10.0.2.55
gluster peer status
gluster volume create jump-volume replica 2 10.0.2.54:/data/gluster-data/rep/jump  10.0.2.55:/data/gluster-data/rep/jump force
gluster volume info
gluster volume start jump-volume


vim /etc/fstab
10.0.2.54:/jump-volume /video glusterfs defaults,_netdev 0 0
10.0.2.55:/jump-volume /video glusterfs defaults,_netdev 0 0

  

迁移后把文件权限设置644

(py3) [root@dawn-jump-1 /opt/jumpserver/data/media/replay]# ll
总用量 28
drwxr-xr-x 2 root root 4096 8月  12 23:17 2018-08-12
drwxr-xr-x 2 root root 4096 8月  13 16:49 2018-08-13
drwxr-xr-x 2 root root 4096 8月  14 17:16 2018-08-14
drwxr-xr-x 2 root root 4096 8月  15 15:56 2018-08-15
drwxr-xr-x 2 root root 4096 8月  16 17:03 2018-08-16
drwxr-xr-x 2 root root 4096 8月  17 19:52 2018-08-17
drwxr-xr-x 2 root root 4096 8月  19 18:27 2018-08-19
(py3) [root@dawn-jump-1 /opt/jumpserver/data/media/replay]# cd 2018-08-17/
(py3) [root@dawn-jump-1 /opt/jumpserver/data/media/replay/2018-08-17]# ll
总用量 95099
-rw-r--r-- 1 root root  1208992 8月  17 11:24 03adc337-0840-4b69-acc2-2a00cc66aa3f.replay.gz
-rw------- 1 root root  4162894 8月  17 17:39 03dd2648-d1ec-4484-aa9e-0516ae870720.replay.gz
-rw------- 1 root root 11938786 8月  17 09:37 17efae07-9681-45c4-8271-3a70547f94fd.replay.gz
-rw-r--r-- 1 root root   187058 8月  17 11:23 3873c5b7-ea34-442f-8ec3-53d8bf27622b.replay.gz
-rw-r--r-- 1 root root   285319 8月  17 09:23 4db46ec9-cc07-4ef8-9ea1-309ac04a0866.replay.gz
-rw-r--r-- 1 root root   666722 8月  17 08:47 5b15dd27-9286-438f-b4e7-ffe8b3610801.replay.gz
-rw------- 1 root root  4549332 8月  17 09:41 8f4b2590-341a-42bf-9963-3dcb6b8649fe.replay.gz
-rw-r--r-- 1 root root   823811 8月  17 11:21 9172db71-eb2f-4c4c-8131-7898ceff0346.replay.gz
-rw-r--r-- 1 root root   706552 8月  17 19:52 bdaf13ed-4400-4478-bfb3-04de826f8104.replay.gz
-rw------- 1 root root 39215246 8月  17 09:28 bdbb5125-3e9d-41aa-a80c-f99398c95076.replay.gz
-rw-r--r-- 1 root root    24019 8月  17 09:25 e3831e1d-c7ad-407a-944c-0663c176af69.replay.gz
-rw------- 1 root root  2955637 8月  17 09:20 e66c0dad-b6af-446e-bc67-f22e01d4d563.replay.gz
-rw------- 1 root root 29759310 8月  17 08:47 ed987d48-5fbb-40c7-b1ab-73a1f6444684.replay.gz
-rw-r--r-- 1 root root   893498 8月  17 13:54 f0c4bbf1-3555-4e09-abd2-c7aa0b6135ae.replay.gz
(py3) [root@dawn-jump-1 /opt/jumpserver/data/media/replay/2018-08-17]# cd ..
(py3) [root@dawn-jump-1 /opt/jumpserver/data/media/replay]# cd ..
(py3) [root@dawn-jump-1 /opt/jumpserver/data/media]# ll
总用量 4
drwxr-xr-x 9 root root 4096 8月  19 18:27 replay
(py3) [root@dawn-jump-1 /opt/jumpserver/data/media]# cd replay/
(py3) [root@dawn-jump-1 /opt/jumpserver/data/media/replay]# ll
总用量 28
drwxr-xr-x 2 root root 4096 8月  12 23:17 2018-08-12
drwxr-xr-x 2 root root 4096 8月  13 16:49 2018-08-13
drwxr-xr-x 2 root root 4096 8月  14 17:16 2018-08-14
drwxr-xr-x 2 root root 4096 8月  15 15:56 2018-08-15
drwxr-xr-x 2 root root 4096 8月  16 17:03 2018-08-16
drwxr-xr-x 2 root root 4096 8月  17 19:52 2018-08-17
drwxr-xr-x 2 root root 4096 8月  19 18:27 2018-08-19
(py3) [root@dawn-jump-1 /opt/jumpserver/data/media/replay]# ll
总用量 28
drwxr-xr-x 2 root root 4096 8月  12 23:17 2018-08-12
drwxr-xr-x 2 root root 4096 8月  13 16:49 2018-08-13
drwxr-xr-x 2 root root 4096 8月  14 17:16 2018-08-14
drwxr-xr-x 2 root root 4096 8月  15 15:56 2018-08-15
drwxr-xr-x 2 root root 4096 8月  16 17:03 2018-08-16
drwxr-xr-x 2 root root 4096 8月  17 19:52 2018-08-17
drwxr-xr-x 2 root root 4096 8月  19 18:27 2018-08-19
(py3) [root@dawn-jump-1 /opt/jumpserver/data/media/replay]# find . -type f -exec chmod 644 {} \;
(py3) [root@dawn-jump-1 /opt/jumpserver/data/media/replay]# ll
总用量 28
drwxr-xr-x 2 root root 4096 8月  12 23:17 2018-08-12
drwxr-xr-x 2 root root 4096 8月  13 16:49 2018-08-13
drwxr-xr-x 2 root root 4096 8月  14 17:16 2018-08-14
drwxr-xr-x 2 root root 4096 8月  15 15:56 2018-08-15
drwxr-xr-x 2 root root 4096 8月  16 17:03 2018-08-16
drwxr-xr-x 2 root root 4096 8月  17 19:52 2018-08-17
drwxr-xr-x 2 root root 4096 8月  19 18:27 2018-08-19
(py3) [root@dawn-jump-1 /opt/jumpserver/data/media/replay]# cd 2018-08-17/
(py3) [root@dawn-jump-1 /opt/jumpserver/data/media/replay/2018-08-17]# ll
总用量 95099
-rw-r--r-- 1 root root  1208992 8月  17 11:24 03adc337-0840-4b69-acc2-2a00cc66aa3f.replay.gz
-rw-r--r-- 1 root root  4162894 8月  17 17:39 03dd2648-d1ec-4484-aa9e-0516ae870720.replay.gz
-rw-r--r-- 1 root root 11938786 8月  17 09:37 17efae07-9681-45c4-8271-3a70547f94fd.replay.gz
-rw-r--r-- 1 root root   187058 8月  17 11:23 3873c5b7-ea34-442f-8ec3-53d8bf27622b.replay.gz
-rw-r--r-- 1 root root   285319 8月  17 09:23 4db46ec9-cc07-4ef8-9ea1-309ac04a0866.replay.gz
-rw-r--r-- 1 root root   666722 8月  17 08:47 5b15dd27-9286-438f-b4e7-ffe8b3610801.replay.gz
-rw-r--r-- 1 root root  4549332 8月  17 09:41 8f4b2590-341a-42bf-9963-3dcb6b8649fe.replay.gz
-rw-r--r-- 1 root root   823811 8月  17 11:21 9172db71-eb2f-4c4c-8131-7898ceff0346.replay.gz
-rw-r--r-- 1 root root   706552 8月  17 19:52 bdaf13ed-4400-4478-bfb3-04de826f8104.replay.gz
-rw-r--r-- 1 root root 39215246 8月  17 09:28 bdbb5125-3e9d-41aa-a80c-f99398c95076.replay.gz
-rw-r--r-- 1 root root    24019 8月  17 09:25 e3831e1d-c7ad-407a-944c-0663c176af69.replay.gz
-rw-r--r-- 1 root root  2955637 8月  17 09:20 e66c0dad-b6af-446e-bc67-f22e01d4d563.replay.gz
-rw-r--r-- 1 root root 29759310 8月  17 08:47 ed987d48-5fbb-40c7-b1ab-73a1f6444684.replay.gz
-rw-r--r-- 1 root root   893498 8月  17 13:54 f0c4bbf1-3555-4e09-abd2-c7aa0b6135ae.replay.gz
(py3) [root@dawn-jump-1 /opt/jumpserver/data/media/replay/2018-08-17]# 

  

 

查看node1配置

(py3) [root@dawn-jump-1 /data]# cat /etc/fstab 

#
# /etc/fstab
# Created by anaconda on Sun Aug 12 07:36:54 2018
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=836235fd-5660-4775-a281-22c26d8b4001 /                       xfs     defaults        0 0
UUID=c4b44b67-8f1a-4557-8cb1-176177fec5cc /boot                   xfs     defaults        0 0
UUID=f0c9652d-1ae1-4a23-9734-3dd6b83511ab swap                    swap    defaults        0 0
10.0.2.54:/jump-volume /opt/jumpserver/data/media  glusterfs defaults,_netdev 0 0
(py3) [root@dawn-jump-1 /data]# 
(py3) [root@dawn-jump-2 ~]# cat /etc/fstab 

#
# /etc/fstab
# Created by anaconda on Sat Aug 11 14:42:54 2018
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=48985467-9e3c-42d3-8d26-88b90d8a3be7 /                       xfs     defaults        0 0
UUID=530d5b90-9c78-456f-91d2-5a6a9fe9c28b /boot                   xfs     defaults        0 0
UUID=88c9d899-f547-4d80-9cc3-27eb24551d1e swap                    swap    defaults        0 0
10.0.2.55:/jump-volume /opt/jumpserver/data/media  glusterfs defaults,_netdev 0 0
(py3) [root@dawn-jump-2 ~]# 

 

查看node2配置

(py3) [root@dawn-jump-2 ~]# cat /etc/fstab 

#
# /etc/fstab
# Created by anaconda on Sat Aug 11 14:42:54 2018
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=48985467-9e3c-42d3-8d26-88b90d8a3be7 /                       xfs     defaults        0 0
UUID=530d5b90-9c78-456f-91d2-5a6a9fe9c28b /boot                   xfs     defaults        0 0
UUID=88c9d899-f547-4d80-9cc3-27eb24551d1e swap                    swap    defaults        0 0
10.0.2.55:/jump-volume /opt/jumpserver/data/media  glusterfs defaults,_netdev 0 0
(py3) [root@dawn-jump-2 ~]# 

  

 

 

posted on 2019-03-03 21:26  nmap  阅读(860)  评论(0编辑  收藏  举报

导航