顯示具有 GlusterFS 標籤的文章。 顯示所有文章
顯示具有 GlusterFS 標籤的文章。 顯示所有文章

2025年9月29日 星期一

NFS-Ganesha 搭配 ctdb 組成 NFS HA 實驗

 NFS-Ganesha 搭配 ctdb 組成 NFS HA 實驗  


事前導讀可參考如下 URL


https://xrcd2.blogspot.com/2022/04/glusterfs-samba.html

https://xrcd2.blogspot.com/2024/05/glusterfs-servernfs-ganesha.html



架構說明:


(1) nfs1 192.168.100.11

(2) nfs2 192.168.100.12

(3) nfs-vip  192.168.100.10

 +

(4) NFS Client  192.168.100.30



作業系統及程式安裝:


Oracle Linux 9.6 + glusterfs 11.1 + NFS-Ganesha 4.4 + ctdb 4.23.0 






[root@nfs1 /]# gluster --version

glusterfs 11.1

Repository revision: git://git.gluster.org/glusterfs.git

Copyright (c) 2006-2016 Red Hat, Inc. <https://www.gluster.org/>

GlusterFS comes with ABSOLUTELY NO WARRANTY.

It is licensed to you under your choice of the GNU Lesser

General Public License, version 3 or any later version (LGPLv3

or later), or the GNU General Public License, version 2 (GPLv2),

in all cases as published by the Free Software Foundation.



[root@nfs1 /]# gluster volume info 

 

Volume Name: nfsvolume

Type: Replicate

Volume ID: 5979bdc3-20bf-4600-bac6-ad1514459efd

Status: Started

Snapshot Count: 0

Number of Bricks: 1 x 2 = 2

Transport-type: tcp

Bricks:

Brick1: nfs1:/syncdisk

Brick2: nfs2:/syncdisk

Options Reconfigured:

cluster.granular-entry-heal: on

storage.fips-mode-rchecksum: on

transport.address-family: inet

nfs.disable: on

performance.client-io-threads: off

[root@nfs1 /]# 



[root@nfs1 /]# /usr/bin/ganesha.nfsd -v

NFS-Ganesha Release = V4.4

[root@nfs1 /]# 



[root@nfs1 /]# /usr/bin/ctdb version 

4.23.0

[root@nfs1 /]# 


這篇的重點是說明如何透過 CTDB 設定形成 NFS 服務的 HA VIP 


[root@nfs1 /]# cat /etc/ctdb/nodes 

192.168.100.11

192.168.100.12



[root@nfs1 /]# cat /etc/ctdb/public_addresses 

192.168.100.10/24 ens160



[root@nfs1 /]# ctdb status 

Number of nodes:2

pnn:0 192.168.100.11   OK (THIS NODE)

pnn:1 192.168.100.12   OK

Generation:1901971548

Size:2

hash:0 lmaster:0

hash:1 lmaster:1

Recovery mode:NORMAL (0)

Leader:1


[root@nfs1 /]# ctdb ip 

Public IPs on node 0

192.168.100.10 0



[root@nfs1 /]# ip add

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000

    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

    inet 127.0.0.1/8 scope host lo

       valid_lft forever preferred_lft forever

    inet6 ::1/128 scope host 

       valid_lft forever preferred_lft forever

2: ens160: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000

    link/ether 00:0c:29:21:77:33 brd ff:ff:ff:ff:ff:ff

    altname enp3s0

    inet 192.168.100.11/24 brd 192.168.100.255 scope global noprefixroute ens160

       valid_lft forever preferred_lft forever

    inet 192.168.100.10/24 brd 192.168.100.255 scope global secondary ens160

       valid_lft forever preferred_lft forever




[root@nfs2 /]# ctdb status

Number of nodes:2

pnn:0 192.168.100.11   OK

pnn:1 192.168.100.12   OK (THIS NODE)

Generation:1901971548

Size:2

hash:0 lmaster:0

hash:1 lmaster:1

Recovery mode:NORMAL (0)

Leader:1




[root@nfs2 /]# ctdb ip

Public IPs on node 1

192.168.100.10 0

[root@nfs2 /]# 




可參考 /usr/share/ctdb/events/legacy/ 目錄內的檔自行修改所需內容



