When it is invoked in the most ordinary way, ovn-nbctl
connects
to an OVSDB server that hosts the northbound database, retrieves
a partial copy of the database that is complete enough to do its
work, sends a transaction request to the server, and receives and
processes the server's reply. In common interactive use, this is
fine, but if the database is large, the step in which ovn-nbctl
retrieves a partial copy of the database can take a long time,
which yields poor performance overall.
To improve performance in such a case, ovn-nbctl
offers a "daemon
mode," in which the user first starts ovn-nbctl
running in the
background and afterward uses the daemon to execute operations.
Over several ovn-nbctl
command invocations, this performs better
overall because it retrieves a copy of the database only once at
the beginning, not once per program run.
Use the --detach
option to start an ovn-nbctl
daemon. With this
option, ovn-nbctl
prints the name of a control socket to stdout.
The client should save this name in environment variable
OVN_NB_DAEMON
. Under the Bourne shell this might be done like
this:
export OVN_NB_DAEMON=$(ovn-nbctl --pidfile --detach)
When OVN_NB_DAEMON
is set, ovn-nbctl
automatically and
transparently uses the daemon to execute its commands.
When the daemon is no longer needed, kill it and unset the
environment variable, e.g.:
kill $(cat /var/run/ovn-nbctl.pid)
unset OVN_NB_DAEMON
Daemon mode is experimental.
Daemon Commands
Daemon mode is internally implemented using the same mechanism
used by ovs-appctl
. One may also use ovs-appctl
directly with the
following commands:
run
[options] command [arg...] [--
[options] command
[arg...] ...]
Instructs the daemon process to run one or more
ovn-nbctl
commands described above and reply with
the results of running these commands. Accepts the
--no-wait
, --wait
, --timeout
, --dry-run
, --oneline
,
and the options described under Table Formatting
Options
in addition to the the command-specific
options.
exit
Causes ovn-nbctl
to gracefully terminate.