Skip to content

Commit

Permalink
OVN container scripts: Support for cluster mode
Browse files Browse the repository at this point in the history
1. Container scripts for starting ovn central node
   containers in HA using cluster mode
2. Update documentation about the same.

Signed-off-by: Aliasgar Ginwala <aginwala@ebay.com>
Signed-off-by: 0-day Robot <robot@bytheb.org>
  • Loading branch information
noah8713 authored and ovsrobot committed Jan 8, 2020
1 parent c80e014 commit 4ecb096
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 3 deletions.
34 changes: 33 additions & 1 deletion Documentation/intro/install/general.rst
Expand Up @@ -449,6 +449,38 @@ Start OVN containers using below command::
$ docker run -itd --net=host --name=ovn-northd \
<docker_repo>:<tag> ovn-northd-tcp

Start OVN containers in cluster mode for a 3 node cluster using below command
on node1::

$ docker run -e "host_ip=<host_ip>" -e "nb_db_port=<port>" -itd \
--name=ovn-nb-raft --net=host --privileged <docker_repo>:<tag> \
ovn-nb-cluster-create

$ docker run -e "host_ip=<host_ip>" -e "sb_db_port=<port>" -itd \
--name=ovn-sb-raft --net=host --privileged <docker_repo>:<tag> \
ovn-sb-cluster-create

$ docker run -e "OVN_NB_DB=tcp:<node1>:6641,tcp:<node2>:6641,\
tcp:<node3>:6641" -e "OVN_SB_DB=tcp:<node1>:6642,tcp:<node2>:6642,\
tcp:<node3>:6642" -itd --name=ovn-northd-raft <docker_repo>:<tag> \
ovn-northd-cluster

Start OVN containers in cluster mode using below command on node2 and node3 \
to make them join the peer using below command::

$ docker run -e "host_ip=<host_ip>" -e "remote_host=<remote_host_ip>" \
-e "nb_db_port=<port>" -itd --name=ovn-nb-raft --net=host \
--privileged <docker_repo>:<tag> ovn-nb-cluster-join

$ docker run -e "host_ip=<host_ip>" -e "remote_host=<remote_host_ip>" \
-e "sb_db_port=<port>" -itd --name=ovn-sb-raft --net=host \
--privileged <docker_repo>:<tag> ovn-sb-cluster-join

$ docker run -e "OVN_NB_DB=tcp:<node1>:6641,tcp:<node2>:6641,\
tcp:<node3>:6641" -e "OVN_SB_DB=tcp:<node1>:6642,tcp:<node2>:6642,\
tcp:<node3>:6642" -itd --name=ovn-northd-raft <docker_repo>:<tag> \
ovn-northd-cluster

Start OVN containers using unix socket::

$ docker run -itd --net=host --name=ovn-nb \
Expand All @@ -465,7 +497,7 @@ Start OVN containers using unix socket::

.. note::
Current ovn central components comes up in docker image in a standalone
mode with protocol tcp.
and cluster mode with protocol tcp.

The debian docker file use ubuntu 16.04 as a base image for reference.

Expand Down
46 changes: 44 additions & 2 deletions utilities/docker/start-ovn
Expand Up @@ -22,12 +22,34 @@ case $1 in
--ovnsb-db="unix:/var/run/ovn/ovnsb_db.sock" \
--log-file=/var/log/ovn/ovn-northd.log
;;
"ovn-northd-cluster") ovn-northd --pidfile \
--ovnnb-db=$OVN_NB_DB \
--ovnsb-db=$OVN_SB_DB \
--log-file=/var/log/ovn/ovn-northd.log
;;
"ovn-nb-tcp") source /etc/ovn/ovn_default_nb_port
/usr/share/ovn/scripts/ovn-ctl start_ovsdb
ovn-nbctl set-connection ptcp:$nb_db_port
/usr/share/ovn/scripts/ovn-ctl stop_ovsdb
/usr/share/ovn/scripts/ovn-ctl run_nb_ovsdb
;;
"ovn-nb-cluster-create") /usr/share/ovn/scripts/ovn-ctl \
--db-nb-addr=$host_ip \
--db-nb-cluster-local-addr=$host_ip \
start_nb_ovsdb
ovn-nbctl set-connection ptcp:$nb_db_port
/usr/share/ovn/scripts/ovn-ctl stop_nb_ovsdb
/usr/share/ovn/scripts/ovn-ctl \
--db-nb-addr=$host_ip \
--db-nb-cluster-local-addr=$host_ip \
run_nb_ovsdb
;;
"ovn-nb-cluster-join") /usr/share/ovn/scripts/ovn-ctl \
--db-nb-addr=$host_ip \
--db-nb-cluster-local-addr=$host_ip \
--db-nb-cluster-remote-addr=$remote_host \
run_nb_ovsdb
;;
"ovn-sb-tcp") source /etc/ovn/ovn_default_sb_port
/usr/share/ovn/scripts/ovn-ctl start_ovsdb
ovn-sbctl set-connection ptcp:$sb_db_port
Expand All @@ -42,8 +64,28 @@ case $1 in
--ovnsb-db="tcp:$northd_host:$sb_db_port" \
--log-file=/var/log/ovn/ovn-northd.log
;;
"ovn-sb-cluster-create") /usr/share/ovn/scripts/ovn-ctl \
--db-sb-addr=$host_ip \
--db-sb-cluster-local-addr=$host_ip \
start_sb_ovsdb
ovn-sbctl set-connection ptcp:$sb_db_port
/usr/share/ovn/scripts/ovn-ctl stop_sb_ovsdb
/usr/share/ovn/scripts/ovn-ctl \
--db-sb-addr=$host_ip \
--db-sb-cluster-local-addr=$host_ip \
run_sb_ovsdb
;;
"ovn-sb-cluster-join") /usr/share/ovn/scripts/ovn-ctl \
--db-sb-addr=$host_ip \
--db-sb-cluster-local-addr=$host_ip \
--db-sb-cluster-remote-addr=$remote_host \
run_sb_ovsdb
;;
"ovn-controller") ovn-controller --pidfile \
--log-file=/var/log/ovn/ovn-controller.log
;;
*) echo "$0 [ovn-nb-tcp|ovn-sb-tcp|ovn-northd-tcp|ovn-controller]"
esac
*) echo "$0 [ovn-nb-tcp|ovn-sb-tcp|ovn-northd-tcp|ovn-controller
|ovn-nb-cluster-create|ovn-nb-cluster-join
|ovn-sb-cluster-create|ovn-sb-cluster-join
|ovn-northd-cluster]"
esac

0 comments on commit 4ecb096

Please sign in to comment.