[root@nfs1 events]# cat /usr/share/ctdb/events/legacy/99.nfs-ganesha.script 

#!/bin/sh

# event script to manage nfs-ganesha in a cluster environment


[ -n "$CTDB_BASE" ] || \

    CTDB_BASE=$(d="$(dirname "$0")" && cd -P "$d/../../" && pwd)


. "${CTDB_BASE}/functions"


service_name="nfs-ganesha"


case "$1" in

    startup)

        systemctl start "$service_name"

        ;;

    shutdown)

        systemctl stop "$service_name"

        ;;

    takeip)

        systemctl try-restart "$service_name"

        ;;

    releaseip)

        systemctl stop "$service_name"

        ;;

    monitor)

        systemctl is-active --quiet "$service_name" || exit 1

        ;;

esac


exit 0



[root@nfs1 /]# ctdb event script enable legacy 10.interface


修正在  /var/log/log.ctdb ==>  nfs1 ctdb-recoverd[4893]: Assigned IP 192.168.100.10 not on an interface

該問題導致 HA VIP 無法形成??



[root@nfs1 /]# ctdb event script enable legacy 99.nfs-ganesha


[root@nfs1 /]# ctdb scriptstatus

10.interface         OK         0.027 Mon Sep 29 14:29:19 2025

99.nfs-ganesha       OK         0.006 Mon Sep 29 14:29:19 2025


====================================


nfs client 測試


[root@OL10 ~]# dnf -y install nfs-utils

[root@OL10 ~]# mount -t nfs4 192.168.100.10:/nfsha  /mnt/nfs_share

[root@OL10 ~]# df 

Filesystem            1K-blocks    Used Available Use% Mounted on

/dev/mapper/ol-root    46067712 6818824  39248888  15% /

devtmpfs                   4096       0      4096   0% /dev

tmpfs                   3833264       0   3833264   0% /dev/shm

tmpfs                   1533308    9368   1523940   1% /run

tmpfs                      1024       0      1024   0% /run/credentials/systemd-journald.service

/dev/nvme0n1p2           983040  510348    472692  52% /boot

tmpfs                      1024       0      1024   0% /run/credentials/getty@tty1.service

tmpfs                    766652      56    766596   1% /run/user/0

tmpfs                    766652      56    766596   1% /run/user/1000

192.168.100.10:/nfsha  20904960  388096  20516864   2% /mnt/nfs_share



[root@OL10 nfsshare]# cd /mnt/nfs_share/nfsshare

[root@OL10 nfsshare]# pwd

/mnt/nfs_share/nfsshare

[root@OL10 nfsshare]# ll                        

total 0

-rw-r--r-- 1 4294967294 4294967294 0 Sep 29 11:00 123.txt

[root@OL10 nfsshare]# touch abc.txt

[root@OL10 nfsshare]# ll

total 0

-rw-r--r-- 1 4294967294 4294967294 0 Sep 29 11:00 123.txt

-rw-r--r-- 1 4294967294 4294967294 0 Sep 29 14:34 abc.txt

[root@OL10 nfsshare]# 




========================================



HA 切換測試




[root@nfs2 /]# ctdb status

Number of nodes:2

pnn:0 192.168.100.11   DISCONNECTED|UNHEALTHY|INACTIVE

pnn:1 192.168.100.12   OK (THIS NODE)

Generation:839690097

Size:1

hash:0 lmaster:1

Recovery mode:NORMAL (0)

Leader:1




[root@nfs2 /]# ctdb ip

Public IPs on node 1

192.168.100.10 1




[root@nfs2 /]# ip add

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000

    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

    inet 127.0.0.1/8 scope host lo

       valid_lft forever preferred_lft forever

    inet6 ::1/128 scope host 

       valid_lft forever preferred_lft forever

2: ens160: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000

    link/ether 00:0c:29:0d:0f:f6 brd ff:ff:ff:ff:ff:ff

    altname enp3s0

    inet 192.168.100.12/24 brd 192.168.100.255 scope global noprefixroute ens160

       valid_lft forever preferred_lft forever

    inet 192.168.100.10/24 brd 192.168.100.255 scope global secondary ens160

       valid_lft forever preferred_lft forever

[root@nfs2 /]# 


2024年5月12日 星期日

