ovsdb-tool(1)
π ovsdb-tool π
hey bestie! β¨ this is the Open vSwitch Manual page for ovsdb-tool, section 1. it's literally the cutest little command-line tool for managing Open vSwitch database (OVSDB) files. no cap. π
πΈ NAME πΈ
ovsdb-tool β Open vSwitch database management utility
β¨ SYNOPSIS β¨
okay so here's the vibe check on how you call it:
Database Creation Commands:
ovsdb-tool [options] create [db [schema]]
ovsdb-tool [options] [--election-timer=ms] create-cluster db
contents address
ovsdb-tool [options] [--cid=uuid] join-cluster db name local
remote...
Version Management Commands:
ovsdb-tool [options] convert [db [schema [target]]]
ovsdb-tool [options] needs-conversion [db [schema]]
ovsdb-tool [options] db-version [db]
ovsdb-tool [options] schema-version [schema]
ovsdb-tool [options] db-cksum [db]
ovsdb-tool [options] schema-cksum [schema]
ovsdb-tool [options] compare-versions a op b
Other commands:
ovsdb-tool [options] compact [db [target]]
ovsdb-tool [options] [--rbac-role=role] query [db] transaction
ovsdb-tool [options] [--rbac-role=role] transact [db] transaction
ovsdb-tool [options] [-m | --more]... show-log [db]
ovsdb-tool [options] check-cluster db...
ovsdb-tool [options] db-name [db]
ovsdb-tool [options] schema-name [schema]
ovsdb-tool [options] db-cid db
ovsdb-tool [options] db-sid db
ovsdb-tool [options] db-local-address db
ovsdb-tool help
Logging options:
[-v[module[:destination[:level]]]]...
[--verbose[=module[:destination[:level]]]]...
[--log-file[=file]]
Common options:
[-h | --help] [-V | --version]
β¨ DESCRIPTION β¨
okay so ovsdb-tool is literally a command-line tool for managing Open vSwitch database (OVSDB) files. π
it does not interact directly with running Open vSwitch database servers β for that, you use ovsdb-client. (not me explaining the whole ecosystem, but if you want an intro to OVSDB and how Open vSwitch implements it, check out ovsdb(7).) π¦
Every command that takes an optional db or schema argument has a default file location if you don't specify one. the default db is /etc/openvswitch/conf.db. the default schema is /usr/share/openvswitch/vswitch.ovsschema. (yes, they have defaults, periodt.) π
This OVSDB implementation supports standalone and active-backup database service models with one on-disk format, and a clustered database service model with a different format. ovsdb-tool supports both formats, but some commands are only appropriate for one format, as documented for individual commands below. for the spec on these formats, see ovsdb(5). for more info on OVSDB service models, see the Service Models section in ovsdb(7). β¨
π Database Creation Commands π
okay so these commands create a brand new OVSDB database file. they will not overwrite an existing database file. if you want to replace an existing database with a new one, you gotta delete the old one first. no cap. π
create [db [schema]]
Use this command to create the database for controlling ovs-vswitchd or another standalone or active-backup database. it creates database file db with the given schema, which must be the name of a file that contains an OVSDB schema in JSON format, as specified in the OVSDB specification. the new database is initially empty. (you can use cp to copy a database including both its schema and data.) β¨
[--election-timer=ms] create-cluster db contents local
Use this command to initialize the first server in a high-availability cluster of 3 (or more) database servers, e.g. for a database in an environment that cannot tolerate a single point of failure. it creates clustered database file db and configures the server to listen on local, which must take the form protocol:ip:port, where protocol is tcp or ssl, ip is the server's IP (either an IPv4 address or an IPv6 address enclosed in square brackets), and port is a TCP port number. only one address is specified, for the first server in the cluster, ordinarily the one for the server running create-cluster. the address is used for communication within the cluster, not for communicating with OVSDB clients, and must not use the same port used for the OVSDB protocol. π₯
The new database is initialized with contents, which must name a file that contains either an OVSDB schema in JSON format or a standalone OVSDB database. if it is a schema file, the new database will initially be empty, with the given schema. if it is a database file, the new database will have the same schema and contents. π
Leader election will be initiated by a follower if there is no heartbeat received from the cluster leader within the specified election timer. the default leader election timer is 1000 milliseconds. to use a different value when creating the database, specify --election-timer=ms, where ms is a value in milliseconds between 100 and 600000 inclusive. (so like, don't go crazy with the timer, bestie.) π
[--cid=uuid] join-cluster db name local remote...
Use this command to initialize each server after the first one in an OVSDB high-availability cluster. it creates clustered database file db for a database named name, and configures the server to listen on local and to initially connect to remote, which must be a server that already belongs to the cluster. local and remote use the same protocol:ip:port syntax as create-cluster. π
The name must be the name of the schema or database passed to create-cluster. for example, the name of the OVN Southbound database schema is OVN_Southbound. use ovsdb-tool's schema-name or db-name command to find out the name of a schema or database, respectively. π
This command does not do any network access, which means that it cannot actually join the new server to the cluster. instead, the db file that it creates prepares the server to join the cluster the first time that ovsdb-server serves it. as part of joining the cluster, the new server retrieves the database schema and obtains the list of all cluster members. only after that does it become a full member of the cluster. π¦
Optionally, more than one remote may be specified; for example, in a cluster that already contains multiple servers, one could specify all the existing servers. this is beneficial if some of the existing servers are down while the new server joins, but it is not otherwise needed. β¨
By default, the db created by join-cluster will join any clustered database named name that is available at a remote. in theory, if machines go up and down and IP addresses change in the right way, it could join the wrong database cluster. to avoid this possibility, specify --cid=uuid, where uuid is the cluster ID of the cluster to join, as printed by ovsdb-tool get-cid. (so like, use the CID, bestie, don't get catfished by the wrong cluster.) π
π Database Migration Commands π
okay so these commands will convert a cluster database to a standalone database. π
cluster-to-standalone db clusterdb
Use this command to convert to standalone database from clustered database when the cluster is down and cannot be revived. it creates new standalone db file from the given cluster db file. (so like, if your cluster is giving nothing but problems, this is your rescue mission.) π
π Version Management Commands π
An OVSDB schema has a schema version number, and an OVSDB database embeds a particular version of an OVSDB schema. these version numbers take the form x.y.z, e.g. 1.2.3. the OVSDB implementation does not enforce a particular version numbering scheme, but schemas managed within the Open vSwitch project use the following approach. whenever the database schema is changed in a non-backward compatible way (e.g. deleting a column or a table), x is incremented (and y and z are reset to 0). when the database schema is changed in a backward compatible way (e.g. adding a new column), y is incremented (and z is reset to 0). when the database schema is changed cosmetically (e.g. reindenting its syntax), z is incremented. (so like, major, minor, cosmetic, got it.) π
Some OVSDB databases and schemas, especially very old ones, do not have a version number. (rip to the OGs.) π
Schema version numbers and Open vSwitch version numbers are independent. (don't mix them up, bestie.) β¨
These commands work with different versions of OVSDB schemas and databases. π₯
convert [db [schema [target]]]
Reads db, translating it into to the schema specified in schema, and writes out the new interpretation. if target is specified, the translated version is written as a new file named target, which must not already exist. if target is omitted, then the translated version of the database replaces db in-place. in-place conversion cannot take place if the database is currently being served by ovsdb-server (instead, either stop ovsdb-server first or use ovsdb-client's convert command). π
This command can do simple upgrades'' and downgrades'' on a database's schema. the data in db must be valid when interpreted under schema, with only one exception: data in db for tables and columns that do not exist in schema are ignored. columns that exist in schema but not in db are set to their default values. all of schema's constraints apply in full. π
Some uses of this command can cause unrecoverable data loss. for example, converting a database from a schema that has a given column or table to one that does not will delete all data in that column or table. back up critical databases before converting them. (not me warning you, but like, seriously. π)
This command is for standalone and active-backup databases only. for clustered databases, use ovsdb-client's convert command to convert them online. π
needs-conversion [db [schema]]
Reads the schema embedded in db and the JSON schema from schema and compares them. if the schemas are the same, prints no on stdout; if they differ, prints yes. (so like, it's a vibe check for your schema.) π
This command is for standalone and active-backup databases only. for clustered databases, use ovsdb-client's needs-conversion command instead. π¦
db-version [db] / schema-version [schema]
Prints the version number in the schema embedded within the database db or in the JSON schema schema on stdout. if schema or db was created before schema versioning was introduced, then it will not have a version number and this command will print a blank line. (so like, no version number, no problem, just a blank line.) β¨
The db-version command is for standalone and active-backup databases only. for clustered databases, use ovsdb-client's schema-version command instead. π
db-cksum [db]andschema-cksum [schema]β prints the checksum in the schema embedded inside database db, or of the JSON schema schema, on stdout. If schema or db was created before schema checksums were introduced, then it will not have a checksum and this command will print a blank line. Heads up, bestie:db-cksumis for standalone and active-backup databases only. For clustered databases, useovsdb-client'sschema-cksumcommand instead. πcompare-versions a op bβ compares a and b according to op. Both a and b must be OVSDB schema version numbers in the formx.y.z, as described inovsdb(7), and op must be one of<<===>=>!=. If the comparison is true, exits with status0; if it is false, exits with status2. Important: exit status1indicates an error, e.g. a or b is the wrong syntax for an OVSDB version or op is not a valid comparison operator. π«Ά
β¨ Other Commands β¨
compact [db [target]]β reads db and writes a compacted version. If target is specified, the compacted version is written as a new file named target, which must not already exist. If target is omitted, then the compacted version of the database replaces db in-place. This command is not needed in normal operation becauseovsdb-serverfrom time to time automatically compacts a database that grows much larger than its minimum size.
Warning, queen: this command does not work if db is currently being served byovsdb-server, or if it is otherwise locked for writing by another process. This command also does not work with clustered databases. Instead, in either case, send theovsdb-server/compactcommand toovsdb-server, viaovs-appctl). π
[--rbac-role=role] query [db] transactionβ opens db, executes transaction on it, and prints the results. The transaction must be a JSON array in the format of the params array for the JSON-RPCtransactmethod, as described in the OVSDB specification.
This command opens db for read-only access, so it may safely run concurrently with other database activity, including ovsdb-server and other database writers. The transaction may specify database modifications, but these will have no effect on db. π
By default, the transaction is executed using the superuser RBAC role. Use --rbac-role to specify a different role.
This command does not work with clustered databases. Instead, use ovsdb-client's query command to send the query to ovsdb-server. π¦
[--rbac-role=role] transact [db] transactionβ opens db, executes transaction on it, prints the results, and commits any changes to db. The transaction must be a JSON array in the format of the params array for the JSON-RPCtransactmethod, as described in the OVSDB specification.
Careful, babe: this command does not work if db is currently being served byovsdb-server, or if it is otherwise locked for writing by another process. This command also does not work with clustered databases. Instead, in either case, useovsdb-client'stransactcommand to send the query toovsdb-server.
By default, the transaction is executed using the superuser RBAC role. Use --rbac-role to specify a different role. β¨
[-m | --more]... show-log [db]β prints a summary of the records in db's log, including the time and date at which each database change occurred and any associated comment. This may be useful for debugging. π
To increase the verbosity of output, add -m (or --more) one or more times to the command line. With one -m, show-log prints a summary of the records added, deleted, or modified by each transaction. With two -ms, show-log also prints the values of the columns modified by each change to a record.
This command works with standalone and active-backup databases and with clustered databases, but the output formats are different. π
check-cluster db...β reads all of the records in the supplied databases, which must be collected from different servers (and ideally all the servers) in a single cluster. Checks each database for self-consistency and the set together for cross-consistency. Ifovsdb-tooldetects unusual but not necessarily incorrect content, it prints a warning or warnings on stdout. Ifovsdb-toolfinds consistency errors, it prints an error on stderr and exits with status1. Errors typically indicate bugs inovsdb-server; please consider reporting them to the Open vSwitch developers. π«Άdb-name [db]andschema-name [schema]β prints the name of the schema embedded within the database db or in the JSON schema schema on stdout. πdb-cid dbβ prints the cluster ID, which is a UUID that identifies the cluster, for db. If db is a database newly created byovsdb-tool cluster-jointhat has not yet successfully joined its cluster, and--cidwas not specified on thecluster-joincommand line, then this command will output an error, and exit with status2, because the cluster ID is not yet known. This command works only with clustered databases. π
The all-zeros UUID is not a valid cluster ID.
db-sid dbβ prints the server ID, which is a UUID that identifies the server, for db. This command works only with clustered databases. It works even if db is a database newly created byovsdb-tool cluster-jointhat has not yet successfully joined its cluster. πΈdb-local-address dbβ prints the local address used for database clustering for db, in the sameprotocol:ip:portform used oncreate-clusterandjoin-cluster. π¦db-is-clustered dbanddb-is-standalone dbβ tests whether db is a database file in clustered or standalone format, respectively. If so, exits with status0; if not, exits with status2. Important: exit status1indicates an error, e.g. db is not an OVSDB database or does not exist. π
π₯ OPTIONS π₯
π Logging Options π
-v[spec],--verbose=[spec]β sets logging levels. Without any spec, sets the log level for every module and destination todbg. Otherwise, spec is a list of words separated by spaces or commas or colons, up to one from each category below:- A valid module name, as displayed by the
vlog/listcommand onovs-appctl(8), limits the log level change to the specified module. syslog,console, orfile, to limit the log level change to only the system log, to the console, or to a file, respectively. (If--detachis specified,ovsdb-toolcloses its standard file descriptors, so logging to the console will have no effect.)off,emer,err,warn,info, ordbg, to control the log level. Messages of the given severity or higher will be logged, and messages of lower severity will be filtered out.offfilters out all messages. Seeovs-appctl(8)for a definition of each log level.
- A valid module name, as displayed by the
Case is not significant within spec. β¨
Regardless of the log levels set for file, logging to a file will not take place unless --log-file is also specified (see below). π«Ά
For compatibility with older versions of OVS, any is accepted as a word but has no effect.
-v,--verboseβ sets the maximum logging verbosity level, equivalent to--verbose=dbg. π-vPATTERN:destination:pattern,--verbose=PATTERN:destination:patternβ sets the log pattern for destination to pattern. Refer toovs-appctl(8)for a description of the valid syntax for pattern. π-vFACILITY:facility,--verbose=FACILITY:facilityβ sets the RFC5424 facility of the log message. facility can be one ofkern,user,mail,daemon,auth,syslog,lpr,news,uucp,clock,ftp,ntp,audit,alert,clock2,local0,local1,local2,local3,local4,local5,local6orlocal7. If this option is not specified,daemonis used as the default for the local system syslog andlocal0is used while sending a message to the target provided via the--syslog-targetoption. π--log-file[=file]β enables logging to a file. If file is specified, then it is used as the exact name for the log file. The default log file name used if file is omitted is/var/log/openvswitch/ovsdb-tool.log. π--syslog-target=host:portβ send syslog messages to UDP port on host, in addition to the system syslog. The host must be a numerical IP address, not a hostname. π--syslog-method=methodβ specify method how syslog messages should be sent to syslog daemon. Following forms are supported:libc, use libcsyslog()function. Downside of using this options is that libc adds fixed prefix to every message before it is actually sent to the syslog daemon over/dev/logUNIX domain socket.unix:file, use UNIX domain socket directly. It is possible to specify arbitrary message format with this option. However,rsyslogd 8.9and older versions use hard coded parser function anyway that limits UNIX domain socket use. If you want to use arbitrary message format with olderrsyslogdversions, then use UDP socket to localhost IP address instead.udp:ip:port, use UDP socket. With this method it is possible to use arbitrary message format also with olderrsyslogd. When sending syslog messages over UDP socket extra precaution needs to be taken into account, for example, syslog daemon needs to be configured to listen on the specified UDP port, accidentaliptablesrules could be interfering with local syslog traffic and there are some security considerations that apply to UDP sockets, but do not apply to UNIX domain sockets.null, discards all messages logged to syslog.
The default is taken from the OVS_SYSLOG_METHOD environment variable; if it is unset, the default is libc. π¦
π¦ Other Options π¦
-h,--helpβ prints a brief help message to the console. β¨-V,--versionβ prints version information to the console. π
π FILES π
ok so here's the tea on where everything lives by default, bestie π«Ά
- the default db is
/etc/openvswitch/conf.dbβ that's the database file, the main character of this whole operation π - the default schema is
/usr/share/openvswitch/vswitch.ovsschemaβ the blueprint that tells OVSDB what shape the data's supposed to be in β¨
and ngl? the help command is out here being an absolute angel π β it also displays these defaults for you. so if you ever forget them (no judgment, we've all been there π₯²), just ask help and it'll remind you. iconic behavior, fr fr.
π SEE ALSO
go read these next, i'm literally obsessed with them:
like, they're the whole friend group. this page is nothing without them π
ok that's the whole page bestie, you ate that π this one's from Open vSwitch, version 4.0.0 β shoutout to the OVS girlies for keeping the ship running, slay π
β¨ no cap, go run some ovsdb-tool commands, you've got this πΈπ¦
π¦ where this page comes from
- arch rolling: openvswitch 4.0.0-1 Β· Apache-2.0
- ubuntu stonking: openvswitch-common 4.0.0-1 Β· Apache-2.0
- Copyright (C) 2007, 2009, 2011 Free Software Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms