ovsdb-server(1)

NAME
ovsdb-server - Open vSwitch database server

SYNOPSIS
ovsdb-server [database]... [--remote=remote]... [--run=command]

Active-backup options:
    [--sync-from=server] [--sync-exclude-tables=db:table[,db:table]...] [--active]

DESCRIPTION
The ovsdb-server program provides RPC interfaces to one or more Open vSwitch databases (OVSDBs). It supports JSON-RPC client connections over active or passive TCP/IP or Unix domain sockets. For an introduction to OVSDB and its implementation in Open vSwitch, see ovsdb(7).

Each OVSDB file may be specified on the command line as database. If none is specified, the default is @DBDIR@/conf.db. The database files must already have been created and initialized using, for example, ovsdb-tool's create, create-cluster, or join-cluster command.

This OVSDB implementation supports standalone, active-backup, and clustered database service models, as well as database replication. See the Service Models section of ovsdb(7) for more information.

For clustered databases, when the --detach option is used, ovsdb-server detaches without waiting for the server to successfully join a cluster (if the database file is freshly created with ovsdb-tool join-cluster) or connect to a cluster that it has already joined. Use ovsdb-client wait (see ovsdb-client(1)) to wait until the server has successfully joined and connected to a cluster.

In addition to user-specified databases, ovsdb-server version 2.9 and later also always hosts a built-in database named _Server. Please see ovsdb-server(5) for documentation on this database's schema.

OPTIONS

--remote=remote
    Adds remote as a connection method used by ovsdb-server. The remote may be an OVSDB active or passive connection method, e.g. pssl:6640, as described in ovsdb(7). The following additional form is also supported:

    db:db,table,column
        Reads additional connection methods from column in all of the rows in table within db. As the contents of column changes, ovsdb-server also adds and drops connection methods accordingly.

        If column's type is string or set of strings, then the connection methods are taken directly from the column. The connection methods in the column must have one of the forms described above.

        If column's type is UUID or set of UUIDs and references a table, then each UUID is looked up in the referenced table to obtain a row. The following columns in the row, if present and of the correct type, configure a connection method. Any additional columns are ignored.

        target (string)
            Connection method, in one of the forms described above. This column is mandatory: if it is missing or empty then no connection method can be configured.

        max_backoff (integer)
            Maximum number of milliseconds to wait between connection attempts.

        inactivity_probe (integer)
            Maximum number of milliseconds of idle time on connection to client before sending an inactivity probe message.

        read_only (boolean)
            If true, only read-only transactions are allowed on this connection.

        It is an error for column to have another type.

    To connect or listen on multiple connection methods, use multiple --remote options.

--run=command]
    Ordinarily ovsdb-server runs forever, or until it is told to exit (see RUNTIME MANAGEMENT COMMANDS below). With this option, ovsdb-server instead starts a shell subprocess running command. When the subprocess terminates, ovsdb-server also exits gracefully. If the subprocess exits normally with exit code 0, then ovsdb-server exits with exit code 0 also; otherwise, it exits with exit code 1.

    This option can be useful where a database server is needed only to run a single command, e.g.: ovsdb-server --remote=punix:socket --run='ovsdb-client dump unix:socket Open_vSwitch'

    This option is not supported on Windows platform.

  Daemon Options

  Service Options

  Logging Options

  Active-Backup Options
These options support the ovsdb-server active-backup service model and database replication. These options apply only to databases in the format used for standalone and active-backup databases, which is the database format created by ovsdb-tool create. By default, when it serves a database in this format, ovsdb-server runs as a standalone server. These options can configure it for active-backup use:

•   Use --sync-from=server to start the server in the backup role, replicating data from server. When ovsdb-server is running as a backup server, it rejects all transactions that can modify the database content, including lock commands. The same form can be used to configure the local database as a replica of server.

•   Use --sync-from=server --active to start the server in the active role, but prepared to switch to the backup role in which it would replicate data from server. When ovsdb-server runs in active mode, it allows all transactions, including those that modify the database.

At runtime, management commands can change a server's role and otherwise manage active-backup features. See Active-Backup Commands, below, for more information.

--sync-from=server
    Sets up ovsdb-server to synchronize its databases with the databases in server, which must be an active connection method in one of the forms documented in ovsdb-client(1). Every transaction committed by server will be replicated to ovsdb-server. This option makes ovsdb-server start as a backup server; add --active to make it start as an active server.

--sync-exclude-tables=db:table[,db:table]...
    Causes the specified tables to be excluded from replication.

--active
    By default, --sync-from makes ovsdb-server start up as a backup for server. With --active, however, ovsdb-server starts as an active server. Use this option to allow the syncing options to be specified using command line options, yet start the server, as the default, active server. To switch the running server to backup mode, use ovs-appctl(1) to execute the ovsdb-server/connect-active-ovsdb-server command.

  Public Key Infrastructure Options
The options described below for configuring the SSL public key infrastructure accept a special syntax for obtaining their configuration from the database. If any of these options is given db:db,table,column as its argument, then the actual file name is read from the specified column in table within the db database. The column must have type string or set of strings. The first nonempty string in the table is taken as the file name. (This means that ordinarily there should be at most one row in table.)

  SSL Connection Options

  Other Options

RUNTIME MANAGEMENT COMMANDS
ovs-appctl(8) can send commands to a running ovsdb-server process. The currently supported commands are described below.

  ovsdb-server Commands
These commands are specific to ovsdb-server.

exit
    Causes ovsdb-server to gracefully terminate.

ovsdb-server/compact [db]
    Compacts database db in-place. If db is not specified, compacts every database in-place. A database is also compacted automatically when a transaction is logged if it is over 2 times as large as its previous compacted size (and at least 10 MB), but not before 100 commits have been added or 10 minutes have elapsed since the last compaction. It will also be compacted automatically after 24 hours since the last compaction if 100 commits were added regardless of its size.

ovsdb-server/memory-trim-on-compaction on|off
    If this option is on, ovsdb-server will try to reclaim all unused heap memory back to the system after each successful database compaction to reduce the memory consumption of the process. off by default.

ovsdb-server/reconnect
    Makes ovsdb-server drop all of the JSON-RPC connections to database clients and reconnect.

    This command might be useful for debugging issues with database clients.

ovsdb-server/add-remote remote
    Adds a remote, as if --remote=remote had been specified on the ovsdb-server command line. (If remote is already a remote, this command succeeds without changing the configuration.)

ovsdb-server/remove-remote remote
    Removes the specified remote from the configuration, failing with an error if remote is not configured as a remote. This command only works with remotes that were named on --remote or ovsdb-server/add-remote, that is, it will not remove remotes added indirectly because they were read from the database by configuring a db:db,table,column remote. (You can remove a database source with ovsdb-server/remove-remote db:db,table,column, but not individual remotes found indirectly through the database.)

ovsdb-server/list-remotes
    Outputs a list of the currently configured remotes named on --remote or ovsdb-server/add-remote, that is, it does not list remotes added indirectly because they were read from the database by configuring a db:db,table,column remote.

ovsdb-server/add-db database
    Adds the database to the running ovsdb-server. The database file must already have been created and initialized using, for example, ovsdb-tool create.

ovsdb-server/remove-db database
    Removes database from the running ovsdb-server. database must be a database name as listed by ovsdb-server/list-dbs.

    If a remote has been configured that points to the specified database (e.g. --remote=db:database,... on the command line), then it will be disabled until another database with the same name is added again (with ovsdb-server/add-db).

    Any public key infrastructure options specified through this database (e.g. --private-key=db:database,... on the command line) will be disabled until another database with the same name is added again (with ovsdb-server/add-db).

ovsdb-server/list-dbs
    Outputs a list of the currently configured databases added either through the command line or through the ovsdb-server/add-db command.

  Active-Backup Commands

These commands query and update the role of ovsdb-server within an active-backup pair of servers. See Active-Backup Options, above, and Active-Backup Database Service Model in ovsdb(7) for more information.

ovsdb-server/set-active-ovsdb-server server
    Sets the active server from which ovsdb-server connects through ovsdb-server/connect-active-ovsdb-server. This overrides the --sync-from command-line option.

ovsdb-server/get-active-ovsdb-server
    Gets the active server from which ovsdb-server is currently synchronizing its databases.

ovsdb-server/connect-active-ovsdb-server
    Switches the server to a backup role. The server starts synchronizing its databases with the active server specified by ovsdb-server/set-active-ovsdb-server (or the --sync-from command-line option) and closes all existing client connections, which requires clients to reconnect.

ovsdb-server/disconnect-active-ovsdb-server
    Switches the server to an active role. The server stops synchronizing its databases with an active server and closes all existing client connections, which requires clients to reconnect.

ovsdb-server/set-active-ovsdb-server-probe-interval probe interval
    Sets the probe interval (in milli seconds) for the connection to active server.

ovsdb-server/set-sync-exclude-tables db:table[,db:table]...
    Sets the table within db that will be excluded from synchronization. This overrides the --sync-exclude-tables command-line option.

ovsdb-server/get-sync-exclude-tables
    Gets the tables that are currently excluded from synchronization.

ovsdb-server/sync-status
    Prints a summary of replication run time information. The state information is always provided, indicating whether the server is running in the active or the backup mode. When running in backup mode, replication connection status, which can be either connecting, replicating or error, are shown. When the connection is in replicating state, further output shows the list of databases currently replicating, and the tables that are excluded.

  Cluster Commands
These commands support the ovsdb-server clustered service model. They apply only to databases in the format used for clustered databases, which is the database format created by ovsdb-tool create-cluster and ovsdb-tool join-cluster.

cluster/cid db
    Prints the cluster ID for db, which is a UUID that identifies the cluster. If db is a database newly created by ovsdb-tool cluster-join that has not yet successfully joined its cluster, and --cid was not specified on the cluster-join command line, then this command will report an error because the cluster ID is not yet known.

cluster/sid db
    Prints the server ID for db, which is a UUID that identifies this server within the cluster.

cluster/status db
    Prints this server's status within the cluster and the status of its connections to other servers in the cluster.

cluster/leave db
    This command starts the server gracefully removing itself from its cluster. At least one server must remain, and the cluster must be healthy, that is, over half of the cluster's servers must be up.

    When the server successfully leaves the cluster, it stops serving db, as if ovsdb-server/remove-db db had been executed.

    Use ovsdb-client wait (see ovsdb-client(1)) to wait until the server has left the cluster.

    Once a server leaves a cluster, it may never rejoin it. Instead, create a new server and join it to the cluster.

    Note that removing the server from the cluster alters the total size of the cluster. For example, if you remove two servers from a three server cluster, then the "cluster" becomes a single functioning server. This does not result in a three server cluster that lacks quorum.

cluster/kick db server
    Start graceful removal of server from db's cluster, like cluster/leave (without --force) except that it can remove any server, not just this one.

    server may be a server ID, as printed by cluster/sid, or the server's local network address as passed to ovsdb-tool's create-cluster or join-cluster command. Use cluster/status to see a list of cluster members.

cluster/change-election-timer db time
    Change the leader election timeout base value of the cluster, in milliseconds.

    Leader election will be initiated by a follower if there is no heartbeat received from the leader within this time plus a random time within 1 second.

    The default value is 1000, if not changed with this command. This command can be used to adjust the value when necessary, according to the expected load and response time of the servers.

    This command must be executed on the leader. It initiates the change to the cluster. To see if the change takes effect (committed), use cluster/status to show the current setting. Once a change is committed, it persists at server restarts.

cluster/set-backlog-threshold db n_msgs n_bytes
    Sets the backlog limits for db's RAFT connections to a maximum of n_msgs messages or n_bytes bytes. If the backlog on one of the connections reaches the limit, it will be disconnected (and re-established). Values are checked only if the backlog contains more than 50 messages.

BUGS
In Open vSwitch before version 2.4, when ovsdb-server sent JSON-RPC error responses to some requests, it incorrectly formulated them with the result and error swapped, so that the response appeared to indicate success (with a nonsensical result) rather than an error. The requests that suffered from this problem were:

transact
    Only if the request names a nonexistent database.

monitor
    In all error cases.

Of these cases, the only error that a well-written application is likely to encounter in practice is monitor of tables or columns that do not exist, in an situation where the application has been upgraded but the old database schema is still temporarily in use. To handle this situation gracefully, we recommend that clients should treat a monitor response with a result that contains an error key-value pair as an error (assuming that the database being monitored does not contain a table named error).

SEE ALSO
ovsdb(7), ovsdb-tool(1), ovsdb-server(5), ovsdb-server(7).