GlusterFS-server加NFS-ganesha大亂測

 事前導讀及參考資訊

https://xrcd2.blogspot.com/2022/04/glusterfs-samba.html

https://www.server-world.info/en/note?os=CentOS_Stream_9&p=glusterfs11&f=1

https://core.vmware.com/resource/nfs-iscsi-multipathing-vsphere

測試架構

192.168.100.201 Rocky  Linux  nfs1     glusterfs-server+nfs-ganesha

192.168.100.202 Rocky  Linux  nfs2     glusterfs-server+nfs-ganesha

192.168.100.x   Oracle Linux  Oracle9  glusterfs/nfsclient test

192.168.100.111 ESXi NFS Client 

192.168.100.222 PVE  Glusterfs Client + Client

===========================

操作及設定簡要記錄

fdisk /dev/nvme0n2

mkfs.xfs /dev/nvme0n2p1

mkdir /syncdisk

blkid

vi /etc/fstab


UUID=33548bbf-a5be-4d08-ab25-28e68dc438f5 /syncdisk   xfs   defaults   0 0



vi /etc/hosts

192.168.100.201 nfs1 
192.168.100.202     nfs2

[root@nfs1 ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        4.0M     0  4.0M   0% /dev
tmpfs           3.8G     0  3.8G   0% /dev/shm
tmpfs           1.5G  9.4M  1.5G   1% /run
/dev/nvme0n1p2   44G  6.8G   38G  16% /
/dev/nvme0n1p1  960M  469M  492M  49% /boot
/dev/nvme0n2p1   20G  175M   20G   1% /syncdisk
tmpfs           766M   36K  766M   1% /run/user/1000
[root@nfs1 ~]# 


  dnf install centos-release-gluster11.noarch 
  dnf install centos-release-nfs-ganesha5.noarch 
  dnf --enablerepo=crb install python3-pyxattr
  dnf install   glusterfs-server


[root@nfs1 yum.repos.d]# systemctl enable --now glusterd
[root@nfs1 yum.repos.d]# gluster --version
glusterfs 11.1
Repository revision: git://git.gluster.org/glusterfs.git
Copyright (c) 2006-2016 Red Hat, Inc. <https://www.gluster.org/>
GlusterFS comes with ABSOLUTELY NO WARRANTY.
It is licensed to you under your choice of the GNU Lesser
General Public License, version 3 or any later version (LGPLv3
or later), or the GNU General Public License, version 2 (GPLv2),
in all cases as published by the Free Software Foundation.
[root@nfs1 yum.repos.d]# gluster peer probe nfs2
peer probe: success
[root@nfs1 yum.repos.d]# gluster peer status 
Number of Peers: 1

Hostname: nfs2
Uuid: bc6daa49-a8ca-438c-871c-45a978ea4251
State: Peer in Cluster (Connected)

[root@nfs1 yum.repos.d]# gluster volume create nfsvolume replica 2 transport tcp nfs1:/syncdisk/nfs nfs2:/syncdisk/nfs
Replica 2 volumes are prone to split-brain. Use Arbiter or Replica 3 to avoid this. See: http://docs.gluster.org/en/latest/Administrator-Guide/Split-brain-and-ways-to-deal-with-it/.
Do you still want to continue?
 (y/n) y
volume create: nfsvolume: success: please start the volume to access data

[root@nfs1 yum.repos.d]# gluster volume info 
 
Volume Name: nfsvolume
Type: Replicate
Volume ID: 776a642f-53fe-47ee-924a-20a45a911304
Status: Created
Snapshot Count: 0
Number of Bricks: 1 x 2 = 2
Transport-type: tcp
Bricks:
Brick1: nfs1:/syncdisk/nfs
Brick2: nfs2:/syncdisk/nfs
Options Reconfigured:
cluster.granular-entry-heal: on
storage.fips-mode-rchecksum: on
transport.address-family: inet
nfs.disable: on
performance.client-io-threads: off
[root@nfs1 yum.repos.d]# 


[root@nfs1 yum.repos.d]# gluster volume start nfsvolume
volume start: nfsvolume: success
[root@nfs1 yum.repos.d]# 


[root@nfs2 ~]#  mount -t glusterfs nfs1:/nfsvolume /mnt
[root@nfs2 ~]# df 
Filesystem      1K-blocks    Used Available Use% Mounted on
devtmpfs             4096       0      4096   0% /dev
tmpfs             3918632       0   3918632   0% /dev/shm
tmpfs             1567456    9600   1557856   1% /run
/dev/nvme0n1p2   46064640 7125096  38939544  16% /
/dev/nvme0n2p1   20904960  179044  20725916   1% /syncdisk
/dev/nvme0n1p1     983040  479448    503592  49% /boot
tmpfs              783724      36    783688   1% /run/user/1000
nfs1:/nfsvolume  20904960  388092  20516868   2% /mnt

[root@nfs2 ~]#  echo "GlusterFS write test from nfs2" > /mnt/test.txt
[root@nfs2 ~]# ls -la /syncdisk/nfs/*
-rw-r--r-- 2 root root 21 May 11 12:57 /syncdisk/nfs/test.txt
[root@nfs2 ~]# 


[root@nfs1 yum.repos.d]# ls -la /syncdisk/nfs/*
-rw-r--r-- 2 root root 21 May 11 12:57 /syncdisk/nfs/test.txt
[root@nfs1 yum.repos.d]# 


mkdir /syncgfs 

vi /etc/fstab 



[root@nfs1 nfs]# cat /etc/fstab 

#
# /etc/fstab
# Created by anaconda on Tue Feb 20 23:34:32 2024
#
# 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.
#
# After editing this file, run 'systemctl daemon-reload' to update systemd
# units generated from this file.
#
UUID=c5d392e3-edbd-44e3-bd92-0053aec8bc10 /                       xfs     defaults        0 0
UUID=6fe1dba6-5999-491c-9679-c32ee4c84490 /boot                   xfs     defaults        0 0
UUID=d631d923-aa38-475f-9609-8283d3a598dc none                    swap    defaults        0 0
UUID=33548bbf-a5be-4d08-ab25-28e68dc438f5 /syncdisk   xfs   defaults   0 0
nfs1:/nfsvolume /syncgfs glusterfs   defaults,_netdev   0 0
[root@nfs1 nfs]# 



[root@nfs2 syncgfs]# cat /etc/fstab 

#
# /etc/fstab
# Created by anaconda on Tue Feb 20 23:34:32 2024
#
# 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.
#
# After editing this file, run 'systemctl daemon-reload' to update systemd
# units generated from this file.
#
UUID=c5d392e3-edbd-44e3-bd92-0053aec8bc10 /                       xfs     defaults        0 0
UUID=6fe1dba6-5999-491c-9679-c32ee4c84490 /boot                   xfs     defaults        0 0
UUID=d631d923-aa38-475f-9609-8283d3a598dc none                    swap    defaults        0 0
UUID=575c8913-d8df-4d79-857e-4b586c439b52 /syncdisk   xfs   defaults   0 0 
nfs2:/nfsvolume         /syncgfs        glusterfs                 defaults,_netdev        0 0
[root@nfs2 syncgfs]# 


dnf install nfs-ganesha-vfs nfs-ganesha nfs-ganesha-gluster


[root@nfs1 nfs]# cp /etc/ganesha/ganesha.conf /etc/ganesha/ganesha.conf.org
[root@nfs1 nfs]# vi /etc/ganesha/ganesha.conf




###################################################
#
# Ganesha Config Example
#
# This is a commented example configuration file for Ganesha.  It is not
# complete, but only has some common configuration options.  See the man pages
# for complete documentation.
#
###################################################

## These are core parameters that affect Ganesha as a whole.
NFS_CORE_PARAM {
## Allow NFSv3 to mount paths with the Pseudo path, the same as NFSv4,
## instead of using the physical paths.
mount_path_pseudo = true;

## Configure the protocols that Ganesha will listen for.  This is a hard
## limit, as this list determines which sockets are opened.  This list
## can be restricted per export, but cannot be expanded.
Protocols = 3,4;
}

## These are defaults for exports.  They can be overridden per-export.
EXPORT_DEFAULTS {
## Access type for clients.  Default is None, so some access must be
## given either here or in the export itself.
Access_Type = RW;
}

## Configure settings for the object handle cache
#MDCACHE {
## The point at which object cache entries will start being reused.
#Entries_HWMark = 100000;
#}

## Configure an export for some file tree
EXPORT
{
## Export Id (mandatory, each EXPORT must have a unique Export_Id)
Export_Id = 12345;

## Exported path (mandatory)
Path = /nfsha;

## Pseudo Path (required for NFSv4 or if mount_path_pseudo = true)
Pseudo = /nfsha;

## Restrict the protocols that may use this export.  This cannot allow
## access that is denied in NFS_CORE_PARAM.
Protocols = 3,4;

## Access type for clients.  Default is None, so some access must be
## given. It can be here, in the EXPORT_DEFAULTS, or in a CLIENT block
Access_Type = RW;

## Whether to squash various users.
Squash = No_root_squash;

## Allowed security types for this export
Sectype = sys;

## Exporting FSAL
FSAL {
Name = GLUSTER;
hostname="192.168.100.201";
volume="nfsvolume";
}
}

## Configure logging.  Default is to log to Syslog.  Basic logging can also be
## configured from the command line
LOG {
## Default log level for all components
Default_Log_Level = WARN;

## Configure per-component log levels.
#Components {
#FSAL = INFO;
#NFS4 = EVENT;
#}

## Where to log
#Facility {
#name = FILE;
#destination = "/var/log/ganesha.log";
#enable = active;
#}
}



[root@nfs1 nfs]#  systemctl disable --now nfs-server
[root@nfs1 nfs]#  systemctl enable --now nfs-ganesha
Created symlink /etc/systemd/system/multi-user.target.wants/nfs-ganesha.service → /usr/lib/systemd/system/nfs-ganesha.service.
Created symlink /etc/systemd/system/nfs-ganesha.service.wants/nfs-ganesha-lock.service → /usr/lib/systemd/system/nfs-ganesha-lock.service.

[root@nfs1 nfs]# showmount -e localhost
Export list for localhost:
/nfsha (everyone)
[root@nfs1 nfs]# 





[root@Oracle9 ~]# yum install nfsv4-client-utils.x86_64 nfs-utils.x86_64


[root@Oracle9 mnt]# 

vi /ets/hosts

192.168.100.201 nfs1
192.168.100.202 nfs2


mkdir /mnt/HA-NFS


[root@Oracle9 mnt]# mount -t nfs4 nfs1:/nfsha /mnt/HA-NFS/


[root@Oracle9 mnt]# df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        4.0M     0  4.0M   0% /dev
tmpfs           3.7G     0  3.7G   0% /dev/shm
tmpfs           1.5G  9.2M  1.5G   1% /run
/dev/nvme0n1p3   45G   11G   35G  23% /
/dev/nvme0n1p1  960M  707M  254M  74% /boot
tmpfs           749M   36K  749M   1% /run/user/0
tmpfs           749M   36K  749M   1% /run/user/1001
nfs1:/nfsha      20G  379M   20G   2% /mnt/HA-NFS
[root@Oracle9 mnt]# 



[root@Oracle9 mnt]# cat  /mnt/HA-NFS/test.txt 
GlusterFS write test from nfs 1 
GlusterFS write test from nfs 2 

[root@Oracle9 mnt]# echo "GlusterFS write test from Oracle-Client  " >> /mnt/HA-NFS/test.txt 
[root@Oracle9 mnt]# 


[root@Oracle9 mnt]# cat /mnt/HA-NFS/test.txt 
GlusterFS write test from nfs 1 
GlusterFS write test from nfs 2 
GlusterFS write test from Oracle-Client  
[root@Oracle9 mnt]# 

[root@nfs1 nfs]# cat /syncdisk/nfs/test.txt 
GlusterFS write test from nfs 1 
GlusterFS write test from nfs 2 
GlusterFS write test from Oracle-Client  
[root@nfs1 nfs]# 


[root@nfs2 syncgfs]# cat /syncdisk/nfs/test.txt 
GlusterFS write test from nfs 1 
GlusterFS write test from nfs 2 
GlusterFS write test from Oracle-Client  
[root@nfs2 syncgfs]# 


[root@Oracle9 mnt]# umount /mnt/HA-NFS 
[root@Oracle9 mnt]# mount -t nfs4 nfs2:/nfsha /mnt/HA-NFS/

[root@Oracle9 mnt]# echo "GlusterFS write test2 from Oracle-Client  " >> /mnt/HA-NFS/test.txt 
[root@Oracle9 mnt]# 

[root@nfs1 nfs]# cat /syncdisk/nfs/test.txt 
GlusterFS write test from nfs 1 
GlusterFS write test from nfs 2 
GlusterFS write test from Oracle-Client  
GlusterFS write test2 from Oracle-Client  
[root@nfs1 nfs]# 


[root@nfs2 syncgfs]# cat /syncdisk/nfs/test.txt 
GlusterFS write test from nfs 1 
GlusterFS write test from nfs 2 
GlusterFS write test from Oracle-Client  
GlusterFS write test2 from Oracle-Client  
[root@nfs2 syncgfs]# 





ESXi

[root@localhost:~] esxcli storage nfs41 list
Volume Name  Host(s)                          Share   Accessible  Mounted  Read-Only  Security   isPE  Hardware Acceleration
-----------  -------------------------------  ------  ----------  -------  ---------  --------  -----  ---------------------
gfs-storage  192.168.100.201,192.168.100.202  /nfsha        true     true      false  AUTH_SYS  false  Not Supported
[root@localhost:~] 




[root@localhost:~] vim-cmd hostsvc/datastore/info gfs-storage
(vim.host.NasDatastoreInfo) {
   name = "gfs-storage", 
   url = "/vmfs/volumes/d3b21ae2-01cd6b50-0000-000000000000", 
   freeSpace = 14566449152, 
   maxFileSize = 70368744177664, 
   maxVirtualDiskCapacity = 68169720922112, 
   maxMemoryFileSize = 70368744177664, 
   timestamp = "2024-05-11T09:42:04.121385Z", 
   containerId = <unset>, 
   aliasOf = <unset>, 
   datastoreFormat = <unset>, 
   logicalSectorSize = <unset>, 
   physicalSectorSize = <unset>, 
   nas = (vim.host.NasVolume) {
      type = "NFS41", 
      name = "gfs-storage", 
      capacity = 21406679040, 
      remoteHost = "192.168.100.201", 
      remotePath = "/nfsha", 
      userName = <unset>, 
      remoteHostNames = (string) [
         "192.168.100.201", 
         "192.168.100.202"
      ], 
      securityType = "AUTH_SYS", 
      protocolEndpoint = false
   }
}
(vim.Datastore.HostMount) [
   (vim.Datastore.HostMount) {
      key = 'vim.HostSystem:ha-host', 
      mountInfo = (vim.host.MountInfo) {
         path = "/vmfs/volumes/d3b21ae2-01cd6b50-0000-000000000000", 
         accessMode = "readWrite", 
         mounted = true, 
         accessible = true, 
         inaccessibleReason = <unset>, 
         vmknicName = "None", 
         vmknicActive = false, 
         mountFailedReason = <unset>, 
         numTcpConnections = 1
      }
   }
]
[root@localhost:~]


[root@localhost:~] esxcli storage filesystem list
Mount Point                                        Volume Name                                 UUID                                 Mounted  Type            Size          Free
-------------------------------------------------  ------------------------------------------  -----------------------------------  -------  ------  ------------  ------------
/vmfs/volumes/d3b21ae2-01cd6b50-0000-000000000000  gfs-storage                                 d3b21ae2-01cd6b50-0000-000000000000     true  NFS41    21406679040   14566449152
/vmfs/volumes/654e469c-44d19cd7-8715-000c2921ee83  datastore1                                  654e469c-44d19cd7-8715-000c2921ee83     true  VMFS-6  137170518016   99963895808
/vmfs/volumes/654e469c-378e9fe6-73ec-000c2921ee83  OSDATA-654e469c-378e9fe6-73ec-000c2921ee83  654e469c-378e9fe6-73ec-000c2921ee83     true  VMFSOS  128580583424  125292249088
/vmfs/volumes/507161ab-d84dd9c3-c4a7-a5422027a503  BOOTBANK1                                   507161ab-d84dd9c3-c4a7-a5422027a503     true  vfat      4293591040    4000317440
/vmfs/volumes/d9628348-1545f094-5e85-a3d31d093e2e  BOOTBANK2                                   d9628348-1545f094-5e85-a3d31d093e2e     true  vfat      4293591040    4293525504
[root@localhost:~] 

PVE






ESXi  NFS

不同的儲存供應商有不同的方法來啟用此功能,
但通常 NAS 伺服器使用 no_root_squash 選項。
如果 NAS 伺服器不授予 root 存取權限,
仍然可以在主機上掛載 NFS 資料儲存。

但是,您無法在資料儲存上建立任何虛擬機器

2022年4月29日 星期五

GlusterFS + Samba

 最近有人問我如何建 DRDB ,但我之前沒留筆記,加這之前透過 google 很快的就建好了 DRDB

我只記得當初那個專案的內容為二台 CentOS 透過 Keepalived 去做 HA,DRDB的重點則用在 PostgreSQL 的 HA.

簡單的說就是做出 PostgreSQL的 HA (Active/Standby),供 Zabbix 使用.

而我最近則是使用 MariaDB Cluster去做 MySQL 的 HA (Active/Active),供 Librenms 使用,

HA 的 VIP 一樣是用 Keepalived.

但他的需求不是用在 DB 上,而是想去做 Samba 的 HA,但我想到的一個問題是,如果透過 DRBD 去做 HA 的話,會受限 DRDB 的機制,必然是一個  A/S 的架構,另一個問題是它是用  Block level disk replication,平時無法驗證檔案是否真的有複寫成功,除非 Remount replicated disk才可去驗證,或做 HA 切換演練去驗證.另一個問題則是 Active GG 後, A/S 的角色互換問題與重建.

假設 Active/Standby 的機器沒在監控它的 DRDB 機制是否運作正常?會不會有一天, HA 切換後才發現 Samba 的東西短少了!?  


經過 goolge 後,發現 GlusterFS +  Samba (CTDB) 這個組合比 DRDB + Samba 還要優一些,而且是 A/A 的架構

Byte-level file replication VS Block-level disk replication 我個人是比較推崇 GlusterFS 的.


以下為個人做的建制小筆記.


架構說明:


(1) fsa 192.168.100.111

(2) fsb 192.168.100.112

(3) vip 192.168.100.100


CentOS 7.9 + Clusterfs 9.5



參考 URL

https://www.server-world.info/en/note?os=CentOS_7&p=glusterfs9&f=1

https://www.server-world.info/en/note?os=CentOS_7&p=glusterfs9&f=5

https://wiki.samba.org/index.php/CTDB_and_Clustered_Samba


=========================================================

vi /etc/hosts

yum install centos-release-gluster

yum install centos-release-gluster glusterfs-server centos-release-samba samba samba-vfs-glusterfs

yum -y install centos-release-samba411

yum --enablerepo=centos-samba411 -y install samba ctdb samba-vfs-glusterfs


fdisk -l

fdisk /dev/sdb

mkfs.xfs /dev/sdb1

mkdir -p /bricks/brick1

mount /dev/sdb1 /bricks/brick1

vi /etc/fstab 

systemctl enable glusterd.service

systemctl start glusterd.service

gluster peer probe fsb

gluster peer status

gluster volume create glustervol1 replica 2 transport tcp fsa:/bricks/brick1/brick fsb:/bricks/brick1/brick

gluster volume start glustervol1

gluster volume info all

gluster volume stop glustervol1

gluster volume set glustervol1 user.smb enable

gluster volume set glustervol1 performance.write-behind off

gluster volume set glustervol1 group samba

vi /var/lib/glusterd/hooks/1/start/post/S29CTDBsetup.sh

vi /var/lib/glusterd/hooks/1/stop/pre/S29CTDB-teardown.sh

gluster volume start glustervol1

df -h /gluster/lock

tail -1 /etc/fstab

vi /etc/ctdb/nodes

ip add

vi /etc/ctdb/public_addresses

systemctl enable --now ctdb

ctdb status

ctdb ip

mount -t glusterfs fsa:/glustervol1 /mnt

mkdir /mnt/smbshare

groupadd smbgroup

chgrp smbgroup /mnt/smbshare

chmod 770 /mnt/smbshare

umount /mnt

vi /etc/samba/smb.conf

systemctl enable --now smb

useradd cent

smbpasswd -a cent

usermod -aG smbgroup cent

systemctl restart smb








Gluster Replication + CTDB







Architecture