# mount.glusterfs
# mount -o mountproto=tcp,async -t nfs
# mount.cifs
# yum install ctdb samba nfs-utils cifs-utils
gluster1, 192.168.122.100
gluster2, 192.168.122.101
192.168.122.200
192.168.122.201
; zone file fragment
data. 86400 IN A 192.168.122.200
data. 86400 IN A 192.168.122.201
# mount.glusterfs gluster1:smb /mnt/glustersmb
# vim /etc/samba/smb.conf
[global]
clustering = yes
idmap backend = tdb2
private dir = /mnt/glustersmb/lock
[pub]
path = /mnt/glustersmb/lock
browseable = YES
force user = smbcli
force group = smbcli
writable = yes
guest ok = yes
guest account = smbcli
guest only = yes
# mkdir /mnt/glustersmb/lock
# touch /mnt/glustersmb/lock/lockfile
# vim /etc/sysconfig/ctdb
CTDB_RECOVERY_LOCK=/mnt/glustersmb/lock/lockfile
CTDB_PUBLIC_ADDRESSES=/etc/ctdb/public_addresses
CTDB_MANAGES_SAMBA=yes
CTDB_NODES=/etc/ctdb/nodes
CTDB_MANAGES_NFS=yes
CTDB_NOTIFY_SCRIPT=/etc/ctdb/notify.sh
# vim /etc/ctdb/public_addesses
192.168.122.200/24 eth0
192.168.122.201/24 eth0
# vim /etc/ctdb/nodes
192.168.122.100
192.168.122.101
# vim /etc/sysconfig/iptables
-A INPUT -p tcp --dport 4379 -j ctdb
-A INPUT -p udp --dport 4379 -j ctdb
-A INPUT -p tcp -m multiport --ports 137:139,445 -m comment --comment "SAMBA" -j SMB
-A INPUT -p udp -m multiport --ports 137:139,445 -m comment --comment "SAMBA" -j SMB
-A INPUT -p tcp -m multiport --ports 111,2049,595:599 -j NFS
-A INPUT -p udp -m multiport --ports 111,2049,595:599 -j NFS
-A INPUT -p tcp -m tcp --dport 24007:24220 -m comment --comment "Gluster daemon" -j ACCEPT
-A INPUT -p tcp -m tcp --dport 38465:38667 -m comment --comment "Gluster daemon(nfs ports)" -j ACCEPT
# useradd smbcli
# chown -R smbcli.smbcli /mnt/glustersmb/pub
# chkconfig smbd off
# chkconfig ctdb on
# service ctdb start
# ctdb status
Number of nodes:2
pnn:0 192.168.122.100 OK (THIS NODE)
pnn:1 192.168.122.101 OK
Generation:1112747960
Size:2
hash:0 lmaster:0
hash:1 lmaster:1
Recovery mode:NORMAL (0)
Recovery master:0
# ctdb ip
Public IPs on node 0
192.168.122.200 node[1] active[] available[eth0] configured[eth0]
192.168.122.201 node[0] active[eth0] available[eth0] configured[eth0]
# mount.cifs data:smb /mnt
# mount -o mountproto=tcp,async -t nfs data:smb /mnt
The host that took over the IP address of the other knows only what they were about old TCP connections and does not know the “TCP squence number” connections. Accordingly, they can not continue. As well as the client, he knows nothing about the fact that connections are now made with another node.
In order to avoid delays associated with switching the connection, the following method is used. To understand this technique, you need to understand the basic principles of the TCP protocol.
The new node, receiving its ip address, sends the client a packet with the ACK flag and the obviously “s / sequence number” equal to zero. In response, the client, in accordance with the rules of the TCP protocol, sends back an ACK Reply packet with the correct “squence number”. Having received the correct "squence number" node forms a packet with the RST flag and this "squence number". Having received it, the client immediately restarts the connection.
Source: https://habr.com/ru/post/194970/
All Articles