[ovs-dev] [PATCH ovn] OVN container scripts: Support for cluster mode

amginwal at gmail.com amginwal at gmail.com
Wed Jan 8 01:32:23 UTC 2020


From: Aliasgar Ginwala <aginwala at ebay.com>

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 at ebay.com>
---
 Documentation/intro/install/general.rst | 34 +++++++++++++++++-
 utilities/docker/start-ovn              | 46 +++++++++++++++++++++++--
 2 files changed, 77 insertions(+), 3 deletions(-)

diff --git a/Documentation/intro/install/general.rst b/Documentation/intro/install/general.rst
index 52bfd7d18..4df1a5538 100644
--- a/Documentation/intro/install/general.rst
+++ b/Documentation/intro/install/general.rst
@@ -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 \
@@ -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.
 
diff --git a/utilities/docker/start-ovn b/utilities/docker/start-ovn
index fbdd2af91..51e5162c5 100755
--- a/utilities/docker/start-ovn
+++ b/utilities/docker/start-ovn
@@ -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
@@ -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
\ No newline at end of file
-- 
2.20.1 (Apple Git-117)



More information about the dev mailing list