]> git.proxmox.com Git - mirror_ovs.git/blame - ovsdb/ovsdb-client.1.in
ovn-nbctl: Fix the ovn-nbctl test "LBs - daemon" which fails during rpm build
[mirror_ovs.git] / ovsdb / ovsdb-client.1.in
CommitLineData
d0632593 1.\" -*- nroff -*-
9bccc3ff 2.so lib/ovs.tmac
d2cb6c95 3.TH ovsdb\-client 1 "@VERSION@" "Open vSwitch" "Open vSwitch Manual"
812560d7 4.\" This program's name:
d0632593
BP
5.ds PN ovsdb\-client
6.
7.SH NAME
8ovsdb\-client \- command-line interface to \fBovsdb-server\fR(1)
9.
10.SH SYNOPSIS
12b84d50 11.IP "Server-Level Commands:"
d0c43b59 12\fBovsdb\-client\fR [\fIoptions\fR] \fBlist\-dbs\fR [\fIserver\fR]
12b84d50 13.IP "Database Schema Commands:"
d0c43b59 14\fBovsdb\-client\fR [\fIoptions\fR] \fBget\-schema\fR [\fIserver\fR] [\fIdatabase\fR]
d0632593 15.br
d0c43b59 16\fBovsdb\-client\fR [\fIoptions\fR] \fBlist\-tables\fR [\fIserver\fR] [\fIdatabase\fR]
9cb53f26 17.br
d0c43b59 18\fBovsdb\-client\fR [\fIoptions\fR] \fBlist\-columns\fR [\fIserver\fR] [\fIdatabase\fR] [\fItable\fR]
12b84d50 19.IP "Database Version Management Commands:"
53178986
BP
20\fBovsdb\-client \fR[\fIoptions\fR] \fBconvert \fR[\fIserver\fR] \fIschema\fR
21.br
22\fBovsdb\-client \fR[\fIoptions\fR] \fBneeds\-conversion \fR[\fIserver\fR] \fIschema\fR
d0632593 23.br
d0c43b59 24\fBovsdb\-client\fR [\fIoptions\fR] \fBget\-schema\-version\fR [\fIserver\fR] [\fIdatabase\fR]
12b84d50 25.IP "Data Management Commands:"
d0c43b59 26\fBovsdb\-client\fR [\fIoptions\fR] \fBtransact\fR [\fIserver\fR] \fItransaction\fR
6d65eee8 27.br
d0c43b59 28\fBovsdb\-client\fR [\fIoptions\fR] \fBquery\fR [\fIserver\fR] \fItransaction\fR
838f9c31 29.br
d0c43b59 30\fBovsdb\-client\fR [\fIoptions\fR] \fBdump\fR [\fIserver\fR] [\fIdatabase\fR] [\fItable\fR
b30aa413 31[\fIcolumn\fR...]]
25c269ef 32.br
d0c43b59
JP
33\fBovsdb\-client\fR [\fIoptions\fR]
34\fBbackup\fR [\fIserver\fR] [\fIdatabase\fR] \fB> \fIsnapshot\fR
fe0fb885 35.br
d0c43b59
JP
36\fBovsdb\-client\fR [\fIoptions\fR] [\fB\-\-force\fR]
37\fBrestore\fR [\fIserver\fR] [\fIdatabase\fR] \fB< \fIsnapshot\fR
4d0a31b6 38.br
d0c43b59 39\fBovsdb\-client\fR [\fIoptions\fR] \fBmonitor\fR [\fIserver\fR] [\fIdatabase\fR] \fItable\fR
20aa445d 40[\fIcolumn\fR[\fB,\fIcolumn\fR]...]...
a8425c53 41.br
d0c43b59 42\fBovsdb\-client\fR [\fIoptions\fR] \fBmonitor\fR [\fIserver\fR] [\fIdatabase\fR] \fBALL\fR
4227b221 43.br
d0c43b59 44\fBovsdb\-client\fR [\fIoptions\fR] \fBmonitor\-cond\fR [\fIserver\fR] [\fIdatabase\fR] \fIconditions
c383f3bf 45\fItable\fR [\fIcolumn\fR[\fB,\fIcolumn\fR]...]...
1b1d2e6d
BP
46.br
47\fBovsdb\-client \fR[\fIoptions\fR] \fBwait\fR \fR[\fIserver\fR] \fIdatabase\fR \fIstate\fR
12b84d50 48.IP "Testing Commands:"
d0c43b59 49\fBovsdb\-client\fR [\fIoptions\fR] \fBlock\fR [\fIserver\fR] \fIlock\fR
9aeba3f4 50.br
d0c43b59 51\fBovsdb\-client\fR [\fIoptions\fR] \fBsteal\fR [\fIserver\fR] \fIlock\fR
9aeba3f4 52.br
d0c43b59 53\fBovsdb\-client\fR [\fIoptions\fR] \fBunlock\fR [\fIserver\fR] \fIlock\fR
9aeba3f4 54.br
12b84d50 55.IP "Other Commands:"
d0632593 56\fBovsdb\-client help\fR
1b1d2e6d
BP
57.IP "Cluster Options:"
58[\fB\-\-no\-leader\-only\fR]
d0632593 59.IP "Output formatting options:"
4e312e69 60[\fB\-\-format=\fIformat\fR]
c2158145 61[\fB\-\-data=\fIformat\fR]
3b4d80ef 62[\fB\-\-no-headings\fR]
c2158145
BP
63[\fB\-\-pretty\fR]
64[\fB\-\-bare\fR]
8f46c9bb 65[\fB\-\-timestamp\fR]
3f262d7d 66.so lib/daemon-syn.man
d0632593 67.so lib/vlog-syn.man
9467fe62
BP
68.so lib/ssl-syn.man
69.so lib/ssl-bootstrap-syn.man
e18a1d08 70.so lib/ssl-connect-syn.man
d0632593
BP
71.so lib/common-syn.man
72.
73.SH DESCRIPTION
74The \fBovsdb\-client\fR program is a command-line client for
53ffefe9 75interacting with a running \fBovsdb\-server\fR process.
12b84d50
BP
76Each command connects to the specified OVSDB \fIserver\fR, which may
77be an OVSDB active or passive connection method, as described in
78\fBovsdb\fR(7). The default server is \fBunix:@RUNDIR@/db.sock\fR
79and
80the default \fIdatabase\fR is \fBOpen_vSwitch\fR.
53ffefe9 81.PP
1b1d2e6d
BP
82\fBovsdb\-client\fR supports the
83\fImethod1\fB,\fImethod2\fB,\fR...\fB,\fImethodN\fR syntax described
84in \fBovsdb\fR(7) for connecting to a cluster. When this syntax is
85used, \fBovsdb\-client\fR tries the cluster members in random order
86until it finds the cluster leader. Specify the
87\fB\-\-no\-leader\-only\fR option to instead accept any server that is
88connected to the cluster.
89.PP
12b84d50
BP
90For an introduction to OVSDB and its implementation in Open vSwitch,
91see \fBovsdb\fR(7).
92.PP
93The following sections describe the commands that \fBovsdb\-client\fR
94supports.
95.SS "Server-Level Commands"
96Most \fBovsdb\-client\fR commands work with an individual database,
97but these commands apply to an entire database server.
d0632593 98.
d0c43b59 99.IP "\fBlist\-dbs\fR [\fIserver\fR]"
9cb53f26 100Connects to \fIserver\fR, retrieves the list of known databases, and
12b84d50
BP
101prints them one per line. These database names are the ones that
102other commands may use for \fIdatabase\fR.
103.
104.SS "Database Schema Commands"
105.PP
106These commands obtain the schema from a database and print it or part
107of it.
9cb53f26 108.
d0c43b59 109.IP "\fBget\-schema\fR [\fIserver\fR] [\fIdatabase\fR]"
9cb53f26
BP
110Connects to \fIserver\fR, retrieves the schema for \fIdatabase\fR, and
111prints it in JSON format.
d0632593 112.
d0c43b59 113.IP "\fBlist\-tables\fR [\fIserver\fR] [\fIdatabase\fR]"
9cb53f26 114Connects to \fIserver\fR, retrieves the schema for \fIdatabase\fR, and
2e57b537 115prints a table listing the name of each table
9cb53f26 116within the database.
d0632593 117.
d0c43b59 118.IP "\fBlist\-columns\fR [\fIserver\fR] [\fIdatabase\fR] \fItable\fR"
9cb53f26 119Connects to \fIserver\fR, retrieves the schema for \fIdatabase\fR, and
2e57b537 120prints a table listing the name and type of each
9cb53f26
BP
121column. If \fItable\fR is specified, only columns in that table are
122listed; otherwise, the tables include columns in all tables.
a8425c53 123.
12b84d50
BP
124.SS "Database Version Management Commands"
125.so ovsdb/ovsdb-schemas.man
126.PP
127These commands work with different versions of OVSDB schemas and
128databases.
129.
53178986
BP
130.IP "\fBconvert \fR[\fIserver\fR] \fIschema\fR"
131Reads an OVSDB schema in JSON format, as specified in the OVSDB
132specification, from \fIschema\fR, then connects to \fIserver\fR and
133requests the server to convert the database whose name is specified in
134\fIschema\fR to the schema also specified in \fIschema\fR.
135.IP
136The conversion is atomic, consistent, isolated, and durable.
137Following the schema change, the server notifies clients that use the
138\fBset_db_change_aware\fR RPC introduced in Open vSwitch 2.9 and
139cancels their outstanding transactions and monitors. The server
140disconnects other clients, enabling them to notice the change when
141they reconnect.
142.IP
143This command can do simple ``upgrades'' and ``downgrades'' on a
144database's schema. The data in the database must be valid when
145interpreted under \fIschema\fR, with only one exception: data for
146tables and columns that do not exist in \fIschema\fR are ignored.
147Columns that exist in \fIschema\fR but not in the database are set to
148their default values. All of \fIschema\fR's constraints apply in
149full.
150.IP
151Some uses of this command can cause unrecoverable data loss. For
152example, converting a database from a schema that has a given column
153or table to one that does not will delete all data in that column or
154table. Back up critical databases before converting them.
155.IP
156This command works with clustered and standalone databases.
157Standalone databases may also be converted (offline) with
158\fBovsdb\-tool\fR's \fBconvert\fR command.
159.
160.IP "\fBneeds\-conversion \fR[\fIserver\fR] \fIschema\fR"
161Reads the schema from \fIschema\fR, then connects to \fIserver\fR and
162requests the schema from the database whose name is specified in
163\fIschema\fR. If the two schemas are the same, prints \fBno\fR on
164stdout; if they differ, prints \fByes\fR.
165.
166.IP "\fBget\-schema\-version \fR[\fIserver\fR] [\fIdatabase\fR]"
12b84d50
BP
167Connects to \fIserver\fR, retrieves the schema for \fIdatabase\fR, and
168prints its version number on stdout.
169If \fIdatabase\fR was created before schema versioning was introduced,
170then it will not have a version number and this command will print a
171blank line.
172.
d0c43b59 173.IP "\fBget\-schema\-cksum\fR [\fIserver\fR] [\fIdatabase\fR]"
12b84d50
BP
174Connects to \fIserver\fR, retrieves the schema for \fIdatabase\fR, and
175prints its checksum on stdout. If \fIdatabase\fR does not include a
176checksum, prints a blank line.
177.
178.SS "Data Management Commands"
179.PP
180These commands read or modify the data in a database.
181.
d0c43b59 182.IP "\fBtransact\fR [\fIserver\fR] \fItransaction\fR"
6d65eee8 183Connects to \fIserver\fR, sends it the specified \fItransaction\fR,
12b84d50
BP
184which must be a JSON array appropriate for use as the \fBparams\fR to
185a JSON-RPC \fBtransact\fR request, and prints the received reply on
186stdout.
a8425c53 187.
d0c43b59 188.IP "\fBquery\fR [\fIserver\fR] \fItransaction\fR"
838f9c31
BP
189This commands acts like a read-only version of \fBtransact\fR.
190It connects to \fIserver\fR, sends it the specified \fItransaction\fR,
191which must be a JSON array appropriate for use as the \fBparams\fR to
192a JSON-RPC \fBtransact\fR request, and prints the received reply on
193stdout. To ensure that the transaction does not modify the database,
194this command appends an \fBabort\fR operation to the set of operations
195included in \fItransaction\fR before sending it to the database, and
196then removes the \fBabort\fR result from the reply (if it is present).
197.
d0c43b59 198.IP "\fBdump\fR [\fIserver\fR] [\fIdatabase\fR] [\fItable\fR [\fIcolumn\fR...]]"
25c269ef 199Connects to \fIserver\fR, retrieves all of the data in \fIdatabase\fR,
b30aa413
BV
200and prints it on stdout as a series of tables. If \fItable\fR is
201specified, only that table is retrieved. If at least one \fIcolumn\fR
202is specified, only those columns are retrieved.
25c269ef 203.
d0c43b59 204.IP "\fBbackup\fR [\fIserver\fR] [\fIdatabase\fR] \fB> \fIsnapshot\fR"
4d0a31b6
BP
205Connects to \fIserver\fR, retrieves a snapshot of the schema and data
206in \fIdatabase\fR, and prints it on stdout in the format used for
1b1d2e6d 207OVSDB standalone and active-backup databases. This is an appropriate
4d0a31b6
BP
208way to back up any remote database. The database snapshot that it
209outputs is suitable to be served up directly by \fBovsdb\-server\fR or
210used as the input to \fBovsdb\-client restore\fR.
211.IP
1b1d2e6d 212Another way to back up a standalone or active-backup database is to
4d0a31b6
BP
213copy its database file, e.g. with \fBcp\fR. This is safe even if the
214database is in use.
215.IP
216The output does not include ephemeral columns, which by design do not
217survive across restarts of \fBovsdb\-server\fR.
218.
d0c43b59 219.IP "[\fB\-\-force\fR] \fBrestore\fR [\fIserver\fR] [\fIdatabase\fR] \fB< \fIsnapshot\fR"
fe0fb885
BP
220Reads \fIsnapshot\fR, which must be a OVSDB standalone or
221active-backup database (possibly but not necessarily created by
222\fBovsdb\-client backup). Then, connects to \fIserver\fR, verifies
223that \fIdatabase\fR and \fIsnapshot\fR have the same schema, then
224deletes all of the data in \fIdatabase\fR and replaces it by
225\fIsnapshot\fR. The replacement happens atomically, in a single
226transaction.
227.IP
228UUIDs for rows in the restored database will differ from those in
229\fIsnapshot\fR, because the OVSDB protocol does not allow clients to
1b1d2e6d
BP
230specify row UUIDs. Another way to restore a standalone or active-backup
231database, which does also restore row UUIDs, is to stop
fe0fb885
BP
232the server or servers, replace the database file by the snapshot, then
233restart the database. Either way, ephemeral columns are not restored,
234since by design they do not survive across restarts of
235\fBovsdb\-server\fR.
236.IP
237Normally \fBrestore\fR exits with a failure if \fBsnapshot\fR and the
238server's database have different schemas. In such a case, it is a
239good idea to convert the database to the new schema before restoring,
240e.g. with \fBovsdb\-client convert\fR. Use \fB\-\-force\fR to proceed
241regardless of schema differences even though the restore might fail
242with an error or succeed with surprising results.
243.
d0c43b59
JP
244.IP "\fBmonitor\fR [\fIserver\fR] [\fIdatabase\fR] \fItable\fR [\fIcolumn\fR[\fB,\fIcolumn\fR]...]..."
245.IQ "\fBmonitor\-cond\fR [\fIserver\fR] [\fIdatabase\fR] \fIconditions\fR \fItable\fR [\fIcolumn\fR[\fB,\fIcolumn\fR]...]..."
c383f3bf
LS
246Connects to \fIserver\fR and monitors the contents of rows that match conditions in
247\fItable\fR in \fIdatabase\fR. By default, the initial contents of \fItable\fR are
248printed, followed by each change as it occurs. If conditions empty,
249all rows will be monitored. If at least one \fIcolumn\fR is specified, only those
250columns are monitored. The following \fIcolumn\fR names have special meanings:
a8425c53 251.RS
20aa445d
BP
252.IP "\fB!initial\fR"
253Do not print the initial contents of the specified columns.
254.IP "\fB!insert\fR"
255Do not print newly inserted rows.
256.IP "\fB!delete\fR"
257Do not print deleted rows.
258.IP "\fB!modify\fR"
259Do not print modifications to existing rows.
a8425c53 260.RE
3f262d7d 261.IP
20aa445d
BP
262Multiple [\fIcolumn\fR[\fB,\fIcolumn\fR]...] groups may be specified
263as separate arguments, e.g. to apply different reporting parameters to
264each group. Whether multiple groups or only a single group is
265specified, any given column may only be mentioned once on the command
266line.
267.IP
c383f3bf
LS
268\fBconditions\fR is a JSON array of <condition> as defined in RFC 7047 5.1
269with the following change: A condition can be either a 3-element JSON array
270as deescribed in the RFC or a boolean value..
271.IP
12b84d50 272If \fB\-\-detach\fR is used with \fBmonitor\fR or \fBmonitor\-cond\fR, then
85226894
AZ
273\fBovsdb\-client\fR detaches after it has successfully received and
274printed the initial contents of \fItable\fR.
275.IP
276The \fBmonitor\fR command uses RFC 7047 "monitor" method to open a monitor
12b84d50 277session with the server. The \fBmonitor\-cond\fR command uses RFC 7047
c383f3bf 278extension "monitor_cond" method. See \fBovsdb\-server\fR(1) for details.
4227b221
BP
279.IP "\fBmonitor\fI \fR[\fIserver\fR] \fR[\fIdatabase\fR] \fBALL\fR"
280Connects to \fIserver\fR and monitors the contents of all tables in
281\fIdatabase\fR. Prints initial values and all kinds of changes to all
282columns in the database. The \fB\-\-detach\fR option causes
283\fBovsdb\-client\fR to detach after it successfully receives and
284prints the initial database contents.
85226894
AZ
285.IP
286The \fBmonitor\fR command uses RFC 7047 "monitor" method to open a monitor
c383f3bf 287session with the server.
4227b221 288.
1b1d2e6d
BP
289.IP "\fBwait\fR \fR[\fIserver\fR] \fIdatabase state\fR"
290Waits for \fIdatabase\fR on \fIserver\fR to enter a desired \fIstate\fR,
291which may be one of:
292.RS
293.IP "\fBadded\fR"
294Waits until a database with the given name has been added to
295\fIserver\fR.
296.IP "\fBconnected\fR"
297Waits until a database with the given name has been added to
298\fIserver\fR. Then, if \fIdatabase\fR is clustered, additionally
299waits until it has joined and connected to its cluster.
300.IP "\fBremoved\fR"
301Waits until \fIdatabase\fR has been removed from the database server.
302This can also be used to wait for a database to complete leaving its
303cluster, because \fBovsdb\-server\fR removes a database at that point.
304.RE
305.IP
306\fIdatabase\fR is mandatory for this command because it is often used
307to check for databases that have not yet been added to the server, so
308that the \fBovsdb\-client\fR semantics of acting on a default database
309do not work.
310.IP
311This command acts on a particular database server, not on a cluster,
312so \fIserver\fR must name a single server, not a comma-delimited list
313of servers.
12b84d50
BP
314.SS "Testing commands"
315These commands are mostly of interest for testing the correctness
9aeba3f4
AZ
316of the OVSDB server.
317.
d0c43b59
JP
318.IP "\fBlock\fR [\fIserver\fR] \fIlock\fR"
319.IQ "\fBsteal\fR [\fIserver\fR] \fIlock\fR"
320.IQ "\fBunlock\fR [\fIserver\fR] \fIlock\fR"
9aeba3f4
AZ
321Connects to \fIserver\fR and issues corresponding RFC 7047 lock operations
322on \fIlock\fR. Prints json reply or subsequent update messages.
323The \fB\-\-detach\fR option causes \fBovsdb\-client\fR to detach after it
324successfully receives and prints the initial reply.
325.IP
326When running with the \fB\-\-detach\fR option, \fBlock\fR, \fBsteal\fR,
327\fBunlock\fR and \fBexit\fR commands can be issued by using
328\fBovs-appctl\fR. \fBexit\fR command causes the \fBovsdb\-client\fR to
329close its \fBovsdb\-server\fR connection before exit.
330The \fBlock\fR, \fBsteal\fR and \fBunlock\fR commands can be used to
331issue additional lock operations over the same \fBovsdb\-server\fR connection. All above commands take a single \fIlock\fR argument, which does not have
332to be the same as the \fIlock\fR that \fBovsdb\-client\fR started with.
333.
d0632593
BP
334.SH OPTIONS
335.SS "Output Formatting Options"
336Much of the output from \fBovsdb\-client\fR is in the form of tables.
337The following options controlling output formatting:
338.
c6a41252 339.ds TD (default)
3a3eb9da 340.so lib/table.man
b87fde85 341.
8f46c9bb 342.IP "\fB\-\-timestamp\fR"
12b84d50 343For the \fBmonitor\fR and \fBmonitor\-cond\fR commands, add a timestamp to each
85226894 344table update. Most output formats add the timestamp on a line of its own
8f46c9bb
BP
345just above the table. The JSON output format puts the timestamp in a
346member of the top-level JSON object named \fBtime\fR.
347.
c55d0b7b
BP
348.IP "\fB\-t\fR"
349.IQ "\fB\-\-timeout=\fIsecs\fR"
350Limits \fBovsdb\-client\fR runtime to approximately \fIsecs\fR
351seconds. If the timeout expires, \fBovsdb\-client\fR will exit with a
352\fBSIGALRM\fR signal.
353.
3f262d7d 354.SS "Daemon Options"
12b84d50 355The daemon options apply only to the \fBmonitor\fR and \fBmonitor\-cond\fR commands.
85226894 356With any other command, they have no effect.
58f870d0 357.ds DD
3f262d7d
BP
358.so lib/daemon.man
359.SS "Logging Options"
360.so lib/vlog.man
ac300505 361.SS "Public Key Infrastructure Options"
9467fe62
BP
362.so lib/ssl.man
363.so lib/ssl-bootstrap.man
e18a1d08
ER
364.SS "SSL Connection Options"
365.so lib/ssl-connect.man
d0632593
BP
366.SS "Other Options"
367.so lib/common.man
368.SH "SEE ALSO"
369.
12b84d50 370\fBovsdb\fR(7),
d0632593 371\fBovsdb\-server\fR(1),
12b84d50 372\fBovsdb\-client\fR(1).