1.\" Copyright (c) 2010 The FreeBSD Foundation 2.\" All rights reserved. 3.\" 4.\" This software was developed by Pawel Jakub Dawidek under sponsorship from 5.\" the FreeBSD Foundation. 6.\" 7.\" Redistribution and use in source and binary forms, with or without 8.\" modification, are permitted provided that the following conditions 9.\" are met: 10.\" 1. Redistributions of source code must retain the above copyright 11.\" notice, this list of conditions and the following disclaimer. 12.\" 2. Redistributions in binary form must reproduce the above copyright 13.\" notice, this list of conditions and the following disclaimer in the 14.\" documentation and/or other materials provided with the distribution. 15.\" 16.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND 17.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE 20.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26.\" SUCH DAMAGE. 27.\" 28.\" $FreeBSD$ 29.\" 30.Dd February 1, 2010 31.Dt HASTCTL 8 32.Os 33.Sh NAME 34.Nm hastctl 35.Nd "Highly Available Storage control utility" 36.Sh SYNOPSIS 37.Nm 38.Cm create 39.Op Fl d 40.Op Fl c Ar config 41.Op Fl e Ar extentsize 42.Op Fl k Ar keepdirty 43.Op Fl m Ar mediasize 44.Ar name ... 45.Nm 46.Cm role 47.Op Fl d 48.Op Fl c Ar config 49.Aq init | primary | secondary 50.Ar all | name ... 51.Nm 52.Cm status 53.Op Fl d 54.Op Fl c Ar config 55.Op Ar all | name ... 56.Nm 57.Cm dump 58.Op Fl d 59.Op Fl c Ar config 60.Op Ar all | name ... 61.Sh DESCRIPTION 62The 63.Nm 64utility is used to control the behaviour of the 65.Xr hastd 8 66daemon. 67.Pp 68This utility should be used by HA software like 69.Nm heartbeat 70or 71.Nm ucarp 72to setup HAST resources role when changing from primary mode to 73secondary or vice versa. 74Be aware that if a file system like UFS exists on HAST provider and 75primary node dies, file system has to be checked for inconsistencies 76with the 77.Xr fsck 8 78utility after switching secondary node to primary role. 79.Pp 80The first argument to 81.Nm 82indicates an action to be performed: 83.Bl -tag -width ".Cm create" 84.It Cm create 85Initialize local provider configured for the given resource. 86Additional options include: 87.Bl -tag -width ".Fl e Ar extentsize" 88.It Fl e Ar extentsize 89Size of an extent. 90Extent is a block which is used for synchronization. 91.Nm 92maintains a map of dirty extents and extent is the smallest region that 93can be marked as dirty. 94If any part of an extent is modified, entire extent will be synchronized 95when nodes connect. 96If extent size is too small, there will be too much disk activity 97related to dirty map updates, which will degrade performance of the 98given resource. 99If extent size is too large, synchronization, even in case of short 100outage, can take a long time increasing the risk of loosing up-to-date 101node before synchronization process is completed. 102The default extent size is 103.Va 2MB . 104.It Fl k Ar keepdirty 105Maximum number of dirty extents to keep dirty all the time. 106Most recently used extents are kept dirty to reduce number of metadata 107updates. 108The default numer of most recently used extents which will be kept 109dirty is 110.Va 64 . 111.It Fl m Ar mediasize 112Size of the smaller provider used as backend storage on both nodes. 113This option can be omitted if node providers have the same size on both 114sides. 115.El 116.It Cm role 117Change role of the given resource. 118The role can be one of: 119.Bl -tag -width ".Cm secondary" 120.It Cm init 121Resource is turned off. 122.It Cm primary 123Local 124.Xr hastd 8 125daemon will act as primary node for the given resource. 126System on which resource role is set to primary can use 127.Pa /dev/hast/<name> 128GEOM provider. 129.It Cm secondary 130Local 131.Xr hastd 8 132daemon will act as secondary node for the given resource - it will wait 133for connection from the primary node and will handle I/O requests 134received from it. 135GEOM provider 136.Pa /dev/hast/<name> 137will not be created on secondary node. 138.El 139.It Cm status 140Present status of the configured resources. 141.It Cm dump 142Dump metadata stored on local component for the configured resources. 143.El 144.Pp 145In addition, every subcommand can be followed by the following options: 146.Bl -tag -width ".Fl c Ar config" 147.It Fl c Ar config 148Specify alternative location of the configuration file. 149The default location is 150.Pa /etc/hast.conf . 151.It Fl d 152Print debugging information. 153This option can be specified multiple times to raise the verbosity 154level. 155.El 156.Sh EXIT STATUS 157Exit status is 0 on success, or one of the values described in 158.Xr sysexits 3 159on failure. 160.Sh EXAMPLES 161Initialize HAST provider, create file system on it and mount it. 162.Bd -literal -offset indent 163nodeB# hastctl create shared 164nodeB# hastd 165nodeB# hastctl role secondary shared 166 167nodeB# hastctl create shared 168nodeA# hastd 169nodeA# hastctl role primary shared 170nodeA# newfs -U /dev/hast/shared 171nodeA# mount -o noatime /dev/hast/shared /shared 172nodeA# application_start 173.Ed 174.Pp 175Switch roles for the 176.Nm shared 177HAST resource. 178.Bd -literal -offset indent 179nodeA# application_stop 180nodeA# umount -f /shared 181nodeA# hastctl role secondary shared 182 183nodeB# hastctl role primary shared 184nodeB# fsck -t ufs /dev/hast/shared 185nodeB# mount -o noatime /dev/hast/shared /shared 186nodeB# application_start 187.Ed 188.Sh FILES 189.Bl -tag -width ".Pa /var/run/hastctl" -compact 190.It Pa /etc/hast.conf 191Configuration file for 192.Nm 193and 194.Xr hastd 8 . 195.It Pa /var/run/hastctl 196Control socket used by 197.Nm 198to communicate with the 199.Xr hastd 8 200daemon. 201.El 202.Sh SEE ALSO 203.Xr sysexits 3 , 204.Xr geom 4 , 205.Xr hast.conf 5 , 206.Xr fsck 8 , 207.Xr ggatec 8 , 208.Xr ggatel 8 , 209.Xr hastd 8 , 210.Xr mount 8 , 211.Xr newfs 8 . 212.Sh AUTHORS 213The 214.Nm 215was developed by 216.An Pawel Jakub Dawidek Aq pjd@FreeBSD.org 217under sponsorship of the FreeBSD Foundation. 218