summaryrefslogtreecommitdiffstats
path: root/installation
diff options
context:
space:
mode:
authorTrevor Tait <rtait@amdocs.com>2018-03-28 15:22:52 -0400
committerTrevor Tait <rtait@amdocs.com>2018-03-29 15:15:39 -0400
commit602dd09ecb56eb4c37428fa35a5a0d6be3215574 (patch)
tree096c57dbea32ea5770aeb68e18444e2de2d88712 /installation
parent40977671839b780b64c2526ce6f4edadf2f44883 (diff)
SDN-C Geo Config clustering
Change-Id: I87ec947aac9df9afb6ef0f308f9626da3d835715 Signed-off-by: Trevor Tait <rtait@amdocs.com> Issue-ID: SDNC-214 Former-commit-id: fb0364efc775685a534f711096253f73640434c3
Diffstat (limited to 'installation')
-rwxr-xr-xinstallation/sdnc/src/main/scripts/configure_geo_cluster.sh192
-rwxr-xr-xinstallation/sdnc/src/main/scripts/sdnc.cluster4
-rwxr-xr-x[-rw-r--r--]installation/sdnc/src/main/scripts/startODL.sh35
3 files changed, 221 insertions, 10 deletions
diff --git a/installation/sdnc/src/main/scripts/configure_geo_cluster.sh b/installation/sdnc/src/main/scripts/configure_geo_cluster.sh
new file mode 100755
index 00000000..5fbe0530
--- /dev/null
+++ b/installation/sdnc/src/main/scripts/configure_geo_cluster.sh
@@ -0,0 +1,192 @@
+#!/bin/bash
+
+if [ $# -ne 3 ]; then
+ echo "Usage: configure_geo_cluster.sh <member_index{1..6}> <primary_node> <secondary_node>"
+ exit 1
+fi
+
+MEMBER_INDEX=$1
+PRIMARY_NODE=$2
+SECONDARY_NODE=$3
+CONF_DIR=/opt/opendaylight/current/configuration/initial
+AKKACONF=${CONF_DIR}/akka.conf
+MODULESCONF=${CONF_DIR}/modules.conf
+MODULESHARDSCONF=${CONF_DIR}/module-shards.conf
+MY_IP=$(hostname -i)
+CLUSTER_MASTER=$PRIMARY_NODE
+PORT_NUMBER=1
+
+case $MEMBER_INDEX in
+[1])
+ PORT_NUMBER=4
+ ;;
+[2])
+ PORT_NUMBER=5
+ ;;
+[3])
+ PORT_NUMBER=6
+ ;;
+[4])
+ PORT_NUMBER=4
+ CLUSTER_MASTER=$SECONDARY_NODE
+ ;;
+[5])
+ PORT_NUMBER=5
+ CLUSTER_MASTER=$SECONDARY_NODE
+ ;;
+[6])
+ PORT_NUMBER=6
+ CLUSTER_MASTER=$SECONDARY_NODE
+ ;;
+*)
+ echo "Usage: configure_geo_cluster.sh <primary_node{1..6}> <secondary_node>"
+ exit 1
+ ;;
+esac
+
+cat > $MODULESCONF << 'endModules'
+modules = [
+
+ {
+ name = "inventory"
+ namespace = "urn:opendaylight:inventory"
+ shard-strategy = "module"
+ },
+ {
+ name = "topology"
+ namespace = "urn:TBD:params:xml:ns:yang:network-topology"
+ shard-strategy = "module"
+ },
+ {
+ name = "toaster"
+ namespace = "http://netconfcentral.org/ns/toaster"
+ shard-strategy = "module"
+ }
+]
+endModules
+
+cat > $MODULESHARDSCONF << 'moduleShards'
+module-shards = [
+ {
+ name = "default"
+ shards = [
+ {
+ name = "default"
+ replicas = ["member-1",
+ "member-2",
+ "member-3",
+ "member-4",
+ "member-5",
+ "member-6"]
+ }
+ ]
+ },
+ {
+ name = "inventory"
+ shards = [
+ {
+ name="inventory"
+ replicas = ["member-1",
+ "member-2",
+ "member-3",
+ "member-4",
+ "member-5",
+ "member-6"]
+ }
+ ]
+ },
+ {
+ name = "topology"
+ shards = [
+ {
+ name="topology"
+ replicas = ["member-1",
+ "member-2",
+ "member-3",
+ "member-4",
+ "member-5",
+ "member-6"]
+ }
+ ]
+ },
+ {
+ name = "toaster"
+ shards = [
+ {
+ name="toaster"
+ replicas = ["member-1",
+ "member-2",
+ "member-3",
+ "member-4",
+ "member-5",
+ "member-6"]
+ }
+ ]
+ }
+]
+moduleShards
+
+cat > $AKKACONF << 'akkaFile'
+
+odl-cluster-data {
+ akka {
+ remote {
+ artery {
+ enabled = off
+ canonical.hostname = CLUSTER_MASTER
+ canonical.port = 3026PORT_NUMBER
+ }
+ netty.tcp {
+ bind-hostname = MY_IP
+ bind-port = 2550
+
+ hostname = CLUSTER_MASTER
+ port = 3026PORT_NUMBER
+ }
+ # when under load we might trip a false positive on the failure detector
+ # transport-failure-detector {
+ # heartbeat-interval = 4 s
+ # acceptable-heartbeat-pause = 16s
+ # }
+ }
+
+ cluster {
+ # Remove ".tcp" when using artery.
+ seed-nodes = ["akka.tcp://opendaylight-cluster-data@PRIMARY_NODE:30264",
+ "akka.tcp://opendaylight-cluster-data@PRIMARY_NODE:30265",
+ "akka.tcp://opendaylight-cluster-data@PRIMARY_NODE:30266",
+ "akka.tcp://opendaylight-cluster-data@SECONDARY_NODE:30264",
+ "akka.tcp://opendaylight-cluster-data@SECONDARY_NODE:30265",
+ "akka.tcp://opendaylight-cluster-data@SECONDARY_NODE:30266"]
+
+ roles = ["member-MEMBER_INDEX"]
+
+ }
+
+ persistence {
+ # By default the snapshots/journal directories live in KARAF_HOME. You can choose to put it somewhere else by
+ # modifying the following two properties. The directory location specified may be a relative or absolute path.
+ # The relative path is always relative to KARAF_HOME.
+
+ # snapshot-store.local.dir = "target/snapshots"
+ # journal.leveldb.dir = "target/journal"
+
+ journal {
+ leveldb {
+ # Set native = off to use a Java-only implementation of leveldb.
+ # Note that the Java-only version is not currently considered by Akka to be production quality.
+
+ # native = off
+ }
+ }
+ }
+ }
+}
+akkaFile
+sed -i "s/CLUSTER_MASTER/${CLUSTER_MASTER}/" $AKKACONF
+sed -i "s/PORT_NUMBER/${PORT_NUMBER}/" $AKKACONF
+sed -i "s/MY_IP/${MY_IP}/" $AKKACONF
+sed -i "s/PRIMARY_NODE/${PRIMARY_NODE}/" $AKKACONF
+sed -i "s/SECONDARY_NODE/${SECONDARY_NODE}/" $AKKACONF
+sed -i "s/MEMBER_INDEX/${MEMBER_INDEX}/" $AKKACONF
+cat $AKKACONF
diff --git a/installation/sdnc/src/main/scripts/sdnc.cluster b/installation/sdnc/src/main/scripts/sdnc.cluster
index 35b60728..4f565ed3 100755
--- a/installation/sdnc/src/main/scripts/sdnc.cluster
+++ b/installation/sdnc/src/main/scripts/sdnc.cluster
@@ -25,12 +25,12 @@ esac
for pod_number in {0..2}
do
- curl "http://localhost:3028$((${pod_number} + 1))" > /dev/null 2>&1
+ curl "http://localhost:3026$((${pod_number} + 1))" > /dev/null 2>&1
if [ "$?" = "7" ]; then
continue
fi
- VOTING_RESULT=`curl -u admin:admin -H "Content-Type: application/json" -H "Accept: application/json" -X GET http://localhost:3028$((${pod_number} + 1))/jolokia/read/org.opendaylight.controller:Category=Shards,name=member-$((${MEMBER_NUMBER} + ${pod_number}))-shard-default-config,type=DistributedConfigDatastore 2>/dev/null | jq '.value.Voting'`
+ VOTING_RESULT=`curl -u admin:admin -H "Content-Type: application/json" -H "Accept: application/json" -X GET http://localhost:3026$((${pod_number} + 1))/jolokia/read/org.opendaylight.controller:Category=Shards,name=member-$((${MEMBER_NUMBER} + ${pod_number}))-shard-default-config,type=DistributedConfigDatastore 2>/dev/null | jq '.value.Voting'`
case $VOTING_RESULT in
true)
diff --git a/installation/sdnc/src/main/scripts/startODL.sh b/installation/sdnc/src/main/scripts/startODL.sh
index 6f35ad30..e2c0fa1c 100644..100755
--- a/installation/sdnc/src/main/scripts/startODL.sh
+++ b/installation/sdnc/src/main/scripts/startODL.sh
@@ -28,8 +28,8 @@ function enable_odl_cluster(){
fi
echo "Installing Opendaylight cluster features"
- ${ODL_HOME}/bin/client feature:install odl-mdsal-clustering
- ${ODL_HOME}/bin/client feature:install odl-jolokia
+ ${ODL_HOME}/bin/client feature:install odl-mdsal-clustering
+ ${ODL_HOME}/bin/client feature:install odl-jolokia
echo "Update cluster information statically"
hm=$(hostname)
@@ -38,14 +38,31 @@ function enable_odl_cluster(){
node=($(echo ${hm} | tr '-' '\n'))
node_name=${node[0]}
node_index=${node[1]}
- node_list="${node_name}-0.sdnhost-cluster.onap-sdnc.svc.cluster.local";
- for ((i=1;i<${SDNC_REPLICAS};i++));
- do
- node_list="${node_list} ${node_name}-$i.sdnhost-cluster.onap-sdnc.svc.cluster.local"
- done
+ if [ -z $PEER_ODL_CLUSTER ]; then
+ echo "This is a local cluster"
+ node_list="${node_name}-0.sdnhost-cluster.onap.svc.cluster.local";
- /opt/opendaylight/current/bin/configure_cluster.sh $((node_index+1)) ${node_list}
+ for ((i=1;i<${SDNC_REPLICAS};i++));
+ do
+ node_list="${node_list} ${node_name}-$i.sdnhost-cluster.onap.svc.cluster.local"
+ done
+ /opt/opendaylight/current/bin/configure_cluster.sh $((node_index+1)) ${node_list}
+ else
+ echo "This is a Geo cluster"
+
+ if $IS_PRIMARY_CLUSTER; then
+ PRIMARY_NODE=${MY_ODL_CLUSTER}
+ SECONDARY_NODE=${PEER_ODL_CLUSTER}
+ else
+ PRIMARY_NODE=${PEER_ODL_CLUSTER}
+ SECONDARY_NODE=${MY_ODL_CLUSTER}
+ member_offset=4
+ fi
+
+ node_list="${PRIMARY_NODE} ${SECONDARY_NODE}"
+ /opt/onap/sdnc/bin/configure_geo_cluster.sh $((node_index+member_offset)) ${node_list}
+ fi
}
@@ -57,6 +74,8 @@ SDNC_HOME=${SDNC_HOME:-/opt/onap/sdnc}
SLEEP_TIME=${SLEEP_TIME:-120}
MYSQL_PASSWD=${MYSQL_PASSWD:-openECOMP1.0}
ENABLE_ODL_CLUSTER=${ENABLE_ODL_CLUSTER:-false}
+IS_PRIMARY_CLUSTER=${IS_PRIMARY_CLUSTER:-false}
+MY_ODL_CLUSTER=${MY_ODL_CLUSTER:-127.0.0.1}
#
# Wait for database