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