FreeBSD Man Pages

HASTD(8) FreeBSD System Manager's Manual HASTD(8)
NAMEhastd -- Highly Available Storage daemon
SYNOPSIShastd [-dFh] [-cconfig] [-Ppidfile]
DESCRIPTION
The hastd daemon is responsible for managing highly available GEOM
providers.
hastd allows to transparently store data on two physically separated
machines connected over the TCP/IP network. Only one machine (cluster
node) can actively use storage provided by hastd. This machine is called
primary. The hastd daemon operates on block level, which makes it trans-
parent for file systems and applications.
There is one main hastd daemon which starts new worker process as soon as
a role for the given resource is changed to primary or as soon as a role
for the given resource is changed to secondary and remote (primary) node
will successfully connect to it. Every worker process gets a new process
title (see setproctitle(3)), which describes its role and resource it
controls. The exact format is:
hastd: <resource name> (<role>)
When (and only when) hastd operates in primary role for the given
resource, corresponding /dev/hast/_name_ disk-like device (GEOM provider)
is created. File systems and applications can use this provider to send
I/O requests to. Every write, delete and flush operation (BIO_WRITE,
BIO_DELETE, BIO_FLUSH) is send to local component and synchronously
replicated to the remote (secondary) node if it is available. Read oper-
ations (BIO_READ) are handled locally unless I/O error occurs or local
version of the data is not up-to-date yet (synchronization is in
progress).
The hastd daemon uses the GEOM Gate class to receive I/O requests from
the in-kernel GEOM infrastructure. The geom_gate.ko module is loaded
automatically if the kernel was not compiled with the following option:
optionsGEOM_GATE
The connection between two hastd daemons is always initiated from the one
running as primary to the one running as secondary. When primary hastd
is unable to connect or connection fails, it will try to re-establish
connection every few seconds. Once connection is established, primary
hastd will synchronize every extent that was modified during connection
outage to the secondary hastd.
It is possible that in case of connection outage between the nodes hastd
primary role for the given resource will be configured on both nodes.
This in turn leads to incompatible data modifications. Such condition is
called split-brain and cannot be automatically resolved by the hastd dae-
mon as this will lead most likely to data corruption or lost of important
changes. Even though it cannot be fixed by hastd itself, it will be
detected and further connection between independently modified nodes will
not be possible. Once this situation is manually resolved by an adminis-
trator, resource on one of the nodes can be initialized (erasing local
data), which makes connection to the remote node possible again. Connec-
tion of freshly initialized component will trigger full resource synchro-
nization.
The hastd daemon itself never picks his role up automatically. The role
has to be configured with the hastctl(8) control utility by additional
software like ucarp or heartbeat that can reliably manage role separation
and switch secondary node to primary role in case of original primary
failure.
The hastd daemon can be started with the following command line argu-
ments:
-cconfig Specify alternative location of the configuration file. The
default location is /etc/hast.conf.
-d Print or log debugging information. This option can be spec-
ified multiple times to raise the verbosity level.
-F Start the hastd daemon in the foreground. By default hastd
starts in the background.
-h Print the hastd usage message.
-Ppidfile Specify alternative location of a file where main process PID
will be stored. The default location is /var/run/hastd.pid.
EXIT STATUS
Exit status is 0 on success, or one of the values described in
sysexits(3) on failure.
EXAMPLES
Launch hastd on both nodes. Set role for resource shared to primary on
nodeA and to secondary on nodeB. Create file system on /dev/hast/shared
provider and mount it.
nodeB# hastd
nodeB# hastctl role secondary shared
nodeA# hastd
nodeA# hastctl role primary shared
nodeA# newfs -U /dev/hast/shared
nodeA# mount -o noatime /dev/hast/shared /shared
FILES
/etc/hast.conf The configuration file for hastd and hastctl(8).
/var/run/hastctl Control socket used by the hastctl(8) control utility
to communicate with hastd.
/var/run/hastd.pid
The default location of the hastd PID file.
SEE ALSOsysexits(3), geom(4), hast.conf(5), ggatec(8), ggated(8), ggatel(8),
hastctl(8), mount(8), newfs(8), g_bio(9).
AUTHORS
The hastd was developed by Pawel Jakub Dawidek <pjd@FreeBSD.org> under
sponsorship of the FreeBSD Foundation.
FreeBSD 10.1 February 1, 2010 FreeBSD 10.1