Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Using CTDB and Samba on Gluster

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Mounting gluster volume using Samba alone does not implement High Availability, but CTDB can solve this problem.

1 prepare the environment

I have prepared a gluster environment in advance, created a volume repvol, and this volume has been configured to be mounted using samba client. Please refer to my previous blog post for detailed configuration.

[root@node02 /] # gluster pool listUUID Hostname Statee967c77f-ff39-4927-9645-606294d42751 node01.lab.example.com Connected 98ef6fd9-9fa1-4005-b8ec-5480d6c04f46 localhost Connected [root@node02 /] # gluster volume listrepvol [root@node02 ~] # smbclient-L node01.lab.example.com-U%

Domain= [SAMBA] OS= [Windows 6.1] Server= [Samba 4.4.4]

Sharename Type Comment

-

Print$ Disk Printer Drivers

Gluster-repvol Disk For samba share of volume repvol

IPC$ IPC IPC Service (Samba 4.4.4)

Domain= [SAMBA] OS= [Windows 6.1] Server= [Samba 4.4.4]

Server Comment

--

Workgroup Master

--

[root@node02 mnt] # mount-t cifs-o username=smbuser,password=redhat / / node01.lab.example.com/gluster-repvol / mnt/samba-test/ [root@node02 /] # df-h | grep samba//node01.lab.example.com/gluster-repvol 2.0G 33M 2.0G 2% / mnt/samba-test

As you can see from the above, I have two gluster server here, one by one

192.168.133.144 node01.lab.example.com

192.168.133.149 node02.lab.example.com

When mounting, I use / / node01.lab.example.com/gluster-repvol, so there is a problem. Although my gluster volume repvol here is a 2-copy replication volume, once the node01.lab.example.com fails, although there is still a copy of data on the node02.lab.example.com, it cannot be directly used by client and cannot be switched automatically.

2 install and configure ctdb on two gluster server

2.1 install ctdb using yum

[root@node01 ~] # yum install-y ctdb

Release firewall restrictions for ctdb

[root@node01] # firewall-cmd-- add-port=4379/tcp

2.2 Update volume settings

[root@node01 ~] # gluster volume stop repvol [root@node01 post] # cd / var/lib/glusterd/hooks/1/start/post [root@node01 post] # vi S29CTDBsetup.sh

Before the modification of META= "all"

After the modification of META= "ctdbmeta"

2.3 Update Samba configuration

Edit the / etc/samba/smb.conf file and add clustering=yes under the [global] option

[root@node01 post] # cat / etc/samba/smb.conf... [global] clustering = yes....

2.4start volume, you will find that volume will be automatically mounted to / gluster/lock of server.

[root@node01 post] # gluster volume start repvolvolume start: repvol: success [root@node01 post] # df-h | grep repvolnode01.lab.example.com:/repvol.tcp 2.0G 33M 2.0G 2% / gluster/lock

2.5 add / etc/ctdb/nodes and / etc/ctdb/public_address files

[root@node01 post] # vi / etc/ctdb/nodes 192.168.133.144192.168.133.149

# ip here is the ip of gluster server node

[root@node01 post] # vi / etc/ctdb/public_addresses 192.168.133.100/24 ens33

# here ip is floating ip and ens33 is interface name

2.6 start and verify ctdb service

[root@node01 post] # systemctl start ctdb [root@node01 post] # ctdb pnnPNN:0 [root@node01 post] # ctdb ping-n allresponse from 0 time=0.000049 sec (2 clients) response from 1 time=0.008014 sec (1 clients) [root@node01 post] # ctdb statusNumber of nodes:2pnn:0 192.168.133.144 OK (THIS NODE) pnn:1 192.168.133.149 OKGeneration:2009096591Size:2hash:0 lmaster:0hash:1 lmaster:1Recovery mode:RECOVERY (1) Recovery master:1 [root @ node01 post] # ctdb ipPublic IPs on node 0192.168.133.100 0 [root@node01 post] # ctdb ip info 192.168.133.100Public IPs on node 0192.168.133.100 0

2.7Mount gluster volume using floating ip

[root@node02 post] # mount-t cifs-o username=smbuser,password=redhat / / 192.168.133.100/gluster-repvol / mnt/samba-test/

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report