diff --git a/build/nightly-mini-tester.sh b/build/nightly-mini-tester.sh index a9ae28d29..3eae93c6f 100755 --- a/build/nightly-mini-tester.sh +++ b/build/nightly-mini-tester.sh @@ -1,7 +1,5 @@ #!/bin/bash -NO_NONROOT_SUDO=yes -export NO_NONROOT_SUDO prefix=/usr/local builddir= for arg in "$@"; do diff --git a/cpackEngineDEB.cmake b/cpackEngineDEB.cmake index aade757bf..549e0d53a 100644 --- a/cpackEngineDEB.cmake +++ b/cpackEngineDEB.cmake @@ -65,11 +65,11 @@ if (EXISTS "/etc/debian_version") set(DEBIAN_VERSION_NUMBER "${CMAKE_MATCH_1}") endif () if ("${DEBIAN_VERSION_NUMBER}" EQUAL "8") - SET(CPACK_DEBIAN_PLATFORM_PACKAGE_DEPENDS "expect, perl, openssl, file, sudo, libdbi-perl, libreadline-dev, rsync, net-tools, libboost-all-dev, mariadb-columnstore-libs, mariadb-columnstore-server, libsnappy1") + SET(CPACK_DEBIAN_PLATFORM_PACKAGE_DEPENDS "expect, perl, openssl, file, libdbi-perl, libreadline-dev, rsync, net-tools, libboost-all-dev, mariadb-columnstore-libs, mariadb-columnstore-server, libsnappy1") elseif ("${DEBIAN_VERSION_NUMBER}" EQUAL "9") - SET(CPACK_DEBIAN_PLATFORM_PACKAGE_DEPENDS "expect, perl, openssl, file, sudo, libdbi-perl, libreadline-dev, rsync, net-tools, libboost-all-dev, mariadb-columnstore-libs, mariadb-columnstore-server, libsnappy1v5, libreadline5") + SET(CPACK_DEBIAN_PLATFORM_PACKAGE_DEPENDS "expect, perl, openssl, file, libdbi-perl, libreadline-dev, rsync, net-tools, libboost-all-dev, mariadb-columnstore-libs, mariadb-columnstore-server, libsnappy1v5, libreadline5") else() - SET(CPACK_DEBIAN_PLATFORM_PACKAGE_DEPENDS "expect, perl, openssl, file, sudo, libdbi-perl, libboost-all-dev, libreadline-dev, rsync, libsnappy1v5, net-tools") + SET(CPACK_DEBIAN_PLATFORM_PACKAGE_DEPENDS "expect, perl, openssl, file, libdbi-perl, libboost-all-dev, libreadline-dev, rsync, libsnappy1v5, net-tools") endif () SET(CPACK_DEBIAN_STORAGE-ENGINE_PACKAGE_DEPENDS "mariadb-columnstore-libs") diff --git a/dbcon/execplan/calpontsystemcatalog.cpp b/dbcon/execplan/calpontsystemcatalog.cpp index 15ccd73aa..7b75c15a9 100644 --- a/dbcon/execplan/calpontsystemcatalog.cpp +++ b/dbcon/execplan/calpontsystemcatalog.cpp @@ -66,6 +66,8 @@ using namespace logging; #include "rowgroup.h" using namespace rowgroup; +#include "installdir.h" + #include #include #include @@ -92,7 +94,8 @@ throw runtime_error("CALPONT_INTERNAL_ERROR"); \ #if CSC_DEBUG namespace { -std::ofstream csclog("/tmp/csc.log", std::ios::app); + string tmpDir = startup::StartUp::tmpDir() + "/csc.log"; + std::ofstream csclog(tmpDir, std::ios::app); } #define DEBUG csclog #else diff --git a/dbcon/execplan/sessionmanager.h b/dbcon/execplan/sessionmanager.h index 97f0aa01b..f1f9ad71e 100644 --- a/dbcon/execplan/sessionmanager.h +++ b/dbcon/execplan/sessionmanager.h @@ -55,7 +55,7 @@ namespace execplan * default value is 1000. * SessionManager/SharedMemoryTmpFile: the file to store the shared memory segment * data in between invocations if DESTROYSHMSEG is defined below. The - * default is /tmp/CalpontShm. + * default is /tmp/ColumnstoreShm. * SessionManager/TxnIDFile: the file to store the last transaction ID issued */ diff --git a/dbcon/execplan/sessionmonitor.cpp b/dbcon/execplan/sessionmonitor.cpp index c3a89c4ce..0a27b5925 100644 --- a/dbcon/execplan/sessionmonitor.cpp +++ b/dbcon/execplan/sessionmonitor.cpp @@ -54,6 +54,9 @@ using namespace messageqcpp; using namespace BRM; +#include "installdir.h" + + namespace execplan { @@ -102,8 +105,12 @@ SessionMonitor::SessionMonitor() if (stmp != "") fSegmentFilename = strdup(stmp.c_str()); else - fSegmentFilename = strdup("/tmp/CalpontSessionMonitorShm"); - + { + string tmpdir = startup::StartUp::installDir() + "CalpontSessionMonitorShm"; + + fSegmentFilename = strdup(tmpdir); + } + try { madeSems = getSems(); diff --git a/dbcon/execplan/sessionmonitor.h b/dbcon/execplan/sessionmonitor.h index af7a9fb07..cf31b63b3 100644 --- a/dbcon/execplan/sessionmonitor.h +++ b/dbcon/execplan/sessionmonitor.h @@ -32,10 +32,6 @@ #include #include -#include -#include -#include - #include "calpontsystemcatalog.h" #include "sessionmanager.h" #include "shmkeys.h" @@ -58,7 +54,6 @@ namespace execplan * SessionMonitor/SharedMemoryTmpFile: the file to store the shared memory segment * data in. This needs to be a different file than * file used for the SessionManager/SharedMemoryTmpFile. - * The default is /tmp/CalpontMonShm. */ /* diff --git a/dbcon/joblist/largedatalist.h b/dbcon/joblist/largedatalist.h index 924b0b200..7aedead4b 100644 --- a/dbcon/joblist/largedatalist.h +++ b/dbcon/joblist/largedatalist.h @@ -204,7 +204,6 @@ template LargeDataList::LargeDataList(uint32_t nc, uint32_t elementSaveSize1st, uint32_t elementSaveSize2nd, const ResourceManager* rm): base(nc), path(rm.getScTempDiskPath()), fTraceOn(false), fReUse(false), fSaveForReuse(false), fRestoreInfo(NULL) { -// config::Config *config = config::Config::makeConfig(); loadedSet = 0; setCount = 1; @@ -214,14 +213,6 @@ LargeDataList::LargeDataList(uint32_t nc, uint32_t eleme multipleProducers = false; fLoadedSetCount = 0; setDiskElemSize ( elementSaveSize1st, elementSaveSize2nd ); -// try { -// path = config->getConfig("SystemConfig", "TempDiskPath"); -// } -// catch (...) { -// } -// if (path.length() == 0) -// path = defaultTempDiskPath; - //pthread_cond_init(&consumePhase, NULL); } template diff --git a/dbcon/joblist/resourcemanager.h b/dbcon/joblist/resourcemanager.h index 5d7a7e873..4a92a35b2 100644 --- a/dbcon/joblist/resourcemanager.h +++ b/dbcon/joblist/resourcemanager.h @@ -34,6 +34,7 @@ #include "configcpp.h" #include "calpontselectexecutionplan.h" #include "resourcedistributor.h" +#include "installdir.h" #include "atomicops.h" @@ -82,7 +83,7 @@ const uint32_t defaultProcessorThreadsPerScan = 16; const uint32_t defaultJoinerChunkSize = 16 * 1024 * 1024; //bucketreuse -const std::string defaultTempDiskPath = "/var/tmp"; +const std::string defaultTempDiskPath = "/tmp"; const std::string defaultWorkingDir = "."; //"/tmp"; //largedatalist @@ -282,7 +283,7 @@ public: std::string getScTempDiskPath() const { - return getStringVal(fSystemConfigStr, "TempDiskPath", defaultTempDiskPath ); + return startup::StartUp::tmpDir(); } uint64_t getScTempSaveSize() const { @@ -290,7 +291,7 @@ public: } std::string getScWorkingDir() const { - return getStringVal(fSystemConfigStr, "WorkingDir", defaultWorkingDir ); + return startup::StartUp::tmpDir(); } uint32_t getTwMaxSize() const diff --git a/dbcon/mysql/ha_calpont_execplan.cpp b/dbcon/mysql/ha_calpont_execplan.cpp index b98653af7..46d5ff7cd 100644 --- a/dbcon/mysql/ha_calpont_execplan.cpp +++ b/dbcon/mysql/ha_calpont_execplan.cpp @@ -6189,7 +6189,9 @@ int getSelectPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, bool i if (filters) { csep->filters(filters); - filters->drawTree("/tmp/filter1.dot"); + std::string aTmpDir(startup::StartUp::tmpDir()); + aTmpDir = aTmpDir + "/filter1.dot"; + filters->drawTree(aTmpDir); } gwi.clauseType = SELECT; @@ -8614,7 +8616,9 @@ int getGroupPlan(gp_walk_info& gwi, SELECT_LEX& select_lex, SCSEP& csep, cal_gro { csep->filters(filters); #ifdef DEBUG_WALK_COND - filters->drawTree("/tmp/filter1.dot"); + std::string aTmpDir(startup::StartUp::tmpDir()); + aTmpDir = aTmpDir + "/filter1.dot"; + filters->drawTree(aTmpDir); #endif } diff --git a/dbcon/mysql/ha_calpont_impl.cpp b/dbcon/mysql/ha_calpont_impl.cpp index ad83f48db..2b854e3a6 100644 --- a/dbcon/mysql/ha_calpont_impl.cpp +++ b/dbcon/mysql/ha_calpont_impl.cpp @@ -2720,16 +2720,16 @@ int ha_calpont_impl_rnd_init(TABLE* table) #ifdef DEBUG_SETENV string home(getenv("HOME")); - if (!getenv("CALPONT_HOME")) + if (!getenv("COLUMNSTORE_HOME")) { string calpontHome(home + "/Calpont/etc/"); - setenv("CALPONT_HOME", calpontHome.c_str(), 1); + setenv("COLUMNSTORE_HOME", calpontHome.c_str(), 1); } - if (!getenv("CALPONT_CONFIG_FILE")) + if (!getenv("COLUMNSTORE_CONFIG_FILE")) { - string calpontConfigFile(home + "/Calpont/etc/Columnstore.xml"); - setenv("CALPONT_CONFIG_FILE", calpontConfigFile.c_str(), 1); + string calpontConfigFile(home + "/mariadb/columnstore/etc/Columnstore.xml"); + setenv("COLUMNSTORE_CONFIG_FILE", calpontConfigFile.c_str(), 1); } if (!getenv("CALPONT_CSC_IDENT")) @@ -3056,7 +3056,9 @@ int ha_calpont_impl_rnd_init(TABLE* table) #ifdef PLAN_HEX_FILE // plan serialization - ifstream ifs("/tmp/li1-plan.hex"); + string tmpDir = aTmpDir + "/li1-plan.hex"; + + ifstream ifs(tmpDir.c_str()); ByteStream bs1; ifs >> bs1; ifs.close(); @@ -3982,6 +3984,8 @@ void ha_calpont_impl_start_bulk_insert(ha_rows rows, TABLE* table) //set up for cpimport std::vector Cmds; std::string aCmdLine(startup::StartUp::installDir()); + std::string aTmpDir(startup::StartUp::tmpDir()); + //If local module type is not PM and Local PM query is set, error out char escapechar[2] = ""; @@ -4390,6 +4394,8 @@ int ha_calpont_impl_end_bulk_insert(bool abort, TABLE* table) { THD* thd = current_thd; + std::string aTmpDir(startup::StartUp::tmpDir()); + if (!thd->infinidb_vtable.cal_conn_info) thd->infinidb_vtable.cal_conn_info = (void*)(new cal_connection_info()); @@ -4516,7 +4522,7 @@ int ha_calpont_impl_end_bulk_insert(bool abort, TABLE* table) rc = 1; ifstream dmlFile; ostringstream oss; - oss << "/tmp/" << ci->tableOid << ".txt"; + oss << aTmpDir << ci->tableOid << ".txt"; dmlFile.open(oss.str().c_str()); if (dmlFile.is_open()) @@ -4533,7 +4539,7 @@ int ha_calpont_impl_end_bulk_insert(bool abort, TABLE* table) rc = 1; ifstream dmlFile; ostringstream oss; - oss << "/tmp/" << ci->tableOid << ".txt"; + oss << aTmpDir << ci->tableOid << ".txt"; dmlFile.open(oss.str().c_str()); if (dmlFile.is_open()) @@ -4567,7 +4573,7 @@ int ha_calpont_impl_end_bulk_insert(bool abort, TABLE* table) //get extra warning count if any ifstream dmlFile; ostringstream oss; - oss << "/tmp/" << ci->tableOid << ".txt"; + oss << aTmpDir << ci->tableOid << ".txt"; dmlFile.open(oss.str().c_str()); int totalWarnCount = 0; int colWarns = 0; @@ -5115,7 +5121,7 @@ int ha_calpont_impl_group_by_init(ha_calpont_group_by_handler* group_hand, TABLE ci->warningMsg = msg; } - // If the previous query has error and + // If the previous query has error and // this is not a subquery run by the server(MCOL-1601) // re-establish the connection if (ci->queryState != 0) @@ -5215,7 +5221,7 @@ int ha_calpont_impl_group_by_init(ha_calpont_group_by_handler* group_hand, TABLE return 0; string query; - // Set the query text only once if the server executes + // Set the query text only once if the server executes // subqueries separately. if(ci->queryState) query.assign(""); @@ -5235,7 +5241,9 @@ int ha_calpont_impl_group_by_init(ha_calpont_group_by_handler* group_hand, TABLE #ifdef PLAN_HEX_FILE // plan serialization - ifstream ifs("/tmp/li1-plan.hex"); + string tmpDir = aTmpDir + "/li1-plan.hex"; + + ifstream ifs(tmpDir); ByteStream bs1; ifs >> bs1; ifs.close(); diff --git a/dbcon/mysql/install_calpont_mysql.sh b/dbcon/mysql/install_calpont_mysql.sh index 8f8f4be6e..08a08a494 100755 --- a/dbcon/mysql/install_calpont_mysql.sh +++ b/dbcon/mysql/install_calpont_mysql.sh @@ -17,6 +17,8 @@ for arg in "$@"; do elif [ `expr -- "$arg" : '--installdir='` -eq 13 ]; then installdir="`echo $arg | awk -F= '{print $2}'`" prefix=`dirname $installdir` + elif [ `expr -- "$arg" : '--tmpdir='` -eq 9 ]; then + tmpdir="`echo $arg | awk -F= '{print $2}'`" else echo "ignoring unknown argument: $arg" 1>&2 fi @@ -24,7 +26,7 @@ done df=$installdir/mysql/my.cnf -$installdir/mysql/bin/mysql --defaults-extra-file=$df --force --user=root mysql 2>/tmp/mysql_install.log < ${tmpdir}/mysql_install.log < -# - Add the above to any other configuration file (for example ~/.my.ini) -# and copy my_print_defaults to /usr/bin -# - Add the path to the mysql-installation-directory to the basedir variable -# below. -# -# If you want to affect other MySQL variables, you should make your changes -# in the /etc/my.cnf, ~/.my.cnf or other MySQL configuration files. - -# If you change base dir, you must also change datadir. These may get -# overwritten by settings in the MySQL configuration files. - -basedir=/usr/local/Calpont/mysql -datadir=/usr/local/Calpont/mysql/db - -# Default value, in seconds, afterwhich the script should timeout waiting -# for server start. -# Value here is overriden by value in my.cnf. -# 0 means don't wait at all -# Negative numbers mean to wait indefinitely -service_startup_timeout=30 - -# Lock directory for RedHat / SuSE. -lockdir='/var/lock/subsys' -lock_file_path="$lockdir/mysql-Columnstore" - -# The following variables are only set for letting mysql.server find things. - -# Set some defaults -mysqld_pid_file_path= -if test -z "$basedir" -then - basedir=/usr/local/Calpont/mysql - bindir=/usr/local/bin - if test -z "$datadir" - then - datadir=/var/lib/mysql - fi - sbindir=/usr/local/sbin - libexecdir=/usr/local/sbin -else - bindir="$basedir/bin" - if test -z "$datadir" - then - datadir="$basedir/data" - fi - sbindir="$basedir/sbin" - if test -f "$basedir/sbin/mysqld" - then - libexecdir="$basedir/sbin" - else - libexecdir="$basedir/libexec" - fi -fi - -# datadir_set is used to determine if datadir was set (and so should be -# *not* set inside of the --basedir= handler.) -datadir_set= - -# -# Use LSB init script functions for printing messages, if possible -# -lsb_functions="/lib/lsb/init-functions" -if test -f $lsb_functions ; then - . $lsb_functions -else - # Include non-LSB RedHat init functions to make systemctl redirect work - init_functions="/etc/init.d/functions" - if test -f $init_functions; then - . $init_functions - fi - log_success_msg() - { - echo " SUCCESS! $@" - } - log_failure_msg() - { - echo " ERROR! $@" - } -fi - -PATH="/sbin:/usr/sbin:/bin:/usr/bin:$basedir/bin" -export PATH - -mode=$1 # start or stop - -[ $# -ge 1 ] && shift - -case `echo "testing\c"`,`echo -n testing` in - *c*,-n*) echo_n= echo_c= ;; - *c*,*) echo_n=-n echo_c= ;; - *) echo_n= echo_c='\c' ;; -esac - -parse_server_arguments() { - for arg do - case "$arg" in - --basedir=*) basedir=`echo "$arg" | sed -e 's/^[^=]*=//'` - bindir="$basedir/bin" - if test -z "$datadir_set"; then - datadir="$basedir/data" - fi - sbindir="$basedir/sbin" - if test -f "$basedir/sbin/mysqld" - then - libexecdir="$basedir/sbin" - else - libexecdir="$basedir/libexec" - fi - #libexecdir="$basedir/libexec" - ;; - --datadir=*) datadir=`echo "$arg" | sed -e 's/^[^=]*=//'` - datadir_set=1 - ;; - --log-basename=*|--hostname=*|--loose-log-basename=*) - mysqld_pid_file_path=`echo "$arg.pid" | sed -e 's/^[^=]*=//'` - ;; - --pid-file=*) mysqld_pid_file_path=`echo "$arg" | sed -e 's/^[^=]*=//'` ;; - --service-startup-timeout=*) service_startup_timeout=`echo "$arg" | sed -e 's/^[^=]*=//'` ;; - esac - done -} - -# Get arguments from the my.cnf file, -# the only group, which is read from now on is [mysqld] -if test -x ./bin/my_print_defaults -then - print_defaults="./bin/my_print_defaults" -elif test -x $bindir/my_print_defaults -then - print_defaults="$bindir/my_print_defaults" -elif test -x $bindir/mysql_print_defaults -then - print_defaults="$bindir/mysql_print_defaults" -else - # Try to find basedir in /etc/my.cnf - conf=/etc/my.cnf - print_defaults= - if test -r $conf - then - subpat='^[^=]*basedir[^=]*=\(.*\)$' - dirs=`sed -e "/$subpat/!d" -e 's//\1/' $conf` - for d in $dirs - do - d=`echo $d | sed -e 's/[ ]//g'` - if test -x "$d/bin/my_print_defaults" - then - print_defaults="$d/bin/my_print_defaults" - break - fi - if test -x "$d/bin/mysql_print_defaults" - then - print_defaults="$d/bin/mysql_print_defaults" - break - fi - done - fi - - # Hope it's in the PATH ... but I doubt it - test -z "$print_defaults" && print_defaults="my_print_defaults" -fi - -# -# Read defaults file from 'basedir'. If there is no defaults file there -# check if it's in the old (depricated) place (datadir) and read it from there -# - -extra_args="" -if test -r "$basedir/my.cnf" -then - extra_args="-e $basedir/my.cnf" -else - if test -r "$datadir/my.cnf" - then - extra_args="-e $datadir/my.cnf" - fi -fi - -parse_server_arguments `$print_defaults $extra_args --mysqld mysql.server` -parse_server_arguments "$@" - -# wait for the pid file to disappear -wait_for_gone () { - pid="$1" # process ID of the program operating on the pid-file - pid_file_path="$2" # path to the PID file. - - i=0 - crash_protection="by checking again" - - while test $i -ne $service_startup_timeout ; do - - if kill -0 "$pid" 2>/dev/null; then - : # the server still runs - else - if test ! -s "$pid_file_path"; then - # no server process and no pid-file? great, we're done! - log_success_msg - return 0 - fi - - # pid-file exists, the server process doesn't. - # it must've crashed, and mysqld_safe will restart it - if test -n "$crash_protection"; then - crash_protection="" - sleep 5 - continue # Check again. - fi - - kill_by_pid - # Cannot help it - log_failure_msg "The server quit without updating PID file ($pid_file_path)." - return 1 # not waiting any more. - fi - - echo $echo_n ".$echo_c" - i=`expr $i + 1` - sleep 1 - - done - - log_failure_msg - return 1 -} - -wait_for_ready () { - - i=0 - while test $i -ne $service_startup_timeout ; do - - if $bindir/mysqladmin ping --socket=/usr/local/Calpont/mysql/lib/mysql/mysql.sock >/dev/null 2>&1; then - log_success_msg - return 0 - elif kill -0 $! 2>/dev/null ; then - : # mysqld_safe is still running - else - # mysqld_safe is no longer running, abort the wait loop - break - fi - - echo $echo_n ".$echo_c" - i=`expr $i + 1` - sleep 1 - - done - - log_failure_msg - return 1 -} -# -# Set pid file if not given -# -if test -z "$mysqld_pid_file_path" -then - mysqld_pid_file_path=$datadir/`hostname`.pid -else - case "$mysqld_pid_file_path" in - /* ) ;; - * ) mysqld_pid_file_path="$datadir/$mysqld_pid_file_path" ;; - esac -fi - -# source other config files -[ -f /etc/default/mysql ] && . /etc/default/mysql -[ -f /etc/sysconfig/mysql ] && . /etc/sysconfig/mysql -[ -f /etc/conf.d/mysql ] && . /etc/conf.d/mysql - -kill_by_pid() { - # let's see if we can kill the 2 mysql procs by hand - # get the our mysql from ps - eval $(ps -ef | grep "$COLUMNSTORE_INSTALL_DIR/mysql//sbin/mysqld" | grep -v grep | head -1 | awk '{printf "pid=%d\n", $2}') - - if [ -n "$pid" ]; then - ppid=$(ps -o ppid= -p $pid) - $SUDO kill -9 $ppid - kill -9 $ppid - sleep 1 - $SUDO kill -9 $pid - kill -9 $pid - echo $echo_n "Force shutting down (no/bad pid file)" - log_success_msg - exit 0 - fi - return -} - -case "$mode" in - 'start') - # Start daemon - - # Safeguard (relative paths, core dumps..) - cd $basedir - - echo $echo_n "Starting MySQL" - if test -x $bindir/mysqld_safe - then - # Give extra arguments to mysqld with the my.cnf file. This script - # may be overwritten at next upgrade. - $bindir/mysqld_safe --datadir="$datadir" --pid-file="$mysqld_pid_file_path" "--ledir=$libexecdir" "$@" >/dev/null 2>&1 & - wait_for_ready; return_value=$? - - # Make lock for RedHat / SuSE - if test -w "$lockdir" - then - touch "$lock_file_path" - fi - - exit $return_value - else - log_failure_msg "Couldn't find MySQL server ($bindir/mysqld_safe)" - fi - ;; - - 'stop') - # Stop daemon. We use a signal here to avoid having to know the - # root password. - - if test -s "$mysqld_pid_file_path" - then - mysqld_pid=`cat "$mysqld_pid_file_path"` - - if (kill -0 $mysqld_pid 2>/dev/null) - then - echo $echo_n "Shutting down MySQL" - kill $mysqld_pid - # mysqld should remove the pid file when it exits, so wait for it. - wait_for_gone $mysqld_pid "$mysqld_pid_file_path"; return_value=$? - else - log_failure_msg "MySQL server process #$mysqld_pid is not running!" - rm "$mysqld_pid_file_path" - fi - - # Delete lock for RedHat / SuSE - if test -f "$lock_file_path" - then - rm -f "$lock_file_path" - fi - exit $return_value - else - kill_by_pid - log_failure_msg "MySQL server PID file could not be found!" - fi - ;; - - 'restart') - # Stop the service and regardless of whether it was - # running or not, start it again. - if $0 stop "$@"; then - if ! $0 start "$@"; then - log_failure_msg "Failed to restart server." - exit 1 - fi - else - log_failure_msg "Failed to stop running server, so refusing to try to start." - exit 1 - fi - ;; - - 'reload'|'force-reload') - if test -s "$mysqld_pid_file_path" ; then - read mysqld_pid < "$mysqld_pid_file_path" - kill -HUP $mysqld_pid && log_success_msg "Reloading service MySQL" - touch "$mysqld_pid_file_path" - else - log_failure_msg "MySQL PID file could not be found!" - exit 1 - fi - ;; - 'status') - # First, check to see if pid file exists - if test -s "$mysqld_pid_file_path" ; then - read mysqld_pid < "$mysqld_pid_file_path" - if kill -0 $mysqld_pid 2>/dev/null ; then - log_success_msg "MySQL running ($mysqld_pid)" - exit 0 - else - log_failure_msg "MySQL is not running, but PID file exists" - exit 1 - fi - else - # Try to find appropriate mysqld process - mysqld_pid=`pidof $libexecdir/mysqld` - - # test if multiple pids exist - pid_count=`echo $mysqld_pid | wc -w` - if test $pid_count -gt 1 ; then - log_failure_msg "Multiple MySQL running but PID file could not be found ($mysqld_pid)" - exit 5 - elif test -z $mysqld_pid ; then - if test -f "$lock_file_path" ; then - log_failure_msg "MySQL is not running, but lock file ($lock_file_path) exists" - exit 2 - fi - log_failure_msg "MySQL is not running" - exit 3 - else - log_failure_msg "MySQL is running but PID file could not be found" - exit 4 - fi - fi - ;; - 'configtest') - # Safeguard (relative paths, core dumps..) - cd $basedir - echo $echo_n "Testing MySQL configuration syntax" - daemon=$bindir/mysqld - if test -x $libexecdir/mysqld - then - daemon=$libexecdir/mysqld - elif test -x $sbindir/mysqld - then - daemon=$sbindir/mysqld - elif test -x `which mysqld` - then - daemon=`which mysqld` - else - log_failure_msg "Unable to locate the mysqld binary!" - exit 1 - fi - help_out=`$daemon --help 2>&1`; r=$? - if test "$r" != 0 ; then - log_failure_msg "$help_out" - log_failure_msg "There are syntax errors in the server configuration. Please fix them!" - else - log_success_msg "Syntax OK" - fi - exit $r - ;; - 'bootstrap') - if test "$_use_systemctl" == 1 ; then - log_failure_msg "Please use galera_new_cluster to start the mariadb service with --wsrep-new-cluster" - exit 1 - fi - # Bootstrap the cluster, start the first node - # that initiate the cluster - echo $echo_n "Bootstrapping the cluster.. " - $0 start $other_args --wsrep-new-cluster - exit $? - ;; - *) - # usage - basename=`basename "$0"` - echo "Usage: $basename {start|stop|restart|reload|force-reload|status|configtest|bootstrap} [ MySQL server options ]" - exit 1 - ;; -esac - -exit 0 diff --git a/dbcon/mysql/mysql-Columnstore b/dbcon/mysql/mysql-Columnstore index 02a0de162..370b277d0 100755 --- a/dbcon/mysql/mysql-Columnstore +++ b/dbcon/mysql/mysql-Columnstore @@ -43,12 +43,33 @@ # If you change base dir, you must also change datadir. These may get # overwritten by settings in the MySQL configuration files. -if [ -z "$COLUMNSTORE_INSTALL_DIR" ]; then - test -f /etc/default/columnstore && . /etc/default/columnstore +prefix=/usr/local + +USER=`whoami 2>/dev/null` + +if [ $USER != "root" ]; then + prefix=$HOME +fi + +if [ $USER != "root" ]; then + if [ -f $prefix/.bash_profile ]; then + profileFile=$prefix/.bash_profile + elif [ -f $prefix/.profile ]; then + profileFile=$prefix/.profile + else + profileFile=$prefix/.bashrc + fi + + . $profileFile +fi + +# Source function library. +if [ -f /etc/init.d/functions ]; then + . /etc/init.d/functions fi if [ -z "$COLUMNSTORE_INSTALL_DIR" ]; then - COLUMNSTORE_INSTALL_DIR=/usr/local/mariadb/columnstore + COLUMNSTORE_INSTALL_DIR=/usr/local/mariadb/columnstore fi export COLUMNSTORE_INSTALL_DIR=$COLUMNSTORE_INSTALL_DIR @@ -62,9 +83,11 @@ datadir=$basedir/db # 0 means don't wait at all # Negative numbers mean to wait indefinitely service_startup_timeout=90 +user=`whoami 2>/dev/null` + +# Lock directory +lockdir=`$COLUMNSTORE_INSTALL_DIR/bin/getConfig Installation LockFileDirectory` -# Lock directory for RedHat / SuSE. -lockdir='/var/lock/subsys' lock_file_path="$lockdir/mysql-Columnstore" # The following variables are only set for letting mysql.server find things. @@ -316,10 +339,8 @@ kill_by_pid() { if [ -n "$pid" ]; then ppid=$(ps -o ppid= -p $pid) - $SUDO kill -9 $ppid kill -9 $ppid sleep 1 - $SUDO kill -9 $pid kill -9 $pid echo $echo_n "Force shutting down (no/bad pid file)" log_success_msg diff --git a/dbcon/mysql/sm.cpp b/dbcon/mysql/sm.cpp index 9cbfc73e6..5df01dda6 100644 --- a/dbcon/mysql/sm.cpp +++ b/dbcon/mysql/sm.cpp @@ -54,6 +54,8 @@ using namespace querystats; #include "sm.h" +#include "installdir.h" + namespace { using namespace sm; @@ -254,7 +256,10 @@ void sighandler(int sig_num) FILE* p; char buf[1024]; - if ((p = fopen("/tmp/f1.dat", "a")) != NULL) + string tmpDir = startup::StartUp::tmpDir() + "/f1.dat"; + const char *cstr = tmpDir.c_str(); + + if ((p = fopen(cstr, "a")) != NULL) { snprintf(buf, 1024, "sighandler() hit with %d\n", sig_num); fwrite(buf, 1, strlen(buf), p); diff --git a/ddlproc/ddlproc.cpp b/ddlproc/ddlproc.cpp index bc70b01d5..6f827f8fd 100644 --- a/ddlproc/ddlproc.cpp +++ b/ddlproc/ddlproc.cpp @@ -62,6 +62,8 @@ using namespace execplan; #include "utils_utf8.h" #include "crashtrace.h" +#include "installdir.h" + namespace fs = boost::filesystem; @@ -71,15 +73,12 @@ DistributedEngineComm* Dec; void setupCwd() { - string workdir = config::Config::makeConfig()->getConfig("SystemConfig", "WorkingDir"); + string workdir = startup::StartUp::tmpDir(); if (workdir.length() == 0) workdir = "."; (void)chdir(workdir.c_str()); - - if (access(".", W_OK) != 0) - (void)chdir("/tmp"); } void added_a_pm(int) diff --git a/dmlproc/dmlproc.cpp b/dmlproc/dmlproc.cpp index 8369a2003..deb936422 100644 --- a/dmlproc/dmlproc.cpp +++ b/dmlproc/dmlproc.cpp @@ -83,6 +83,7 @@ using namespace joblist; #include "utils_utf8.h" #include "crashtrace.h" +#include "installdir.h" namespace fs = boost::filesystem; @@ -493,7 +494,7 @@ void rollbackAll(DBRM* dbrm) void setupCwd() { - string workdir = Config::makeConfig()->getConfig("SystemConfig", "WorkingDir"); + string workdir = startup::StartUp::tmpDir(); if (workdir.length() == 0) workdir = "."; @@ -605,26 +606,11 @@ int main(int argc, char* argv[]) if (temp > 0) serverQueueSize = temp; - - bool rootUser = true; -#ifndef _MSC_VER - //check if root-user - int user; - user = getuid(); - - if (user != 0) - rootUser = false; - -#endif - //read and cleanup port before trying to use try { string port = cf->getConfig(DMLProc, "Port"); - string cmd = "fuser -k " + port + "/tcp >/dev/null 2>&1"; - - if ( !rootUser) - cmd = "sudo fuser -k " + port + "/tcp >/dev/null 2>&1"; + string cmd = "fuser -k " + port + "/tcp >/dev/null 2>&1"; (void)::system(cmd.c_str()); } diff --git a/exemgr/main.cpp b/exemgr/main.cpp index 528990ec8..a403360ac 100644 --- a/exemgr/main.cpp +++ b/exemgr/main.cpp @@ -105,6 +105,9 @@ using namespace querytele; #include "dbrm.h" #endif + +#include "installdir.h" + namespace { diff --git a/oam/cloud/IDBCloudGetIP.sh b/oam/cloud/IDBCloudGetIP.sh deleted file mode 100644 index bca6d41f0..000000000 --- a/oam/cloud/IDBCloudGetIP.sh +++ /dev/null @@ -1,44 +0,0 @@ -#! /bin/sh -# IDBCloudGetIP.sh -# Get IP Address from a Cloud environment -# -# 1. Amazon EC2 - -prefix=/usr/local - -#get instance name from called -instanceName="$1" - -ec2=`$prefix/mariadb/columnstore/bin/getConfig Installation EC2_HOME` - -if [ $ec2 == "unassigned" ]; then - echo "stopped" - exit 1 -fi - -java=`$prefix/mariadb/columnstore/bin/getConfig Installation JAVA_HOME` -path=`$prefix/mariadb/columnstore/bin/getConfig Installation EC2_PATH` - -export PATH=$path -export EC2_HOME=$ec2 -export JAVA_HOME=$java - -# get x509 Certification and Private Key -x509Cert=`$prefix/mariadb/columnstore/bin/getConfig Installation AmazonX509Certificate` -x509PriKey=`$prefix/mariadb/columnstore/bin/getConfig Installation AmazonX509PrivateKey` - -#get instance info -ec2-describe-instances -C $x509Cert -K $x509PriKey $instanceName > /tmp/instanceInfo 2> /dev/null - -#check if running -cat /tmp/instanceInfo | grep running > /tmp/instanceStatus -if [ `cat /tmp/instanceStatus | wc -c` -eq 0 ]; then - echo "stopped" - exit 1 -fi - -#get priviate IP Address -IpAddr=`cat /tmp/instanceInfo | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $15}'` - -echo $IpAddr -exit 0 diff --git a/oam/cloud/IDBInstanceCmds.sh b/oam/cloud/IDBInstanceCmds.sh deleted file mode 100644 index 1d7351594..000000000 --- a/oam/cloud/IDBInstanceCmds.sh +++ /dev/null @@ -1,574 +0,0 @@ -#! /bin/sh -# IDBInstanceCmds.sh -# get-local-instance-ID, get-zone, getPrivateIP from a Cloud environment -# -# 1. Amazon EC2 - -prefix=/usr/local - -#check command -if [ "$1" = "" ]; then - echo "Enter Command Name: {launchInstance|getInstance|getZone|getPrivateIP|getKey|getAMI|getType|terminateInstance|startInstance|assignElasticIP|deassignElasticIP|getProfile|stopInstance|getGroup|getSubnet} -}" - exit 1 -fi - -if [ "$1" = "getPrivateIP" ]; then - if [ "$2" = "" ]; then - echo "Enter Instance Name" - exit 1 - fi - instanceName="$2" -fi - -if [ "$1" = "launchInstance" ]; then - if [ "$2" = "" ]; then - IPaddress="unassigned" - else - IPaddress="$2" - fi - if [ "$3" = "" ]; then - instanceType="unassigned" - else - instanceType="$3" - fi - if [ "$4" = "" ]; then - group="unassigned" - else - group="$4" - fi -fi - -if [ "$1" = "terminateInstance" ]; then - if [ "$2" = "" ]; then - echo "Enter Instance Name" - exit 1 - fi - instanceName="$2" -fi - -if [ "$1" = "stopInstance" ]; then - if [ "$2" = "" ]; then - echo "Enter Instance Name" - exit 1 - fi - instanceName="$2" -fi - -if [ "$1" = "startInstance" ]; then - if [ "$2" = "" ]; then - echo "Enter Instance Name" - exit 1 - fi - instanceName="$2" -fi - -if [ "$1" = "assignElasticIP" ]; then - if [ "$2" = "" ]; then - echo "Enter Instance Name" - exit 1 - else - instanceName="$2" - fi - if [ "$3" = "" ]; then - echo "Enter Elastic IP Address" - exit 1 - else - IPAddress="$3" - fi -fi - -if [ "$1" = "deassignElasticIP" ]; then - if [ "$2" = "" ]; then - echo "Enter Elastic IP Address" - exit 1 - else - IPAddress="$2" - fi -fi - - -test -f /usr/local/mariadb/columnstore/post/functions && . /usr/local/mariadb/columnstore/post/functions - -ec2=`$prefix/mariadb/columnstore/bin/getConfig Installation EC2_HOME` - -if [ $ec2 == "unassigned" ]; then - if [ "$1" = "getPrivateIP" ]; then - echo "stopped" - exit 1 - else - echo "unknown" - exit 1 - fi -fi - -java=`$prefix/mariadb/columnstore/bin/getConfig Installation JAVA_HOME` -path=`$prefix/mariadb/columnstore/bin/getConfig Installation EC2_PATH` - -export PATH=$path -export EC2_HOME=$ec2 -export JAVA_HOME=$java - -# get Keys and region -AmazonAccessKeyFile=`$prefix/mariadb/columnstore/bin/getConfig Installation AmazonAccessKey` -if [ $AmazonAccessKeyFile == "unassigned" ]; then - echo "FAILED: missing Config Setting AmazonAccessKey : $AmazonAccessKeyfile" - exit 1 -fi - -AmazonSecretKeyFile=`$prefix/mariadb/columnstore/bin/getConfig Installation AmazonSecretKey` -if [ $AmazonSecretKeyFile == "unassigned" ]; then - echo "FAILED: missing Config Setting AmazonSecretKeyFile : $AmazonSecretKeyFile" - exit 1 -fi - -AmazonAccessKey=`cat $AmazonAccessKeyFile` -AmazonSecretKey=`cat $AmazonSecretKeyFile` - -Region=`$prefix/mariadb/columnstore/bin/getConfig Installation AmazonRegion` -subnet=`$prefix/mariadb/columnstore/bin/getConfig Installation AmazonSubNetID` - -if test ! -f $AmazonAccessKeyfile ; then - echo "FAILED: missing AmazonAccessKeyfile : $AmazonAccessKeyfile" - exit 1 -fi - -if test ! -f $AmazonSecretKeyfile ; then - echo "FAILED: missing AmazonSecretKeyfile : $AmazonSecretKeyfile" - exit 1 -fi - -#default instance to null -instance="" - -describeInstanceFile="/tmp/describeInstance.txt" -touch $describeInstanceFile - -describeInstance() { - ec2-describe-instances -O $AmazonAccessKey -W $AmazonSecretKey --region $Region > $describeInstanceFile 2>&1 -} - -#call at start up -describeInstance - -getInstance() { - if [ "$instance" != "" ]; then - echo $instance - return - fi - - # first get local IP Address - localIP=`ifconfig eth0 | grep "inet addr:" | awk '{print substr($2,6,20)}'` - - #get local Instance ID - instance=`cat $describeInstanceFile | grep -m 1 -w $localIP | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` - if [ "$instance" == "" ]; then - describeInstance - fi - instance=`cat $describeInstanceFile | grep -m 1 -w $localIP | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` - - echo $instance - return -} - -getInstancePrivate() { - if [ "$instance" != "" ]; then - echo $instance - return - fi - - # first get local IP Address - localIP=`ifconfig eth0 | grep "inet addr:" | awk '{print substr($2,6,20)}'` - - #get local Instance ID - instance=`cat $describeInstanceFile | grep -m 1 -w $localIP | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` - if [ "$instance" == "" ]; then - describeInstance - fi - instance=`cat $describeInstanceFile | grep -m 1 -w $localIP | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` - - return -} - - -getZone() { - #get from Columnstore.xml if it's there, if not, get from instance then store - zone=`$prefix/mariadb/columnstore/bin/getConfig Installation AmazonZone` - - if [ "$zone" = "unassigned" ] || [ "$zone" = "" ]; then - #get local Instance ID - getInstancePrivate >/dev/null 2>&1 - #get zone - if [ "$subnet" == "unassigned" ]; then - zone=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $11}'` - if [ "$zone" == "" ]; then - describeInstance - fi - zone=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $11}'` - - else - zone=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $11}'` - if [ "$zone" == "" ]; then - describeInstance - fi - zone=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $11}'` - fi - $prefix/mariadb/columnstore/bin/setConfig Installation AmazonZone $zone - fi - - echo $zone - return -} - -getPrivateIP() { - #get instance info - grep -B1 -A4 -m 1 $instanceName $describeInstanceFile > /tmp/instanceInfo_$instanceName 2>&1 - if [ `cat /tmp/instanceInfo_$instanceName | wc -c` -eq 0 ]; then - describeInstance - fi - grep -B1 -A4 -m 1 $instanceName $describeInstanceFile > /tmp/instanceInfo_$instanceName 2>&1 - - #check if running or terminated - cat /tmp/instanceInfo_$instanceName | grep running > /tmp/instanceStatus_$instanceName - if [ `cat /tmp/instanceStatus_$instanceName | wc -c` -eq 0 ]; then - # not running - cat /tmp/instanceInfo_$instanceName | grep pending > /tmp/instanceStatus_$instanceName - if [ `cat /tmp/instanceStatus_$instanceName | wc -c` -ne 0 ]; then - describeInstance - echo "stopped" - exit 1 - else - cat /tmp/instanceInfo_$instanceName | grep terminated > /tmp/instanceStatus_$instanceName - if [ `cat /tmp/instanceStatus_$instanceName | wc -c` -ne 0 ]; then - echo "terminated" - exit 1 - else - cat /tmp/instanceInfo_$instanceName | grep shutting-down > /tmp/instanceStatus_$instanceName - if [ `cat /tmp/instanceStatus_$instanceName | wc -c` -ne 0 ]; then - echo "terminated" - exit 1 - else - echo "stopped" - exit 1 - fi - fi - fi - fi - - #running, get priviate IP Address - if [ "$subnet" == "unassigned" ]; then - IpAddr=`head -n 2 /tmp/instanceInfo_$instanceName | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $15}'` - else - IpAddr=`head -n 2 /tmp/instanceInfo_$instanceName | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $14}'` - fi - - echo $IpAddr - exit 0 -} - -getType() { - #get local Instance ID - getInstancePrivate >/dev/null 2>&1 - #get Type - if [ "$subnet" == "unassigned" ]; then - instanceType=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $9}'` - if [ "$instanceType" == "" ]; then - describeInstance - fi - instanceType=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $9}'` - - else - instanceType=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $9}'` - if [ "$instanceType" == "" ]; then - describeInstance - fi - instanceType=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $9}'` - - fi - - echo $instanceType - return -} - -getKey() { - #get local Instance ID - getInstancePrivate >/dev/null 2>&1 - #get Key - if [ "$subnet" == "unassigned" ]; then - key=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $7}'` - if [ "$key" == "" ]; then - describeInstance - fi - key=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $7}'` - - else - key=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $7}'` - if [ "$key" == "" ]; then - describeInstance - fi - key=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $7}'` - - fi - - echo $key - return -} - -getAMI() { - #get local Instance ID - getInstancePrivate >/dev/null 2>&1 - #get AMI - ami=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $3}'` - if [ "$ami" == "" ]; then - describeInstance - fi - ami=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $3}'` - - echo $ami - return -} - -getGroup() { - #get local Instance ID - getInstancePrivate >/dev/null 2>&1 - #get group - if [ "$subnet" == "unassigned" ]; then - group=`grep -B1 -A4 -m 1 $instance $describeInstanceFile | grep -m 1 RESERVATION | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $4}'` - if [ "$group" == "" ]; then - describeInstance - fi - group=`grep -B1 -A4 -m 1 $instance $describeInstanceFile | grep -m 1 RESERVATION | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $4}'` - if [ "$group" == "" ]; then - group=`grep -B1 -A4 -m 1 $instance $describeInstanceFile | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $22}'` - fi - else - group=`grep -B1 -A6 -m 1 $instance $describeInstanceFile | grep -m 1 GROUP | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` - if [ "$group" == "" ]; then - describeInstance - fi - group=`grep -B1 -A6 -m 1 $instance $describeInstanceFile | grep -m 1 GROUP | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` - if [ "$group" == "" ]; then - group=`grep -B1 -A4 -m 1 $instance $describeInstanceFile | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $21}'` - fi - fi - - echo $group - return -} - -getProfile() { - #get local Instance ID - getInstancePrivate >/dev/null 2>&1 - #get Type - if [ "$subnet" == "unassigned" ]; then - instanceProfile=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $23}'` - if [ "$instanceProfile" == "" ]; then - describeInstance - fi - instanceProfile=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $23}'` - - else - instanceProfile=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $22}'` - if [ "$instanceProfile" == "" ]; then - describeInstance - fi - instanceProfile=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $22}'` - - fi - - echo $instanceProfile - return -} - -launchInstance() { - #get publickey - getKey >/dev/null 2>&1 - if [ "$group" = "unassigned" ]; then - #get group - getGroup >/dev/null 2>&1 - fi - #get AMI - getAMI >/dev/null 2>&1 - #get Zone - getZone >/dev/null 2>&1 - if [ "$instanceType" = "unassigned" ]; then - #get type - getType >/dev/null 2>&1 - fi - #get AMI Profile - getProfile >/dev/null 2>&1 - - if [ "$subnet" == "unassigned" ]; then - #NOT VPC - if [ "$instanceProfile" = "" ] || [ "$instanceProfile" = "default" ]; then - newInstance=`ec2-run-instances -O $AmazonAccessKey -W $AmazonSecretKey -k $key -g $group -t $instanceType -z $zone --region $Region $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` - else - newInstance=`ec2-run-instances -O $AmazonAccessKey -W $AmazonSecretKey -k $key -g $group -t $instanceType -z $zone -p $instanceProfile --region $Region $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` - fi - else # VPC - if [ "$instanceProfile" = "" ] || [ "$instanceProfile" = "default" ]; then - if [ "$group" != "default" ]; then - if [ "$IPaddress" = "autoassign" ]; then - newInstance=`ec2-run-instances -O $AmazonAccessKey -W $AmazonSecretKey -k $key -g $group -t $instanceType -z $zone --region $Region -s $subnet $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` - else - newInstance=`ec2-run-instances -O $AmazonAccessKey -W $AmazonSecretKey -k $key -g $group -t $instanceType -z $zone --region $Region -s $subnet --private-ip-address $IPaddress $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` - fi - else - if [ "$IPaddress" = "autoassign" ]; then - newInstance=`ec2-run-instances -O $AmazonAccessKey -W $AmazonSecretKey -k $key -t $instanceType -z $zone --region $Region -s $subnet $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` - else - newInstance=`ec2-run-instances --O $AmazonAccessKey -W $AmazonSecretKey -k $key -t $instanceType -z $zone --region $Region -s $subnet --private-ip-address $IPaddress $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` - fi - fi - else - if [ "$group" != "default" ]; then - if [ "$IPaddress" = "autoassign" ]; then - newInstance=`ec2-run-instances -O $AmazonAccessKey -W $AmazonSecretKey -k $key -g $group -t $instanceType -z $zone -p $instanceProfile --region $Region -s $subnet $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` - else - newInstance=`ec2-run-instances -O $AmazonAccessKey -W $AmazonSecretKey -k $key -g $group -t $instanceType -z $zone -p $instanceProfile --region $Region -s $subnet --private-ip-address $IPaddress $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` - fi - else - if [ "$IPaddress" = "autoassign" ]; then - newInstance=`ec2-run-instances -O $AmazonAccessKey -W $AmazonSecretKey -k $key -t $instanceType -z $zone -p $instanceProfile --region $Region -s $subnet $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` - else - newInstance=`ec2-run-instances -O $AmazonAccessKey -W $AmazonSecretKey -k $key -t $instanceType -z $zone -p $instanceProfile --region $Region -s $subnet --private-ip-address $IPaddress $ami | grep -m 1 INSTANCE | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` - fi - fi - fi - fi - echo $newInstance - return -} - -terminateInstance() { - #terminate Instance - ec2-terminate-instances -O $AmazonAccessKey -W $AmazonSecretKey --region $Region $instanceName > /tmp/termInstanceInfo_$instanceName 2>&1 - return -} - -stopInstance() { - #terminate Instance - ec2-stop-instances -O $AmazonAccessKey -W $AmazonSecretKey --region $Region $instanceName > /tmp/stopInstanceInfo_$instanceName 2>&1 - return -} - -startInstance() { - #terminate Instance - ec2-start-instances -O $AmazonAccessKey -W $AmazonSecretKey --region $Region $instanceName > /tmp/startInstanceInfo_$instanceName 2>&1 - - cat /tmp/startInstanceInfo_$instanceName | grep INSTANCE > /tmp/startInstanceStatus_$instanceName - if [ `cat /tmp/startInstanceStatus_$instanceName | wc -c` -eq 0 ]; then - echo "Failed, check /tmp/startInstanceInfo_$instanceName" - exit 1 - fi - echo "Success" - exit 0 -} - -assignElasticIP() { - #terminate Instance - - if [ "$subnet" == "unassigned" ]; then - ec2-associate-address -O $AmazonAccessKey -W $AmazonSecretKey -i $instanceName $IPAddress > /tmp/assignElasticIPInfo_$IPAddress 2>&1 - else - EIP=`ec2-describe-addresses -O $AmazonAccessKey -W $AmazonSecretKey --region $Region $IPAddress | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $4}'` - ec2-associate-address -O $AmazonAccessKey -W $AmazonSecretKey --region $Region -i $instanceName -a $EIP > /tmp/assignElasticIPInfo_$IPAddress 2>&1 - fi - - cat /tmp/assignElasticIPInfo_$IPAddress | grep ADDRESS > /tmp/assignElasticIPStatus_$IPAddress - if [ `cat /tmp/assignElasticIPStatus_$IPAddress | wc -c` -eq 0 ]; then - echo "Failed, check /tmp/assignElasticIPInfo_$IPAddress" - exit 1 - fi - - echo "Success" - exit 0 -} - -deassignElasticIP() { - #terminate Instance - ec2-disassociate-address -O $AmazonAccessKey -W $AmazonSecretKey $IPAddress > /tmp/deassignElasticIPInfo_$IPAddress 2>&1 - - cat /tmp/deassignElasticIPInfo_$IPAddress | grep ADDRESS > /tmp/deassignElasticIPStatus_$IPAddress - if [ `cat /tmp/deassignElasticIPStatus_$IPAddress | wc -c` -eq 0 ]; then - echo "Failed, check /tmp/deassignElasticIPStatus_$IPAddress" - exit 1 - fi - - echo "Success" - exit 0 -} - -getSubnet() { - #get local Instance ID - getInstancePrivate >/dev/null 2>&1 - #get Subnet - subnet=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $16}'` - if [ "$subnet" == "" ]; then - describeInstance - fi - subnet=`cat $describeInstanceFile | grep -m 1 $instance | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $16}'` - - if [[ $subnet == *"subnet"* ]] - then - echo $subnet - else - echo "failed" - fi - - return -} - - -case "$1" in - getInstance) - getInstance - ;; - getZone) - getZone - ;; - getPrivateIP) - getPrivateIP - ;; - getKey) - getKey - ;; - getAMI) - getAMI - ;; - getType) - getType - ;; - launchInstance) - launchInstance - ;; - terminateInstance) - terminateInstance - ;; - stopInstance) - stopInstance - ;; - startInstance) - startInstance - ;; - assignElasticIP) - assignElasticIP - ;; - deassignElasticIP) - deassignElasticIP - ;; - getProfile) - getProfile - ;; - getGroup) - getGroup - ;; - getSubnet) - getSubnet - ;; - *) - echo $"Usage: $0 {launchInstance|getInstance|getZone|getPrivateIP|getType|getKey|getAMI|terminateInstance|startInstance|assignElasticIP|deassignElasticIP|getProfile|stopInstance|getGroup|getSubnet}" - exit 1 -esac - -exit $? diff --git a/oam/cloud/IDBVolumeCmds.sh b/oam/cloud/IDBVolumeCmds.sh deleted file mode 100644 index 3d64007b1..000000000 --- a/oam/cloud/IDBVolumeCmds.sh +++ /dev/null @@ -1,337 +0,0 @@ -#! /bin/sh -# IDBVolumeCmds.sh -# describe, detach and attach Volume Storage from a Cloud environment -# -# 1. Amazon EC2 - -prefix=/usr/local - -#check command -if [ "$1" = "" ]; then - echo "Enter Command Name: {create|describe|detach|attach|delete|createTag}" - exit 1 -fi - -if [ "$1" = "create" ]; then - if [ "$2" = "" ]; then - echo "Enter size of the volume, in GiB (1-1024)" - exit 1 - fi - volumeSize="$2" - - #get module-type - if [ "$3" = "" ]; then - echo "Enter Module Type" - exit 1 - fi - moduleType="$3" -fi - -if [ "$1" = "describe" ]; then - if [ "$2" = "" ]; then - echo "Enter Volume Name" - exit 1 - fi - volumeName="$2" -fi - -if [ "$1" = "detach" ]; then - if [ "$2" = "" ]; then - echo "Enter Volume Name" - exit 1 - fi - volumeName="$2" -fi - -if [ "$1" = "attach" ]; then - if [ "$2" = "" ]; then - echo "Enter Volume Name" - exit 1 - fi - volumeName="$2" - - #get instance-name and device-name - if [ "$3" = "" ]; then - echo "Enter Instance Name" - exit 1 - fi - instanceName="$3" - - if [ "$4" = "" ]; then - echo "Enter Device Name" - exit 1 - fi - deviceName="$4" -fi - -if [ "$1" = "delete" ]; then - if [ "$2" = "" ]; then - echo "Enter Volume Name" - exit 1 - fi - volumeName="$2" -fi - -if [ "$1" = "createTag" ]; then - if [ "$2" = "" ]; then - echo "Enter Resource Name" - exit 1 - fi - resourceName="$2" - - if [ "$3" = "" ]; then - echo "Enter Tag Name" - exit 1 - fi - tagName="$3" - - if [ "$4" = "" ]; then - echo "Enter Tag Value" - exit 1 - fi - tagValue="$4" -fi - - -test -f /usr/local/mariadb/columnstore/post/functions && . /usr/local/mariadb/columnstore/post/functions - -ec2=`$prefix/mariadb/columnstore/bin/getConfig Installation EC2_HOME` - -if [ $ec2 == "unassigned" ]; then - STATUS="unknown" - RETVAL=1 -fi - -java=`$prefix/mariadb/columnstore/bin/getConfig Installation JAVA_HOME` -path=`$prefix/mariadb/columnstore/bin/getConfig Installation EC2_PATH` - -export PATH=$path -export EC2_HOME=$ec2 -export JAVA_HOME=$java - -# get Keys and region -AmazonAccessKeyFile=`$prefix/mariadb/columnstore/bin/getConfig Installation AmazonAccessKey` -if [ $AmazonAccessKeyFile == "unassigned" ]; then - echo "FAILED: missing Config Setting AmazonAccessKey : $AmazonAccessKeyfile" - exit 1 -fi - -AmazonSecretKeyFile=`$prefix/mariadb/columnstore/bin/getConfig Installation AmazonSecretKey` -if [ $AmazonSecretKeyFile == "unassigned" ]; then - echo "FAILED: missing Config Setting AmazonSecretKeyFile : $AmazonSecretKeyFile" - exit 1 -fi - -AmazonAccessKey=`cat $AmazonAccessKeyFile` -AmazonSecretKey=`cat $AmazonSecretKeyFile` - -if test ! -f $AmazonAccessKeyfile ; then - echo "FAILED: missing AmazonAccessKeyfile : $AmazonAccessKeyfile" - exit 1 -fi - -if test ! -f $AmazonSecretKeyfile ; then - echo "FAILED: missing AmazonSecretKeyfile : $AmazonSecretKeyfile" - exit 1 -fi - -Region=`$prefix/mariadb/columnstore/bin/getConfig Installation AmazonRegion` - - -checkInfostatus() { - #check if attached - cat /tmp/volumeInfo_$volumeName | grep attached > /tmp/volumeStatus_$volumeName - if [ `cat /tmp/volumeStatus_$volumeName | wc -c` -ne 0 ]; then - STATUS="attached" - RETVAL=0 - return - fi - #check if available - cat /tmp/volumeInfo_$volumeName | grep available > /tmp/volumeStatus_$volumeName - if [ `cat /tmp/volumeStatus_$volumeName | wc -c` -ne 0 ]; then - STATUS="available" - RETVAL=0 - return - fi - #check if detaching - cat /tmp/volumeInfo_$volumeName | grep detaching > /tmp/volumeStatus_$volumeName - if [ `cat /tmp/volumeStatus_$volumeName | wc -c` -ne 0 ]; then - STATUS="detaching" - RETVAL=0 - return - fi - #check if attaching - cat /tmp/volumeInfo_$volumeName | grep attaching > /tmp/volumeStatus_$volumeName - if [ `cat /tmp/volumeStatus_$volumeName | wc -c` -ne 0 ]; then - STATUS="attaching" - RETVAL=0 - return - fi - #check if doesn't exist - cat /tmp/volumeInfo_$volumeName | grep "does not exist" > /tmp/volumeStatus_$volumeName - if [ `cat /tmp/volumeStatus_$volumeName | wc -c` -ne 0 ]; then - STATUS="does-not-exist" - RETVAL=1 - return - fi - #check if reports already attached from attach command - cat /tmp/volumeInfo_$volumeName | grep "already attached" > /tmp/volumeStatus_$volumeName - if [ `cat /tmp/volumeStatus_$volumeName | wc -c` -ne 0 ]; then - STATUS="already-attached" - RETVAL=1 - return - fi - #any other, unknown error - STATUS="unknown" - RETVAL=1 - return -} - -createvolume() { - # get zone - zone=`$prefix/mariadb/columnstore/bin/IDBInstanceCmds.sh getZone` - - if [ $moduleType == "um" ]; then - # get type - volumeType=`$prefix/mariadb/columnstore/bin/getConfig Installation UMVolumeType` - if [ $volumeType == "io1" ]; then - # get IOPS - volumeIOPS=`$prefix/mariadb/columnstore/bin/getConfig Installation UMVolumeIOPS` - fi - else # pm - # get type - volumeType=`$prefix/mariadb/columnstore/bin/getConfig Installation PMVolumeType` - if [ $volumeType == "io1" ]; then - # get IOPS - volumeIOPS=`$prefix/mariadb/columnstore/bin/getConfig Installation PMVolumeIOPS` - fi - fi - - #create volume - if [ $volumeType == "io1" ]; then - volume=`ec2-create-volume -O $AmazonAccessKey -W $AmazonSecretKey --region $Region -z $zone -s $volumeSize -t $volumeType -iops $volumeIOPS | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` - else - volume=`ec2-create-volume -O $AmazonAccessKey -W $AmazonSecretKey --region $Region -z $zone -s $volumeSize -t $volumeType | awk '{gsub(/^[ \t]+|[ \t]+$/,"");print $2}'` - fi - - echo $volume - return -} - -describevolume() { - #describe volume - ec2-describe-volumes -O $AmazonAccessKey -W $AmazonSecretKey --region $Region $volumeName > /tmp/volumeInfo_$volumeName 2>&1 - - checkInfostatus - echo $STATUS - return -} - -detachvolume() { - #detach volume - ec2-detach-volume -O $AmazonAccessKey -W $AmazonSecretKey --region $Region $volumeName > /tmp/volumeInfo_$volumeName 2>&1 - - checkInfostatus - if [ $STATUS == "detaching" ]; then - retries=1 - while [ $retries -ne 60 ]; do - #retry until it's attached - ec2-detach-volume -O $AmazonAccessKey -W $AmazonSecretKey --region $Region $volumeName > /tmp/volumeInfo_$volumeName 2>&1 - - checkInfostatus - if [ $STATUS == "available" ]; then - echo "available" - exit 0 - fi - ((retries++)) - sleep 1 - done - test -f /usr/local/mariadb/columnstore/post/functions && . /usr/local/mariadb/columnstore/post/functions - cplogger -w 100 "detachvolume failed: $STATUS" - echo "failed" - exit 1 - fi - - if [ $STATUS == "available" ]; then - echo "available" - exit 0 - fi - - test -f /usr/local/mariadb/columnstore/post/functions && . /usr/local/mariadb/columnstore/post/functions - cplogger -w 100 "detachvolume failed status: $STATUS" - echo $STATUS - exit 1 -} - -attachvolume() { - - #detach volume - ec2-attach-volume -O $AmazonAccessKey -W $AmazonSecretKey --region $Region $volumeName -i $instanceName -d $deviceName > /tmp/volumeInfo_$volumeName 2>&1 - - checkInfostatus - if [ $STATUS == "attaching" -o $STATUS == "already-attached" ]; then - retries=1 - while [ $retries -ne 60 ]; do - #check status until it's attached - describevolume - if [ $STATUS == "attached" ]; then - echo "attached" - exit 0 - fi - ((retries++)) - sleep 1 - done - test -f /usr/local/mariadb/columnstore/post/functions && . /usr/local/mariadb/columnstore/post/functions - cplogger -w 100 "attachvolume failed: $STATUS" - echo "failed" - exit 1 - fi - - if [ $STATUS == "attached" ]; then - echo "attached" - exit 0 - fi - - test -f /usr/local/mariadb/columnstore/post/functions && . /usr/local/mariadb/columnstore/post/functions - cplogger -w 100 "attachvolume failed: $STATUS" - echo $STATUS - exit 1 -} - -deletevolume() { - #delete volume - ec2-delete-volume -O $AmazonAccessKey -W $AmazonSecretKey --region $Region $volumeName > /tmp/deletevolume_$volumeName 2>&1 - return -} - -createTag() { - #create tag - ec2-create-tags -O $AmazonAccessKey -W $AmazonSecretKey --region $Region $resourceName --tag $tagName=$tagValue > /tmp/createTag_$volumeName 2>&1 - return -} - -case "$1" in - create) - createvolume - ;; - describe) - describevolume - ;; - detach) - detachvolume - ;; - attach) - attachvolume - ;; - delete) - deletevolume - ;; - createTag) - createTag - ;; - *) - echo $"Usage: $0 {create|describe|detach|attach|delete|}" - exit 1 -esac - -exit $? diff --git a/oam/cloud/MCSInstanceCmds.sh b/oam/cloud/MCSInstanceCmds.sh index fb7909863..a720537e7 100755 --- a/oam/cloud/MCSInstanceCmds.sh +++ b/oam/cloud/MCSInstanceCmds.sh @@ -10,6 +10,8 @@ fi export COLUMNSTORE_INSTALL_DIR=$COLUMNSTORE_INSTALL_DIR +#get temp directory +tmpdir=`$COLUMNSTORE_INSTALL_DIR/bin/getConfig SystemConfig SystemTempFileDir` #check command if [ "$1" = "" ]; then @@ -310,7 +312,7 @@ terminateInstance() { getRegion >/dev/null 2>&1 #terminate Instance - $AWSCLI terminate-instances --instance-ids $instanceName --region $Region > /tmp/termInstanceInfo_$instanceName 2>&1 + $AWSCLI terminate-instances --instance-ids $instanceName --region $Region > ${tmpdir}/termInstanceInfo_$instanceName 2>&1 return } @@ -319,7 +321,7 @@ stopInstance() { getRegion >/dev/null 2>&1 #terminate Instance - $AWSCLI stop-instances --instance-ids $instanceName --region $Region > /tmp/stopInstanceInfo_$instanceName 2>&1 + $AWSCLI stop-instances --instance-ids $instanceName --region $Region > ${tmpdir}/stopInstanceInfo_$instanceName 2>&1 return } @@ -328,11 +330,11 @@ startInstance() { getRegion >/dev/null 2>&1 #terminate Instance - $AWSCLI start-instances --instance-ids $instanceName --region $Region > /tmp/startInstanceInfo_$instanceName 2>&1 + $AWSCLI start-instances --instance-ids $instanceName --region $Region > ${tmpdir}/startInstanceInfo_$instanceName 2>&1 - cat /tmp/startInstanceInfo_$instanceName | grep InstanceId > /tmp/startInstanceStatus_$instanceName - if [ `cat /tmp/startInstanceStatus_$instanceName | wc -c` -eq 0 ]; then - echo "Failed, check /tmp/startInstanceInfo_$instanceName" + cat ${tmpdir}/startInstanceInfo_$instanceName | grep InstanceId > ${tmpdir}/startInstanceStatus_$instanceName + if [ `cat ${tmpdir}/startInstanceStatus_$instanceName | wc -c` -eq 0 ]; then + echo "Failed, check ${tmpdir}/startInstanceInfo_$instanceName" exit 1 fi echo "Success" @@ -345,11 +347,11 @@ assignElasticIP() { EIP=`$AWSCLI describe-addresses --region $Region --public-ips $IPAddress --query 'Addresses[*].AllocationId' --output text` - $AWSCLI associate-address --region $Region --instance-id $instanceName --allocation-id $EIP > /tmp/assignElasticIPInfo_$IPAddress 2>&1 + $AWSCLI associate-address --region $Region --instance-id $instanceName --allocation-id $EIP > ${tmpdir}/assignElasticIPInfo_$IPAddress 2>&1 - cat /tmp/assignElasticIPInfo_$IPAddress | grep error > /tmp/assignElasticIPStatus_$IPAddress - if [ `cat /tmp/assignElasticIPStatus_$IPAddress | wc -c` -ne 0 ]; then - echo "Failed, check /tmp/assignElasticIPInfo_$IPAddress" + cat ${tmpdir}/assignElasticIPInfo_$IPAddress | grep error > ${tmpdir}/assignElasticIPStatus_$IPAddress + if [ `cat ${tmpdir}/assignElasticIPStatus_$IPAddress | wc -c` -ne 0 ]; then + echo "Failed, check ${tmpdir}/assignElasticIPInfo_$IPAddress" exit 1 fi @@ -363,10 +365,10 @@ deassignElasticIP() { EIP=`$AWSCLI describe-addresses --region $Region --public-ips $IPAddress --query 'Addresses[*].AssociationId' --output text` - $AWSCLI disassociate-address --region $Region --association-id $EIP > /tmp/deassignElasticIPInfo_$IPAddress 2>&1 - cat /tmp/deassignElasticIPInfo_$IPAddress | grep error > /tmp/deassignElasticIPStatus_$IPAddress - if [ `cat /tmp/deassignElasticIPStatus_$IPAddress | wc -c` -ne 0 ]; then - echo "Failed, check /tmp/deassignElasticIPStatus_$IPAddress" + $AWSCLI disassociate-address --region $Region --association-id $EIP > ${tmpdir}/deassignElasticIPInfo_$IPAddress 2>&1 + cat ${tmpdir}/deassignElasticIPInfo_$IPAddress | grep error > ${tmpdir}/deassignElasticIPStatus_$IPAddress + if [ `cat ${tmpdir}/deassignElasticIPStatus_$IPAddress | wc -c` -ne 0 ]; then + echo "Failed, check ${tmpdir}/deassignElasticIPStatus_$IPAddress" exit 1 fi diff --git a/oam/cloud/MCSVolumeCmds.sh b/oam/cloud/MCSVolumeCmds.sh index c7a231261..9311000c1 100755 --- a/oam/cloud/MCSVolumeCmds.sh +++ b/oam/cloud/MCSVolumeCmds.sh @@ -10,6 +10,9 @@ fi export COLUMNSTORE_INSTALL_DIR=$COLUMNSTORE_INSTALL_DIR +#get temp directory +tmpdir=`$COLUMNSTORE_INSTALL_DIR/bin/getConfig SystemConfig SystemTempFileDir` + #check command if [ "$1" = "" ]; then echo "Enter Command Name: {create|describe|detach|attach|delete|createTag}" @@ -108,43 +111,43 @@ Region=`$COLUMNSTORE_INSTALL_DIR/bin/MCSInstanceCmds.sh getRegion` checkInfostatus() { #check if attached - cat /tmp/volumeInfo_$volumeName | grep attached > /tmp/volumeStatus_$volumeName - if [ `cat /tmp/volumeStatus_$volumeName | wc -c` -ne 0 ]; then + cat ${tmpdir}/volumeInfo_$volumeName | grep attached > ${tmpdir}/volumeStatus_$volumeName + if [ `cat ${tmpdir}/volumeStatus_$volumeName | wc -c` -ne 0 ]; then STATUS="attached" RETVAL=0 return fi #check if available - cat /tmp/volumeInfo_$volumeName | grep available > /tmp/volumeStatus_$volumeName - if [ `cat /tmp/volumeStatus_$volumeName | wc -c` -ne 0 ]; then + cat ${tmpdir}/volumeInfo_$volumeName | grep available > ${tmpdir}/volumeStatus_$volumeName + if [ `cat ${tmpdir}/volumeStatus_$volumeName | wc -c` -ne 0 ]; then STATUS="available" RETVAL=0 return fi #check if detaching - cat /tmp/volumeInfo_$volumeName | grep detaching > /tmp/volumeStatus_$volumeName - if [ `cat /tmp/volumeStatus_$volumeName | wc -c` -ne 0 ]; then + cat ${tmpdir}/volumeInfo_$volumeName | grep detaching > ${tmpdir}/volumeStatus_$volumeName + if [ `cat ${tmpdir}/volumeStatus_$volumeName | wc -c` -ne 0 ]; then STATUS="detaching" RETVAL=0 return fi #check if attaching - cat /tmp/volumeInfo_$volumeName | grep attaching > /tmp/volumeStatus_$volumeName - if [ `cat /tmp/volumeStatus_$volumeName | wc -c` -ne 0 ]; then + cat ${tmpdir}/volumeInfo_$volumeName | grep attaching > ${tmpdir}/volumeStatus_$volumeName + if [ `cat ${tmpdir}/volumeStatus_$volumeName | wc -c` -ne 0 ]; then STATUS="attaching" RETVAL=0 return fi #check if doesn't exist - cat /tmp/volumeInfo_$volumeName | grep "does not exist" > /tmp/volumeStatus_$volumeName - if [ `cat /tmp/volumeStatus_$volumeName | wc -c` -ne 0 ]; then + cat ${tmpdir}/volumeInfo_$volumeName | grep "does not exist" > ${tmpdir}/volumeStatus_$volumeName + if [ `cat ${tmpdir}/volumeStatus_$volumeName | wc -c` -ne 0 ]; then STATUS="does-not-exist" RETVAL=1 return fi #check if reports already attached from attach command - cat /tmp/volumeInfo_$volumeName | grep "already attached" > /tmp/volumeStatus_$volumeName - if [ `cat /tmp/volumeStatus_$volumeName | wc -c` -ne 0 ]; then + cat ${tmpdir}/volumeInfo_$volumeName | grep "already attached" > ${tmpdir}/volumeStatus_$volumeName + if [ `cat ${tmpdir}/volumeStatus_$volumeName | wc -c` -ne 0 ]; then STATUS="already-attached" RETVAL=1 return @@ -188,7 +191,7 @@ createvolume() { describevolume() { #describe volume - $AWSCLI describe-volumes --volume-ids $volumeName --region $Region > /tmp/volumeInfo_$volumeName 2>&1 + $AWSCLI describe-volumes --volume-ids $volumeName --region $Region > ${tmpdir}/volumeInfo_$volumeName 2>&1 checkInfostatus echo $STATUS @@ -197,14 +200,14 @@ describevolume() { detachvolume() { #detach volume - $AWSCLI detach-volume --volume-id $volumeName --region $Region > /tmp/volumeInfo_$volumeName 2>&1 + $AWSCLI detach-volume --volume-id $volumeName --region $Region > ${tmpdir}/volumeInfo_$volumeName 2>&1 checkInfostatus if [ $STATUS == "detaching" ]; then retries=1 while [ $retries -ne 10 ]; do #retry until it's attached - $AWSCLI detach-volume --volume-id $volumeName --region $Region > /tmp/volumeInfo_$volumeName 2>&1 + $AWSCLI detach-volume --volume-id $volumeName --region $Region > ${tmpdir}/volumeInfo_$volumeName 2>&1 checkInfostatus if [ $STATUS == "available" ]; then @@ -234,7 +237,7 @@ detachvolume() { attachvolume() { #detach volume - $AWSCLI attach-volume --volume-id $volumeName --instance-id $instanceName --device $deviceName --region $Region > /tmp/volumeInfo_$volumeName 2>&1 + $AWSCLI attach-volume --volume-id $volumeName --instance-id $instanceName --device $deviceName --region $Region > ${tmpdir}/volumeInfo_$volumeName 2>&1 checkInfostatus if [ $STATUS == "attaching" -o $STATUS == "already-attached" ]; then @@ -268,13 +271,13 @@ attachvolume() { deletevolume() { #delete volume - $AWSCLI delete-volume --volume-id $volumeName --region $Region > /tmp/deletevolume_$volumeName 2>&1 + $AWSCLI delete-volume --volume-id $volumeName --region $Region > ${tmpdir}/deletevolume_$volumeName 2>&1 return } createTag() { #create tag - $AWSCLI create-tags --resources $resourceName --tags Key=$tagName,Value=$tagValue --region $Region > /tmp/createTag_$volumeName 2>&1 + $AWSCLI create-tags --resources $resourceName --tags Key=$tagName,Value=$tagValue --region $Region > ${tmpdir}/createTag_$resourceName 2>&1 return } diff --git a/oam/etc/CMakeLists.txt b/oam/etc/CMakeLists.txt index 6e334e7b6..0470ac0ae 100644 --- a/oam/etc/CMakeLists.txt +++ b/oam/etc/CMakeLists.txt @@ -3,6 +3,4 @@ install(FILES AlarmConfig.xml Columnstore.xml ProcessConfig.xml ConsoleCmds.xml - Columnstore.xml.singleserver - ProcessConfig.xml.singleserver DESTINATION ${ENGINE_ETCDIR} COMPONENT platform) diff --git a/oam/etc/Calpont.xml b/oam/etc/Calpont.xml deleted file mode 100755 index a63fe8127..000000000 --- a/oam/etc/Calpont.xml +++ /dev/null @@ -1,544 +0,0 @@ - - - - - - 0.0.0.0 - 8601 - unassigned - - - 0.0.0.0 - 8602 - - - 0.0.0.0 - 8603 - - - 0.0.0.0 - 8604 - - - 0.0.0.0 - 8605 - - - - - 127.0.0.1 - 8800 - - - 0.0.0.0 - 8800 - - - 0.0.0.0 - 8800 - - - 0.0.0.0 - 8800 - - - 0.0.0.0 - 8622 - - - 0.0.0.0 - 8622 - - - 0.0.0.0 - 8622 - - - 0.0.0.0 - 8630 - - - 0.0.0.0 - 8612 - - - 0.0.0.0 - 8614 - - - 10000 - - - 1 - 8 - 128 - 10K - 0 - 13 - 512 - 512 - - 1 - 0 - y - - - - y - - - 0.0.0.0 - 8620 - - - 0.0.0.0 - 8620 - - - 0.0.0.0 - 8620 - - - 0.0.0.0 - 8620 - - - 0.0.0.0 - 8620 - - - 0.0.0.0 - 8620 - - - 0.0.0.0 - 8620 - - - 0.0.0.0 - 8620 - - - 0.0.0.0 - 8620 - - - 0.0.0.0 - 8620 - - - 0.0.0.0 - 8620 - - - 0.0.0.0 - 8620 - - - 0.0.0.0 - 8620 - - - 0.0.0.0 - 8620 - - - 0.0.0.0 - 8620 - - - 0.0.0.0 - 8620 - - - 0.0.0.0 - 8620 - - - 0.0.0.0 - 8620 - - - 0.0.0.0 - 8620 - - - 0.0.0.0 - 8620 - - - 0.0.0.0 - 8620 - - - 0.0.0.0 - 8620 - - - 0.0.0.0 - 8620 - - - 0.0.0.0 - 8620 - - - 0.0.0.0 - 8620 - - - 0.0.0.0 - 8620 - - - 0.0.0.0 - 8620 - - - 0.0.0.0 - 8620 - - - 0.0.0.0 - 8620 - - - 0.0.0.0 - 8620 - - - 0.0.0.0 - 8620 - - - 0.0.0.0 - 8620 - - - C - columnstore-1 - pm1 - unassigned - unassigned - 1 - 3 - 6 // 2.5 minutes - - - 1 - $INSTALLDIR/data1 - $INSTALLDIR/data1/systemFiles/dbrm/BRM_saves - $INSTALLDIR/data1/systemFiles/dbrm/tablelocks - 20 - 100000 - 90 - 80 - 70 - /tmp - /tmp - 10 - 0.0.0.0 - 128M - 10 - /tmp/columnstore_tmp_files - $INSTALLDIR - 10 - 120 - restartSystem - n - 95 - OFF - - /tmp/rdwrscratch - - - dm - Director Module - SIMPLEX - 0 - 0.0.0.0 - unassigned - ENABLED - 0 - 0 - 0 - 0 - 90 - 80 - 70 - 90 - 0 - 0 - 90 - 80 - 70 - / - unassigned - unassigned - um - User Module - SIMPLEX - 1 - 0.0.0.0 - unassigned - ENABLED - 0 - 0 - 0 - 0 - 90 - 80 - 70 - 90 - 0 - 0 - 90 - 80 - 70 - / - unassigned - unassigned - pm - Performance Module - SIMPLEX - 1 - 0.0.0.0 - unassigned - ENABLED - 0 - 0 - 0 - 0 - 90 - 80 - 70 - 90 - 0 - 0 - 90 - 80 - 70 - / - 1 - 1 - - - 0 - unassigned - 0.0.0.0 - ENABLED - - - 1000 - $INSTALLDIR/data1/systemFiles/dbrm/SMTxnID - - - - 1GB - - - - $INSTALLDIR/data1/systemFiles/dbrm/oidbitmap - - 3000 - - - $INSTALLDIR/data/bulk - $INSTALLDIR/data1/systemFiles/bulkRollback - 98 - 1 - - - 1 - 0.0.0.0 - 8616 - - - - 0.0.0.0 - 8700 - unassigned - - - 0.0.0.0 - 8700 - unassigned - - - 0.0.0.0 - 8700 - unassigned - - - 0.0.0.0 - 8700 - unassigned - - - 0.0.0.0 - 8700 - unassigned - - - 0.0.0.0 - 8700 - unassigned - - - 0.0.0.0 - 8700 - unassigned - - - 0.0.0.0 - 8700 - unassigned - - - 0.0.0.0 - 8700 - unassigned - - - 0.0.0.0 - 8700 - unassigned - - - - - - 1 - 0 - 0 - 65536 - 2K - 200 - 0 - - - n - n - n - 2 - n - n - internal - internal - rpm - unassigned - mariadb1 - unassigned - unassigned - unassigned - us-east-1 - unassigned - unassigned - autoassign - unassigned - unassigned - unassigned - standard - unassigned - unassigned - unassigned - standard - unassigned - y - y - 0 - unassigned - unassigned - n - 0 - unassigned - n - unassigned - unassigned - 3306 - unassigned - /dev/xvd - - - - 4 - 2 - 0x0 - - - 128 - 128K - 128 - 64M - 50% - 10% - 100 - N - - $INSTALLDIR/tmp - Y - - - 16K - 32 - 1 - - - 20 - - - 1M - 1M - 512 - - - - - - - - unassigned - 3306 - unassigned - - - - N - - - N - - - Y - - - 127.0.0.1 - 0 - - - diff --git a/oam/etc/Calpont.xml.singleserver b/oam/etc/Calpont.xml.singleserver deleted file mode 100644 index eaed66037..000000000 --- a/oam/etc/Calpont.xml.singleserver +++ /dev/null @@ -1,530 +0,0 @@ - - - - - 127.0.0.1 - 8601 - pm1 - - - 0.0.0.0 - 8602 - - - 127.0.0.1 - 8603 - - - 127.0.0.1 - 8604 - - - 0.0.0.0 - 8605 - - - 127.0.0.1 - 8800 - - - 0.0.0.0 - 8800 - - - 0.0.0.0 - 8800 - - - 127.0.0.1 - 8800 - - - 0.0.0.0 - 8622 - - - 0.0.0.0 - 8622 - - - 127.0.0.1 - 8622 - - - 127.0.0.1 - 8630 - - - 127.0.0.1 - 8612 - - - 127.0.0.1 - 8614 - - - 10000 - - - 1 - 8 - 128 - - 10K - 0 - 13 - 512 - 512 - - 1 - 0 - n - - - - 95 - - - 127.0.0.1 - 8620 - - - 127.0.0.1 - 8620 - - - 127.0.0.1 - 8620 - - - 127.0.0.1 - 8620 - - - 127.0.0.1 - 8620 - - - 127.0.0.1 - 8620 - - - 127.0.0.1 - 8620 - - - 127.0.0.1 - 8620 - - - 127.0.0.1 - 8620 - - - 127.0.0.1 - 8620 - - - 127.0.0.1 - 8620 - - - 127.0.0.1 - 8620 - - - 127.0.0.1 - 8620 - - - 127.0.0.1 - 8620 - - - 127.0.0.1 - 8620 - - - 127.0.0.1 - 8620 - - - 127.0.0.1 - 8620 - - - 127.0.0.1 - 8620 - - - 127.0.0.1 - 8620 - - - 127.0.0.1 - 8620 - - - 127.0.0.1 - 8620 - - - 127.0.0.1 - 8620 - - - 127.0.0.1 - 8620 - - - 127.0.0.1 - 8620 - - - 127.0.0.1 - 8620 - - - 127.0.0.1 - 8620 - - - 127.0.0.1 - 8620 - - - 127.0.0.1 - 8620 - - - 127.0.0.1 - 8620 - - - 127.0.0.1 - 8620 - - - 127.0.0.1 - 8620 - - - 127.0.0.1 - 8620 - - - C - columnstore-1 - pm1 - unassigned - - - 1 - $INSTALLDIR/data1 - $INSTALLDIR/data1/systemFiles/dbrm/BRM_saves - $INSTALLDIR/data1/systemFiles/dbrm/tablelocks - 20 - 100000 - 90 - 80 - 70 - /tmp - /tmp - 10 - 0.0.0.0 - 128M - 10 - /tmp/columnstore_tmp_files - $INSTALLDIR - 10 - 3 - 10 - 120 - restartSystem - n - 95 - OFF - - /tmp/rdwrscratch - - - dm - Director Module - SIMPLEX - 0 - 0.0.0.0 - unassigned - ENABLED - 0 - 0 - 0 - 0 - 90 - 80 - 70 - 90 - 0 - 0 - 90 - 80 - 70 - / - unassigned - unassigned - um - User Module - SIMPLEX - 0 - 0.0.0.0 - unassigned - ENABLED - 0 - 0 - 0 - 0 - 90 - 80 - 70 - 90 - 0 - 0 - 90 - 80 - 70 - / - unassigned - unassigned - pm - Performance Module - SIMPLEX - 1 - 127.0.0.1 - localhost - ENABLED - 0 - 0 - 0 - 0 - 90 - 80 - 70 - 90 - 0 - 0 - 90 - 80 - 70 - / - 1 - 1 - - - 0 - unassigned - 0.0.0.0 - ENABLED - - - 1000 - $INSTALLDIR/data1/systemFiles/dbrm/CalpontShm - $INSTALLDIR/data1/systemFiles/dbrm/SMTxnID - - - $INSTALLDIR/data1/systemFiles/dbrm/CalpontSessionMonitorShm - 10 - - - - 1GB - - - - - $INSTALLDIR/data1/systemFiles/dbrm/oidbitmap - - 3000 - - - $INSTALLDIR/data/bulk - $INSTALLDIR/data/bulk/rollback - 98 - 1 - - - 1 - 127.0.0.1 - 8616 - - - - 127.0.0.1 - 8700 - pm1 - - - 0.0.0.0 - 8700 - unassigned - - - 0.0.0.0 - 8700 - unassigned - - - 0.0.0.0 - 8700 - unassigned - - - 0.0.0.0 - 8700 - unassigned - - - 0.0.0.0 - 8700 - unassigned - - - 0.0.0.0 - 8700 - unassigned - - - 0.0.0.0 - 8700 - unassigned - - - 0.0.0.0 - 8700 - unassigned - - - 0.0.0.0 - 8700 - unassigned - - - - 50 - - 1 - 0 - 0 - 65536 - 2K - 200 - 0 - - - n - y - y - 2 - n - n - internal - internal - unassigned - unassigned - unassigned - rpm - unassigned - unassigned - us-east-1 - unassigned - unassigned - unassigned - unassigned - unassigned - unassigned - unassigned - unassigned - n - n - 0 - unassigned - unassigned - n - unassigned - unassigned - 3306 - unassigned - - - - 4 - 2 - 0x0 - - - 128 - 128K - 128 - 64M - 25% - 10% - 100 - N - - $INSTALLDIR/tmp - Y - - - 16K - 32 - 1 - - - 20 - - - 1M - 1M - 512 - - - - - - - - unassigned - 3306 - unassigned - - - - N - - - N - - - Y - - - 127.0.0.1 - 0 - - diff --git a/oam/etc/Columnstore.xml b/oam/etc/Columnstore.xml index 5bafb9f96..6ffd1efe7 100644 --- a/oam/etc/Columnstore.xml +++ b/oam/etc/Columnstore.xml @@ -249,13 +249,14 @@ 90 80 70 - /tmp + 10 0.0.0.0 128M 10 - /tmp/columnstore_tmp_files $INSTALLDIR 10 120 @@ -266,7 +267,9 @@ - /tmp/rdwrscratch + /rdwrscratch + /columnstore_tmp_files + /tmp/columnstore_tmp_files dm @@ -445,7 +448,6 @@ internal rpm unassigned - mariadb1 unassigned autoassign unassigned @@ -469,6 +471,8 @@ 3306 /dev/xvd n + /var/lock/subsys + unassigned - $INSTALLDIR/tmp + files are left behind. + /tmp --> Y diff --git a/oam/etc/Columnstore.xml.singleserver b/oam/etc/Columnstore.xml.singleserver index 8768eb6ce..2ed98d87f 100644 --- a/oam/etc/Columnstore.xml.singleserver +++ b/oam/etc/Columnstore.xml.singleserver @@ -463,6 +463,7 @@ unassigned 3306 y + /var/lock/subsys