man_knotc.rst 3.51 KB
Newer Older
1 2
.. highlight:: console

3 4
knotc – Knot DNS control utility
================================
Jan Včelák's avatar
Jan Včelák committed
5 6 7 8 9 10 11 12 13 14 15 16 17

Synopsis
--------

:program:`knotc` [*parameters*] *action* [*action_args*]

Description
-----------

Parameters
..........

**-c**, **--config** *file*
18
  Use a textual configuration file (default is :file:`@config_dir@/knot.conf`).
Jan Včelák's avatar
Jan Včelák committed
19 20

**-C**, **--confdb** *directory*
21 22 23
  Use a binary configuration database directory (default is :file:`@storage_dir@/confdb`).
  The default configuration database, if exists, has a preference to the default
  configuration file.
Jan Včelák's avatar
Jan Včelák committed
24

25 26
**-s**, **--socket** *path*
  Use a remote control UNIX socket path (default is :file:`@run_dir@/knot.sock`).
Jan Včelák's avatar
Jan Včelák committed
27 28

**-f**, **--force**
29
  Forced operation. Overrides some checks.
Jan Včelák's avatar
Jan Včelák committed
30 31

**-v**, **--verbose**
32 33 34 35
  Enable debug output.

**-h**, **--help**
  Print the program help.
Jan Včelák's avatar
Jan Včelák committed
36 37

**-V**, **--version**
38
  Print the program version.
Jan Včelák's avatar
Jan Včelák committed
39 40 41 42

Actions
.......

43 44
**status**
  Check if the server is running.
Jan Včelák's avatar
Jan Včelák committed
45 46

**stop**
47
  Stop the server if running.
Jan Včelák's avatar
Jan Včelák committed
48

49 50
**reload**
  Reload the server configuration.
Jan Včelák's avatar
Jan Včelák committed
51 52


53 54 55 56 57 58 59 60
**zone-check** [*zone*...]
  Check the zone. (*)

**zone-memstats** [*zone*...]
  Estimate memory use for the zone. (*)

**zone-status** [*zone*...]
  Show the status of the zone. (*)
Jan Včelák's avatar
Jan Včelák committed
61

62 63
**zone-reload** [*zone*...]
  Trigger a zone reload.
Jan Včelák's avatar
Jan Včelák committed
64

65 66
**zone-refresh** [*zone*...]
  Trigger a zone refresh (if slave).
Jan Včelák's avatar
Jan Včelák committed
67

68 69
**zone-retransfer** [*zone*...]
  Trigger a zone retransfer (if slave).
Jan Včelák's avatar
Jan Včelák committed
70

71 72
**zone-flush** [*zone*...]
  Trigger a zone journal flush into the zone file.
Jan Včelák's avatar
Jan Včelák committed
73

74 75
**zone-sing** [*zone*...]
  Trigger a zone resign (if enabled).
Jan Včelák's avatar
Jan Včelák committed
76

77 78 79 80 81 82

**conf-init**
  Initialize the confdb. (*)

**conf-check**
  Check the server configuration. (*)
Jan Včelák's avatar
Jan Včelák committed
83

84
**conf-import** *filename*
85 86
  Import a config file into the confdb. Ensure the server is not accessing
  the confdb! (*)
Jan Včelák's avatar
Jan Včelák committed
87

88
**conf-export** *filename*
89
  Export the confdb into a config file. (*)
90

91 92
**conf-list** [*item*]
  List the confdb sections or section items.
93 94

**conf-read** [*item*]
95
  Read the item from the active confdb.
96 97

**conf-begin**
98
  Begin a writing confdb transaction. Only one transaction can be opened at a time.
99 100

**conf-commit**
101
  Commit the confdb transaction.
102 103

**conf-abort**
104
  Rollback the confdb transaction.
105 106

**conf-diff** [*item*]
107
  Get the item difference in the transaction.
108 109

**conf-get** [*item*]
110
  Get the item data from the transaction.
111 112

**conf-set** *item* [*data*...]
113
  Set the item data in the transaction.
114 115

**conf-unset** [*item*] [*data*...]
116
  Unset the item data in the transaction.
Jan Včelák's avatar
Jan Včelák committed
117

118 119
Note
----
Jan Včelák's avatar
Jan Včelák committed
120

121
Empty *zone* parameter means all zones.
122

123
Type *item* parameter in the form of *section*\ [**[**\ *id*\ **]**\ ][**.**\ *name*].
124

125
(*) indicates a local operation requiring a configuration specified.
Jan Včelák's avatar
Jan Včelák committed
126

127 128
Examples
--------
Jan Včelák's avatar
Jan Včelák committed
129

130 131
Reload the whole server configuration
.....................................
Jan Včelák's avatar
Jan Včelák committed
132 133 134

::

135
  $ knotc reload
Jan Včelák's avatar
Jan Včelák committed
136

137 138
Flush the example.com and example.eu zones
..........................................
Jan Včelák's avatar
Jan Včelák committed
139 140 141

::

142
  $ knotc zone-flush example.com example.eu
Jan Včelák's avatar
Jan Včelák committed
143

144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174
Get the current server configuration
....................................

::

  $ knotc conf-read server

Get the list of the current zones
.................................

::

  $ knotc conf-read zone.domain

Get the master remotes for the example.com zone
...............................................

::

  $ knotc conf-read zone[example.com].master

Add example.eu zone with a zonefile location
............................................

::

  $ knotc conf-begin
  $ knotc conf-set zone[example.eu]
  $ knotc conf-set zone[example.eu].file "/var/zones/example.eu.zone"
  $ knotc conf-commit

Jan Včelák's avatar
Jan Včelák committed
175 176 177 178
See Also
--------

:manpage:`knotd(8)`, :manpage:`knot.conf(5)`.