3.15.1. Client Initiated Connection

The Bareos Director Daemon knows, when it is required to talk to a client (Bareos File Daemon). Therefore, by defaults, the Bareos Director Daemon connects to the clients.

However, there are setups where this can cause problems, as this means that:

  • The client must be reachable by its configured Address (Dir->Client). Address can be the DNS name or the IP address. (For completeness: there are potential workarounds by using the setip command.)
  • The Bareos Director Daemon must be able to connect to the Bareos File Daemon over the network.

To circumvent these problems, since Bareos Version >= 16.2.2 it is possible to let the Bareos File Daemon initiate the network connection to the Bareos Director Daemon.

Which address the client connects to reach the Bareos Director Daemon is configured in the Address (Fd->Director) directive.

To additional allow this connection direction use:

  • Connection From Client To Director (Dir->Client) = yes
  • Heartbeat Interval (Dir->Client) = 60 # to keep the network connection established
  • Connection From Client To Director (Fd->Director) = yes

To only allow Connection From the Client to the Director use:

  • Connection From Director To Client (Dir->Client) = no
  • Connection From Client To Director (Dir->Client) = yes
  • Heartbeat Interval (Dir->Client) = 60 # to keep the network connection established
  • Connection From Director To Client (Fd->Director) = no
  • Connection From Client To Director (Fd->Director) = yes

Using Client Initiated Connections has disadvantages. Without Client Initiated Connections the Bareos Director Daemon only establishes a network connection when this is required. With Client Initiated Connections, the Bareos File Daemon connects to the Bareos Director Daemon and the Bareos Director Daemon keeps these connections open. The command status dir will show all waiting connections:

show waiting client connections
*<input>status dir</input>
...
Client Initiated Connections (waiting for jobs):
Connect time        Protocol            Authenticated       Name
====================================================================================================
19-Apr-16 21:50     54                  1                   client1.example.com
...
====

When both connection directions are allowed, the Bareos Director Daemon

  1. checks, if there is a waiting connection from this client.
  2. tries to connect to the client (using the usual timeouts).
  3. waits for a client connection to appear (using the same timeout as when trying to connect to a client).

If none of this worked, the job fails.

When a waiting connection is used for a job, the Bareos File Daemon will detect this and creates an additional connection. This is required, to keep the client responsive for additional commands, like cancel.

To get feedback in case the Bareos File Daemon fails to connect to the Bareos Director Daemon, consider configuring Bareos File Daemon to log in a local file. This can be archived by adding the line

Append = “/var/log/bareos/bareos-fd.log” = all, !skipped, !restored

to the default message resource StandardFdMessages :

bareos-fd.d/messages/Standard.conf
Messages {
  Name = Standard
  Director = bareos-dir = all, !skipped, !restored
  Append = "/var/log/bareos/bareos-fd.log" = all, !skipped, !restored
}