0

Im' trying to configure Haproxy to failover samba tcp traffic

Now I have this config:

frontend rserve_frontend445
    bind *:445
    mode tcp
    option tcplog
    timeout client  15s
    default_backend rserve_backend445

backend rserve_backend445
    mode tcp
    #option tcplog
   #option log-health-checks
    #option redispatch
    log global
    #balance roundrobin
    timeout connect 5s
    timeout server 10s   
    server cf-m 192.168.1.2:445 
    server cf-l 192.168.2.2:445 backup

When I open share \haproxy\ I see SMB share on server 192.168.1.2

When I start copy big file and then I disconnect network on primary backend server 192.168.1.2

After that file coping freeze and haproxy cant redirect me to backup node 192.168.2.2

I want to create auto samba failover proxy via HAproxy. What I do wrong?

I'm new in it, thanks in advance!

Darkwind
  • 345
  • 9
  • 20

1 Answers1

1

There are 2 components you have to consider beside the frontend of samba presenting the cifs share to host a cluster:

  1. Clustered Storage:
    The storage backend which Samba writes to, the files on disk, have to be available to all Samba servers. A solution is using a cluster file system like GlusterFS or CephFS.
  2. Shared Samba State:
    Samba uses TDB, a local database, to store state information. To be able to share this state, there is CTDB

As HaProxy has no control over these components, it cannot load-balance an active connection transparently.

Even with a clustered filesystem and CTDB in place, Samba doesn't seem to be able to handle a transparent failover (correct me, if I'm wrong). More on that, see CTDB Samba failover not highly available .