您好,登錄后才能下訂單哦!
如何實現基于cman+rgmanage+gfs2+iscsi+rbd 高可用文件共享環境搭建,針對這個問題,這篇文章詳細介紹了相對應的分析和解答,希望可以幫助更多想解決這個問題的小伙伴找到更簡單易行的方法。
說明:rbd以iscsi方式導出作為共享存儲。Iscsi target為10.20.18.111 iscsi intinator為10.20.15.163和10.20.15.164。cman+rgmanager管理nfs-server集群,gfs2為集群文件系統,管理集群內文件的并行操作。
# rpm –ivh scsi-target-utils-1.0.38-48.bf6981.ceph.el6.x86_64.rpm # service tgtd start
# sudo tgtadm --lld iscsi --op show --mode system System: State: ready debug: off LLDs: iser: error iscsi: ready Backing stores: rbd (bsoflags sync:direct) rdwr (bsoflags sync:direct) ssc null bsg sg sheepdog Device types: passthrough tape changer controller osd cd/dvd disk iSNS: iSNS=Off iSNSServerIP= iSNSServerPort=3205 iSNSAccessControl=Off
#vi /etc/tgt/targets.conf <target iqn.2015-05.rbdstore.example.com:iscsi> driver iscsi bs-type rbd backing-store iscsi/iscsi-rbd # <iscsi-pool>/<iscsi-rbd-image> </target>
# service tgtd reload Updating target framework daemon configuration
# yum install iscsi-initiator-utils
# iscsiadm -m discovery -t sendtargets -p 10.20.18.111 10.20.18.111:3260,1 iqn.2015-04.rbdstore.example.com:iscsi
# iscsiadm -m node -T iqn.2014-04.rbdstore.example.com:iscsi -p 10.20.18.111:3260 –loginLogging in to [iface: default, target: iqn.2014-04.rbdstore.example.com:iscsi, portal: 192.168.1.102,3260] (multiple) Login to [iface: default, target: iqn.2014-04.rbdstore.example.com:iscsi, portal: 192.168.1.102,3260] successful.
fdisk –l Disk /dev/sda: 1073 MB, 1073741824 bytes 34 heads, 61 sectors/track, 1011 cylinders Units = cylinders of 2074 * 512 = 1061888 bytes Sector size (logical/physical): 512 bytes / 4194304 bytes I/O size (minimum/optimal): 4194304 bytes / 4194304 bytes Disk identifier: 0x00000000
# vi /etc/hosts 10.20.15.165 DEV-L0003557 10.20.15.163 CNSZOSD01
# ssh-keygen -t rsa -P "" # ssh-copy-id -i .ssh/id_rsa.pub root@ CNSZOSD01
(兩個節點都配置)
# yum install cman rgmager -y
# ccs_tool create tcluster # ccs_tool addnode CNSZOSD01-n 1 # ccs_tool addnode DEV-L0003557-n 2 # vi /etc/cluster/cluster.conf <dlm enable_fencing="0"/>
# scp /etc/cluster/cluster.conf initiator2:/etc/cluster/
# service cman start # service rgmanager start
# clustat Cluster Status for tcluster @ Fri May 8 13:53:40 2015 Member Status: Quorate Member Name ID Status ------ ---- ---- ------ CNSZOSD01 1 Online DEV-L0003557 2 Online, Local
# yum install gfs2-utils
# mkfs.gfs2 -j 2 -p lock_dlm -t tcluster:sda dev/sda
備注:gfs為日志文件系統,每個節點都要有一個日志,本次實驗有兩個節點,所以創建兩個日志。tcluster為集群名稱、sda為鎖表名稱。
# mount –t gfs2 –o _netdev,nodiratime,noatime /dev/sda /mnt
# yum install -y lvm2-cluster
# lvmconf --enable-cluster
# service clvmd start
# pvcreate /dev/sda 創建物理卷 # vgcreate clustervg /dev/sda 創建卷組 # lvcreate -L 500M -n clusterlv clustervg 創建邏輯卷 # mkfs.gfs2 -j 2 -p lock_dlm -t tcluster:lv /dev/clustervg/clusterlv # mount /dev/clustervg/clusterlv /mnt
# yum -y install nfs-utils rpcbind # yum install nfs-utils
2. NFS的配置文件定義: /etc/exports
# vim /etc/exports /mnt 10.20.*.*(rw,no_root_squash,no_all_squash,sync)
注:配置文件說明:
/mnt 為共享的目錄,即rbd所掛目錄,使用絕對路徑.10.20.*.*允許客戶端訪問的IP,()里面為權限控制。
# service rpcbind start # service nfs start
# mkdir /usr/local/nfstest
#配置生效
# exportfs -rv
# showmount -e 10.20.16.177
# mount -t nfs 10.20.16.177:/mnt /usr/local/nfstest
# yum install samba samba-client samba-swat
(無需客戶端密碼驗證的簡單配置)
# vi /etc/samba/smb.conf [global] //該設置與Samba服務整體運行環境有關,它的設置項目針對所有共享資源
# ----------------------- Network Related Options ------------------------- # # workgroup = NT-Domain-Name or Workgroup-Name, eg: MIDEARTH # # server string is the equivalent of the NT Description field # # netbios name can be used to specify a server name not tied to the hostname workgroup = WORKGROUP //定義工作組,也就是windows中的工作組概念 server string = David Samba Server Version %v //定義Samba服務器的簡要說明 netbios name = DavidSamba //定義windows中顯示出來的計算機名稱 # --------------------------- Logging Options ----------------------------- # # Log File let you specify where to put logs and how to split them up. log file = /var/log/samba/log.%m //定義Samba用戶的日志文件,%m代表客戶端主機名 //Samba服務器會在指定的目錄中為每個登陸主機建立不同的日志文件 # ----------------------- Standalone Server Options ------------------------ # # Scurity can be set to user, share(deprecated) or server(deprecated) security = share //共享級別,用戶不需要賬號和密碼即可訪問 #============================ Share Definitions ============================== [public] //設置針對的是共享目錄個別的設置,只對當前的共享資源起作用 comment = Public Stuff //對共享目錄的說明文件,自己可以定義說明信息 path = /mnt //用來指定共享的目錄,必選項 public = yes //所有人可查看,等效于guest ok = yes
\\10.20.15.163\public
關于如何實現基于cman+rgmanage+gfs2+iscsi+rbd 高可用文件共享環境搭建問題的解答就分享到這里了,希望以上內容可以對大家有一定的幫助,如果你還有很多疑惑沒有解開,可以關注億速云行業資訊頻道了解更多相關知識。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。