ovsdb: Add unixctl commands for OVSDB replication
[cascardo/ovs.git] / ovsdb / ovsdb-server.1.in
1 .\" -*- nroff -*-
2 .de IQ
3 .  br
4 .  ns
5 .  IP "\\$1"
6 ..
7 .TH ovsdb\-server 1 "@VERSION@" "Open vSwitch" "Open vSwitch Manual"
8 .\" This program's name:
9 .ds PN ovsdb\-server
10 .
11 .SH NAME
12 ovsdb\-server \- Open vSwitch database server
13 .
14 .SH SYNOPSIS
15 \fBovsdb\-server\fR
16 [\fIdatabase\fR]\&...
17 [\fB\-\-remote=\fIremote\fR]\&...
18 [\fB\-\-run=\fIcommand\fR]
19 .so lib/daemon-syn.man
20 .so lib/service-syn.man
21 .so lib/vlog-syn.man
22 .so ovsdb/replication-syn.man
23 .so lib/ssl-syn.man
24 .so lib/ssl-bootstrap-syn.man
25 .so lib/ssl-peer-ca-cert-syn.man
26 .so lib/unixctl-syn.man
27 .so lib/common-syn.man
28 .
29 .SH DESCRIPTION
30 The \fBovsdb\-server\fR program provides RPC interfaces to one or more
31 Open vSwitch databases (OVSDBs).  It supports JSON-RPC client
32 connections over active or passive TCP/IP or Unix domain sockets.
33 .PP
34 Each OVSDB file may be specified on the command line as \fIdatabase\fR.
35 If none is specified, the default is \fB@DBDIR@/conf.db\fR.  The database
36 files must already have been created and initialized using, for
37 example, \fBovsdb\-tool create\fR.
38 .
39 .SH OPTIONS
40 .
41 .IP "\fB\-\-remote=\fIremote\fR"
42 Adds \fIremote\fR as a connection method used by \fBovsdb\-server\fR.
43 \fIremote\fR must take one of the following forms:
44 .
45 .RS
46 .so ovsdb/remote-passive.man
47 .so ovsdb/remote-active.man
48 .
49 .IP "\fBdb:\fIdb\fB,\fItable\fB,\fIcolumn\fR"
50 Reads additional connection methods from \fIcolumn\fR in all of the
51 rows in \fItable\fR within \fIdb\fR.  As the contents of \fIcolumn\fR changes,
52 \fBovsdb\-server\fR also adds and drops connection methods accordingly.
53 .IP
54 If \fIcolumn\fR's type is string or set of strings, then the
55 connection methods are taken directly from the column.  The connection
56 methods in the column must have one of the forms described above.
57 .IP
58 If \fIcolumn\fR's type is UUID or set of UUIDs and references a table,
59 then each UUID is looked up in the referenced table to obtain a row.
60 The following columns in the row, if present and of the correct type,
61 configure a connection method.  Any additional columns are ignored.
62 .RS
63 .IP "\fBtarget\fR (string)"
64 Connection method, in one of the forms described above.  This column
65 is mandatory: if it is missing or empty then no connection method can
66 be configured.
67 .IP "\fBmax_backoff\fR (integer)"
68 Maximum number of milliseconds to wait between connection attempts.
69 .IP "\fBinactivity_probe\fR (integer)"
70 Maximum number of milliseconds of idle time on connection to
71 client before sending an inactivity probe message.
72 .RE
73 .IP
74 It is an error for \fIcolumn\fR to have another type.
75 .RE
76 .
77 .IP
78 To connect or listen on multiple connection methods, use multiple
79 \fB\-\-remote\fR options.
80 .
81 .IP "\fB\-\-run=\fIcommand\fR]"
82 Ordinarily \fBovsdb\-server\fR runs forever, or until it is told to
83 exit (see \fBRUNTIME MANAGEMENT COMMANDS\fR below).  With this option,
84 \fBovsdb\-server\fR instead starts a shell subprocess running
85 \fIcommand\fR.  When the subprocess terminates, \fBovsdb\-server\fR
86 also exits gracefully.  If the subprocess exits normally with exit
87 code 0, then \fBovsdb\-server\fR exits with exit code 0 also;
88 otherwise, it exits with exit code 1.
89 .IP
90 This option can be useful where a database server is needed only to
91 run a single command, e.g.:
92 .B "ovsdb\-server \-\-remote=punix:socket \-\-run='ovsdb\-client dump unix:socket Open_vSwitch'"
93 .IP
94 This option is not supported on Windows platform.
95 .SS "Daemon Options"
96 .ds DD \
97 \fBovsdb\-server\fR detaches only after it starts listening on all \
98 configured remotes.
99 .so lib/daemon.man
100 .SS "Service Options"
101 .so lib/service.man
102 .SS "Logging Options"
103 .so lib/vlog.man
104 .SS "Syncing Options"
105 .so ovsdb/replication.man
106 .SS "Public Key Infrastructure Options"
107 The options described below for configuring the SSL public key
108 infrastructure accept a special syntax for obtaining their
109 configuration from the database.  If any of these options is given
110 \fBdb:\fIdb\fB,\fItable\fB,\fIcolumn\fR as its argument, then the
111 actual file name is read from the specified \fIcolumn\fR in \fItable\fR
112 within the \fIdb\fR database.  The \fIcolumn\fR must have type
113 string or set of strings.  The first nonempty string in the table is taken
114 as the file name.  (This means that ordinarily there should be at most
115 one row in \fItable\fR.)
116 .so lib/ssl.man
117 .so lib/ssl-bootstrap.man
118 .so lib/ssl-peer-ca-cert.man
119 .SS "Other Options"
120 .so lib/unixctl.man
121 .so lib/common.man
122 .SH "RUNTIME MANAGEMENT COMMANDS"
123 \fBovs\-appctl\fR(8) can send commands to a running
124 \fBovsdb\-server\fR process.  The currently supported commands are
125 described below.
126 .SS "OVSDB\-SERVER COMMANDS"
127 These commands are specific to \fBovsdb\-server\fR.
128 .IP "\fBexit\fR"
129 Causes \fBovsdb\-server\fR to gracefully terminate.
130 .IP "\fBovsdb\-server/compact\fR [\fIdb\fR]\&..."
131 Compacts each database \fIdb\fR in-place.  If no \fIdb\fR is
132 specified, compacts every database in-place.  A database is also
133 compacted automatically when a transaction is logged if it is over 4
134 times as large as its previous compacted size (and at least 10 MB),
135 but not before 100 commits have been added or 10 minutes have elapsed
136 since the last compaction.
137 .
138 .IP "\fBovsdb\-server/reconnect\fR"
139 Makes \fBovsdb\-server\fR drop all of the JSON\-RPC
140 connections to database clients and reconnect.
141 .IP
142 This command might be useful for debugging issues with database
143 clients.
144 .
145 .IP "\fBovsdb\-server/add\-remote \fIremote\fR"
146 Adds a remote, as if \fB\-\-remote=\fIremote\fR had been specified on
147 the \fBovsdb\-server\fR command line.  (If \fIremote\fR is already a
148 remote, this command succeeds without changing the configuration.)
149 .
150 .IP "\fBovsdb\-server/remove\-remote \fIremote\fR"
151 Removes the specified \fIremote\fR from the configuration, failing
152 with an error if \fIremote\fR is not configured as a remote.  This
153 command only works with remotes that were named on \fB\-\-remote\fR or
154 \fBovsdb\-server/add\-remote\fR, that is, it will not remove remotes
155 added indirectly because they were read from the database by
156 configuring a \fBdb:\fIdb\fB,\fItable\fB,\fIcolumn\fR remote.
157 (You can remove a database source with \fBovsdb\-server/remove\-remote
158 \fBdb:\fIdb\fB,\fItable\fB,\fIcolumn\fR, but not individual
159 remotes found indirectly through the database.)
160 .
161 .IP "\fBovsdb\-server/list\-remotes"
162 Outputs a list of the currently configured remotes named on
163 \fB\-\-remote\fR or \fBovsdb\-server/add\-remote\fR, that is, it does
164 not list remotes added indirectly because they were read from the
165 database by configuring a
166 \fBdb:\fIdb\fB,\fItable\fB,\fIcolumn\fR remote.
167 .
168 .IP "\fBovsdb\-server/add\-db \fIdatabase\fR"
169 Adds the \fIdatabase\fR to the running \fBovsdb\-server\fR.  The database
170 file must already have been created and initialized using, for example,
171 \fBovsdb\-tool create\fR.
172 .
173 .IP "\fBovsdb\-server/remove\-db \fIdatabase\fR"
174 Removes \fIdatabase\fR from the running \fBovsdb\-server\fR.  \fIdatabase\fR
175 must be a database name as listed by \fBovsdb-server/list\-dbs\fR.
176 .IP
177 If a remote has been configured that points to the specified
178 \fIdatabase\fR (e.g. \fB\-\-remote=db:\fIdatabase\fB,\fR... on the
179 command line), then it will be disabled until another database with
180 the same name is added again (with \fBovsdb\-server/add\-db\fR).
181 .IP
182 Any public key infrastructure options specified through this database
183 (e.g. \fB\-\-private\-key=db:\fIdatabase,\fR... on the command line)
184 will be disabled until another database with the same name is added
185 again (with \fBovsdb\-server/add\-db\fR).
186 .
187 .IP "\fBovsdb\-server/list\-dbs"
188 Outputs a list of the currently configured databases added either through
189 the command line or through the \fBovsdb\-server/add\-db\fR command.
190 .
191 .IP "\fBovsdb\-server/set\-remote\-ovsdb\-server \fIserver"
192 Sets  the remote \fIserver\fR from which \fBovsdb\-server\fR connects through
193 \fBovsdb\-server/connect\-remote\-ovsdb\-server\fR.
194 .
195 .IP "\fBovsdb\-server/get\-remote\-ovsdb\-server"
196 Gets the remote server from which \fBovsdb\-server\fR is currently synchronizing
197 its databases.
198 .
199 .IP "\fBovsdb\-server/connect\-remote\-ovsdb\-server"
200 Causes \fBovsdb\-server\fR to synchronize its databases with the server
201 specified by \fBovsdb\-server/set\-remote\-ovsdb\-server\fR.
202 .
203 .IP "\fBovsdb\-server/disconnect\-remote\-ovsdb\-server"
204 Causes \fBovsdb\-server\fR to  stop  synchronizing  its  databases with a remote server.
205 .
206 .IP "\fBovsdb\-server/set\-sync\-excluded\-tables \fIdb\fB:\fItable\fR[\fB,\fIdb\fB:\fItable\fR]..."
207 Sets the \fItable\fR whitin \fIdb\fR that will be excluded from synchronization.
208 .
209 .IP "\fBovsdb\-server/get\-sync\-excluded\-tables"
210 Gets  the  tables  that are currently excluded from synchronization.
211 .
212 .so lib/vlog-unixctl.man
213 .so lib/memory-unixctl.man
214 .so lib/coverage-unixctl.man
215 .SH "SPECIFICATIONS"
216 .
217 .PP
218 \fBovsdb\-server\fR implements the Open vSwitch Database (OVSDB)
219 protocol specified in RFC 7047, with the following clarifications:
220 .
221 .IP "3.1. JSON Usage"
222 RFC 4627 says that names within a JSON object should be unique.
223 The Open vSwitch JSON parser discards all but the last value
224 for a name that is specified more than once.
225 .
226 .IP
227 The definition of <error> allows for implementation extensions.
228 Currently \fBovsdb\-server\fR uses the following additional "error"
229 strings which might change in later releases):
230 .
231 .RS
232 .IP "\fBsyntax error\fR or \fBunknown column\fR"
233 The request could not be parsed as an OVSDB request.  An additional
234 "syntax" member, whose value is a string that contains JSON, may
235 narrow down the particular syntax that could not be parsed.
236 .IP "\fBinternal error\fR"
237 The request triggered a bug in \fBovsdb\-server\fR.
238 .IP "\fBovsdb error\fR"
239 A map or set contains a duplicate key.
240 .RE
241 .
242 .IP "3.2. Schema Format"
243 RFC 7047 requires the "version" field in <database-schema>.  Current
244 versions of \fBovsdb\-server\fR allow it to be omitted (future
245 versions are likely to require it).
246 .IP
247 RFC 7047 allows columns that contain weak references to be immutable.
248 This raises the issue of the behavior of the weak reference when the
249 rows that it references are deleted.  Since version 2.6,
250 \fBovsdb\-server\fR forces columns that contain weak references to be
251 mutable.
252 .
253 .IP "4. Wire Protocol"
254 The original OVSDB specifications included the following reason,
255 omitted from RFC 7047, to operate JSON-RPC directly over a stream
256 instead of over HTTP:
257 .
258 .RS
259 .IP \(bu
260 JSON-RPC is a peer-to-peer protocol, but HTTP is a client-server
261 protocol, which is a poor match.  Thus, JSON-RPC over HTTP requires
262 the client to periodically poll the server to receive server requests.
263 .IP \(bu
264 HTTP is more complicated than stream connections and doesn't provide
265 any corresponding advantage.
266 .IP \(bu
267 The JSON-RPC specification for HTTP transport is incomplete.
268 .RE
269 .
270 .IP "4.1.5. Monitor"
271 For backward compatibility, \fBovsdb\-server\fR currently permits a
272 single <monitor-request> to be used instead of an array; it is treated
273 as a single-element array.  Future versions of \fBovsdb\-server\fR
274 might remove this compatibility feature.
275 .IP
276 Because the <json-value> parameter is used to match subsequent update
277 notifications (see below) to the request, it must be unique among all
278 active monitors.  \fBovsdb\-server\fR rejects attempt to create two
279 monitors with the same identifier.
280 .
281 .IP "4.1.12. Monitor_cond"
282 A new monitor method added in Open vSwitch version 2.6. The monitor_cond
283 request enables a client to replicate subsets of tables within an OVSDB
284 database by requesting notifications of changes to rows matching one of
285 the conditions specified in "where" by receiving the specified contents
286 of these rows when table updates occur. Monitor_cond also allows a more
287 efficient update notifications by receiving table-updates2 notifications
288 (described below).
289 .
290 .IP
291 The monitor method described in Section 4.1.5 also applies to monitor_cond,
292 with the following exceptions:
293 .
294 .RS
295 .IP \(bu
296 RPC request method becomes "monitor_cond".
297 .IP \(bu
298 Reply result follows <table-updates2>, described in Section 4.1.14.
299 .IP \(bu
300 Subsequent changes are sent to the client using the "update2" monitor
301 notification, described in Section 4.1.14
302 .IP \(bu
303 Update notifications are being sent only for rows matching [<condition>*].
304 .RE
305 .
306 .IP
307 The request object has the following members:
308 .
309 .PP
310 .RS
311 .nf
312 "method": "monitor_cond"
313 "params": [<db-name>, <json-value>, <monitor-cond-requests>]
314 "id": <nonnull-json-value>
315 .fi
316 .RE
317 .
318 .IP
319 The <json-value> parameter is used to match subsequent update notifications
320 (see below) to this request. The <monitor-cond-requests> object maps the name
321 of the table to an array of <monitor-cond-request>.
322 .
323 .IP
324 Each <monitor-cond-request> is an object with the following members:
325 .
326 .PP
327 .RS
328 .nf
329 "columns": [<column>*]            optional
330 "where": [<condition>*]           optional
331 "select": <monitor-select>        optional
332 .fi
333 .RE
334 .
335 .IP
336 The "columns", if present, define the columns within the table to be monitored
337 that match conditions. If not present all columns are being monitored.
338 .
339 .IP
340 The "where" if present is a JSON array of <condition> and boolean values. If not
341 present or condition is an empty array, implicit True will be considered and
342 updates on all rows will be sent.
343 .
344 .IP
345 <monitor-select> is an object with the following members:
346 .
347 .PP
348 .RS
349 .nf
350 "initial": <boolean>              optional
351 "insert": <boolean>               optional
352 "delete": <boolean>               optional
353 "modify": <boolean>               optional
354 .fi
355 .RE
356 .
357 .IP
358 The contents of this object specify how the columns or table are to be
359 monitored as explained in more detail below.
360 .
361 .IP
362 The response object has the following members:
363 .
364 .PP
365 .RS
366 .nf
367 "result": <table-updates2>
368 "error": null
369 "id": same "id" as request
370 .fi
371 .RE
372 .
373 .IP
374 The <table-updates2> object is described in detail in Section 4.1.14. It
375 contains the contents of the tables for which "initial" rows are selected.
376 If no tables initial contents are requested, then "result" is an empty object.
377 .
378 .IP
379 Subsequently, when changes to a specified table that match one of the conditions
380 in monitor-cond-request are committed, the changes are automatically sent to the
381 client using the "update2" monitor notification (see Section 4.1.14). This
382 monitoring persists until the JSON-RPC session terminates or until the client
383 sends a "monitor_cancel" JSON-RPC request.
384 .
385 .IP
386 Each <monitor-cond-request> specifies one or more conditions and the manner in
387 which the rows that match the conditions are to be monitored. The circumstances in
388 which an "update" notification is sent for a row within the table are determined by
389 <monitor-select>:
390 .
391 .RS
392 .IP \(bu
393 If "initial" is omitted or true, every row in the original table that matches one of
394 the conditions is sent as part of the response to the "monitor_cond" request.
395 .IP \(bu
396 If "insert" is omitted or true, "update" notifications are sent for rows newly
397 inserted into the table that match conditions or for rows modified in the table
398 so that their old version does not match the condition and new version does.
399 .IP \(bu
400 If "delete" is omitted or true, "update" notifications are sent for rows deleted
401 from the table that match conditions or for rows modified in the table so that
402 their old version does match the conditions and new version does not.
403 .IP \(bu
404 If "modify" is omitted or true, "update" notifications are sent whenever a row in
405 the table that matches conditions in both old and new version is modified.
406 .RE
407 .
408 .IP
409 Both monitor and monitor_cond sessions can exist concurrently. However,
410 monitor and monitor_cond shares the same <json-value> parameter space; it
411 must be unique among all monitor and monitor_cond sessions.
412 .
413 .IP "4.1.13. Monitor_cond_change"
414 The "monitor_cond_change" request enables a client to change an existing
415 "monitor_cond" replication of the database by specifying a new condition
416 and columns for each replicated table. Currently changing the columns set
417 is not supported.
418 .
419 .IP
420 The request object has the following members:
421 .
422 .IP
423 .RS
424 .nf
425 "method": "monitor_cond_change"
426 "params": [<json-value>, <json-value>, <monitor-cond-update-requests>]
427 "id": <nonnull-json-value>
428 .fi
429 .RE
430 .
431 .IP
432 The <json-value> parameter should have a value of an existing conditional
433 monitoring session from this client. The second <json-value> in params array
434 is the requested value for this session. This value is valid only after
435 "monitor_cond_change" is committed. A user can use these values to distinguish
436 between update messages before conditions update and after. The
437 <monitor-cond-update-requests> object maps the name of the table to an array of
438 <monitor-cond-update-request>.
439 .
440 .IP
441 Each <monitor-cond-update-request> is an object with the following members:
442 .
443 .IP
444 .RS
445 .nf
446 "columns": [<column>*]         optional
447 "where": [<condition>*]        optional
448 .fi
449 .RE
450 .
451 .IP
452 The "columns" specify a new array of columns to be monitored
453 (Currently unsupported).
454 .
455 .IP
456 The "where" specify a new array of conditions to be applied to this monitoring
457 session.
458 .
459 .IP
460 The response object has the following members:
461 .
462 .IP
463 .RS
464 .nf
465 "result": null
466 "error": null
467 "id": same "id" as request
468 .fi
469 .RE
470 .IP
471 Subsequent <table-updates2> notifications are described in detail in Section
472 4.1.14 in the RFC. If insert contents are requested by original monitor_cond
473 request, <table-updates2> will contain rows that match the new condition and
474 do not match the old condition.
475 If deleted contents are requested by origin monitor request, <table-updates2>
476 will contain any matched rows by old condition and not matched by the new
477 condition.
478 .
479 .IP
480 Changes according to the new conditions are automatically sent to the client
481 using the "update2" monitor notification. An update, if any, as a result of a
482 condition change, will be sent to the client before the reply to the
483 "monitor_cond_change" request.
484 .
485 .IP "4.1.14. Update2 notification"
486 The "update2" notification is sent by the server to the client to report
487 changes in tables that are being monitored following a "monitor_cond" request
488 as described above. The notification has the following members:
489 .
490 .RS
491 .nf
492 "method": "update2"
493 "params": [<json-value>, <table-updates2>]
494 "id": null
495 .fi
496 .RE
497 .
498 .IP
499 The <json-value> in "params" is the same as the value passed as the
500 <json-value>  in "params" for the corresponding "monitor" request.
501 <table-updates2> is an object that maps from a table name to a <table-update2>.
502 A <table-update2> is an object that maps from row's UUID to a <row-update2>
503 object. A <row-update2> is an object with one of the following members:
504 .
505 .RS
506 .IP "\(dqinitial\(dq: <row>"
507 present for "initial" updates
508 .IP "\(dqinsert\(dq: <row>"
509 present for "insert" updates
510 .IP "\(dqdelete\(dq: <row>"
511 present for "delete" updates
512 .IP "\(dqmodify\(dq: <row>"
513 present for "modify" updates
514 .RE
515 .
516 .IP
517 The format of <row> is described in Section 5.1.
518 .
519 .IP
520 <row> is always a null object for a "delete" update. In "initial" and
521 "insert" updates, <row> omits columns whose values equal the default
522 value of the column type.
523 .
524 .IP
525 For a "modify" update, <row> contains only the columns that are modified.
526 <row> stores the difference between the old and new value for those columns,
527 as described below.
528 .
529 .IP
530 For columns with single value, the difference is the value of the new
531 column.
532 .
533 .IP
534 The difference between two sets are all elements that only belong
535 to one of the sets.
536 .
537 .IP
538 The difference between two maps are all key-value pairs whose keys
539 appears in only one of the maps, plus the key-value pairs whose keys
540 appear in both maps but with different values.  For the latter
541 elements, <row> includes the value from the new column.
542 .
543 .IP
544 Initial views of rows are not presented in update2 notifications,
545 but in the response object to the monitor_cond request. The formatting
546 of the <table-updates2> object, however, is the same in either case.
547 .
548 .IP "5.1. Notation"
549 For <condition>, RFC 7047 only allows the use of \fB!=\fR, \fB==\fR,
550 \fBincludes\fR, and \fBexcludes\fR operators with set types.  Open
551 vSwitch 2.4 and later extend <condition> to allow the use of \fB<\fR,
552 \fB<=\fR, \fB>=\fR, and \fB>\fR operators with columns with type ``set
553 of 0 or 1 integer'' and ``set of 0 or 1 real''.  These conditions
554 evaluate to false when the column is empty, and otherwise as described
555 in RFC 7047 for integer and real types.
556 .
557 .IP
558 <condition> is specified in Section 5.1 in the RFC with the following change:
559 A condition can be either a 3-element JSON array as described in the RFC or a
560 boolean value. In case of an empty array an implicit true boolean value will be
561 considered.
562 .
563 .SH "BUGS"
564 .
565 In Open vSwitch before version 2.4, when \fBovsdb\-server\fR sent
566 JSON-RPC error responses to some requests, it incorrectly formulated
567 them with the \fBresult\fR and \fBerror\fR swapped, so that the
568 response appeared to indicate success (with a nonsensical result)
569 rather than an error.  The requests that suffered from this problem
570 were:
571 .
572 .IP \fBtransact\fR
573 .IQ \fBget_schema\fR
574 Only if the request names a nonexistent database.
575 .IP \fBmonitor\fR
576 .IQ \fBlock\fR
577 .IQ \fBunlock\fR
578 In all error cases.
579 .
580 .PP
581 Of these cases, the only error that a well-written application is
582 likely to encounter in practice is \fBmonitor\fR of tables or columns
583 that do not exist, in an situation where the application has been
584 upgraded but the old database schema is still temporarily in use.  To
585 handle this situation gracefully, we recommend that clients should
586 treat a \fBmonitor\fR response with a \fBresult\fR that contains an
587 \fBerror\fR key-value pair as an error (assuming that the database
588 being monitored does not contain a table named \fBerror\fR).
589 .
590 .SH "SEE ALSO"
591 .
592 .BR ovsdb\-tool (1).