X-Git-Url: https://gerrit.onap.org/r/gitweb?p=ccsdk%2Fdistribution.git;a=blobdiff_plain;f=opendaylight%2Fonap-distribution%2Ffluorine%2Fkaraf%2Fsrc%2Fmain%2Fassembly%2Fbin%2Fconfigure_cluster.sh;fp=opendaylight%2Fonap-distribution%2Ffluorine%2Fkaraf%2Fsrc%2Fmain%2Fassembly%2Fbin%2Fconfigure_cluster.sh;h=c3f1a430e0cd7b58d978a31452296e4f4e85d2e5;hp=0000000000000000000000000000000000000000;hb=a41427f14b8b056640e5853f5ec61284fb23acaa;hpb=78327d7d3e648a393ce247216e99fb4d966bd79e diff --git a/opendaylight/onap-distribution/fluorine/karaf/src/main/assembly/bin/configure_cluster.sh b/opendaylight/onap-distribution/fluorine/karaf/src/main/assembly/bin/configure_cluster.sh new file mode 100755 index 00000000..c3f1a430 --- /dev/null +++ b/opendaylight/onap-distribution/fluorine/karaf/src/main/assembly/bin/configure_cluster.sh @@ -0,0 +1,228 @@ +#!/bin/bash +# +# Copyright (c) 2015 Brocade Communications Systems, Inc. and others. All rights reserved. +# +# This program and the accompanying materials are made available under the +# terms of the Eclipse Public License v1.0 which accompanies this distribution, +# and is available at http://www.eclipse.org/legal/epl-v10.html +# + + +function usage() +{ + # Print any error messages + test "$1" != "" && echo " ERROR: $1" + + # Print standard usage help + cat << EOF + This script is used to configure cluster parameters on this + controller. The user should restart controller to apply changes. + + Usage: $0 + - index: Integer within 1..N, where N is the number of seed nodes. + - seed_nodes_list: List of seed nodes, separated by comma or space. + + The address at the provided index should belong this controller. + When running this script on multiple seed nodes, keep the + seed_node_list same, and vary the index from 1 through N. + + Optionally, shards can be configured in a more granular way by + modifying the file "custom_shard_configs.txt" in the same folder + as this tool. Please see that file for more details + +EOF + + exit 1 +} + + +function start_banner +{ +cat < ${MODULESHARDSCONF} + modules_builder > ${MODULESCONF} + cat ${MODULESCONF} + fi + + echo "Configuring replication type in module-shards.conf" + sed -i -e "/^[^#].*replicas[ ]*=/ { :loop /.*\]/ b done; N; b loop; :done s/replicas.*\]/replicas = [${MEMBER_NAME_LIST}]/}" ${MODULESHARDSCONF} +} + + +function verify_configuration_files +{ + # Constants + BIN_DIR=`dirname $0` + test ${BIN_DIR} == '.' && BIN_DIR=${PWD} + CONTROLLER_DIR=`dirname ${BIN_DIR}` + CONF_DIR=${CONTROLLER_DIR}/configuration/initial + AKKACONF=${CONF_DIR}/akka.conf + MODULESCONF=${CONF_DIR}/modules.conf + MODULESHARDSCONF=${CONF_DIR}/module-shards.conf + + # Verify configuration files are present in expected location. + if [ ! -f ${AKKACONF} -o ! -f ${MODULESHARDSCONF} ]; then + # Check if the configuration files exist in the system + # directory, then copy them over. + ORIG_CONF_DIR=${CONTROLLER_DIR}/system/org/opendaylight/controller/sal-clustering-config + version=$(sed -n -e 's/.*\(.*\)<\/version>/\1/p' ${ORIG_CONF_DIR}/maven-metadata-local.xml) + ORIG_CONF_DIR=${ORIG_CONF_DIR}/${version} + ORIG_AKKA_CONF=sal-clustering-config-${version}-akkaconf.xml + ORIG_MODULES_CONF=sal-clustering-config-${version}-moduleconf.xml + ORIG_MODULESHARDS_CONF=sal-clustering-config-${version}-moduleshardconf.xml + + if [ -f ${ORIG_CONF_DIR}/${ORIG_AKKA_CONF} -a \ + -f ${ORIG_CONF_DIR}/${ORIG_MODULES_CONF} -a \ + -f ${ORIG_CONF_DIR}/${ORIG_MODULESHARDS_CONF} ]; then + cat <