SQWareProduction:cassandra:bin:sqwcas RollingRestart.ksh

From Wiki_dbSQWare
Revision as of 17:09, 7 April 2024 by BatchUser (talk | contribs) (Updated by BatchUser)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Presentation

Script $gvsqw_CasBin/sqwcas_RollingRestart.ksh :


Run 'stop/start/restart' cassandra on selected nodes
You have to select le options of nodetool to execute
You can also choose:

  • Aggressiveness of run (number of seconds between two runs)
  • Aggressiveness of check end (number of seconds between two checks of end)
  • Scope of the execution (by default: Local)


** Local => only on the local node
** LocalNode => only on the local node
** Node_$NodeName => only on the node '$NodeName'
** LocalDC => all nodes on the local datacenter
** DC_$DCName => all nodes on the datacenter '$DCName'
** All => all nodes on the cluster(all datacenters)
** AllNodes => all nodes on the cluster(all datacenters)
** AllDC => all nodes on the cluster(all datacenters)

  • Force dynamic discovery of nodes (by default, search in $gvsqw_RootCfg/CAS_CHR_PRD.clucfg generated by sqwcas_GenNodesConf.ksh)



Online help

The online help is available for most scripts with the -h option.
Ex: $gvsqw_CasBin/sqwcas_RollingRestart.ksh -h
Content of this assistance :

Sourcing sqwcas_Global.lib v2025.06 SQWareProduction for Cassandra (dbSQWare) ... 

Usage: sqwcas_RollingRestart.ksh [-h] -I <CAS_SID> [+ options]

DESCRIPTION
   sqwcas_RollingRestart.ksh Run 'stop/start/restart' cassandra on selected nodes
SUPPORT
   Cassandra supported versions: 2.0 <= v <= 4.0

PARAMETERS
     -I  instance       : Target instance.
OPTIONS
     -h                 : Display the full usage.
     -s                 : Display samples of usage.
     -A    action       : Action (start, stop, restart : by default restart).
     -S    scope        : Scope of the execution (by default: Local).
                             Local           => only on the local node.
                             LocalNode       => only on the local node.
                             Node_$NodeName => only on the node '$NodeName'.
                             LocalDC         => all nodes on the local datacenter.
                             DC_$DCName     => all nodes on the datacenter '$DCName'.
                             All             => all nodes on the cluster(all datacenters).
                             AllNodes        => all nodes on the cluster(all datacenters).
                             AllDC           => all nodes on the cluster(all datacenters).
     -FRT       code    : Force return code value on error.
     -AddMail   email   : Email address to add at 'demo-sqwarebox@dbsqware.com'.
     -Timeout Nb_sec    : Timeout before kill off 'nodetool drain' command when stop (by default 900).
     -SendReport        : Send execution log report.
     -Dynamic           : Force dynamic discovery of nodes (by default, search in $gvsqw_RootCfg/.clucfg generated by sqwcas_GenNodesConf.ksh).
     -NoMail            : Disable sendmail on error demo-sqwarebox@dbsqware.com (by default, send on error).
     -Locale    locale  : Force Locale for help display (fr,en).
     -Wait              : Wait between two nodes restart (by default 120).
     -Exec              : Execute commands (by default, display generated commands).

Note:
To be sure the aid is accurate, refer directly to the online help script -h option.


Error management

Errors passing arguments

This type of message is generated:

Lack 'CAS_SID' parameter, Usage: sqwcas_RollingRestart.ksh [-h] -I <CAS_SID> [+ options]
For full help : sqwcas_RollingRestart.ksh -h

If you are connecting through a terminal, no mail will be sent and you will have more this kind of message:

Not sending mail because you are in connected mode !!!
Lack 'CAS_SID' parameter

If you are not connected to a terminal, the error message appears and is sent by mail to the address contained in the variable $gvsqw_GlobalMail (See help customize this variable). The subject line will always start by "$gvsqw_MailMsg_cassandra : " (See help customize this variable).

Note:
Sending mail can be disabled by the option -NoMail for one execution.


Execution errors

Whether you are or not connected to a terminal, the error message appears and an email containing a summary of treatment errors is sent to the address contained in the variable $gvsqw_Mail_cassandra (See help customize this variable). The subject line will always start by "$gvsqw_MailMsg_cassandra : " (See help customize this variable).

Note:
Sending mail can be disabled by the option -NoMail for one execution.


Usage examples

Sourcing sqwcas_Global.lib v2025.06 SQWareProduction for Cassandra (dbSQWare) ... 

#Standard help for script sqwcas_RollingRestart.ksh:

$gvsqw_CasBin/sqwcas_RollingRestart.ksh -h
#Display online help for this script

$gvsqw_CasBin/sqwcas_RollingRestart.ksh -Locale en -h
#Display online help for this script with forcing of the 'en' locale (by default locale managed by $gvsqw_Locale)

$gvsqw_CasBin/sqwcas_RollingRestart.ksh -s
#Display usage examples for this script

$gvsqw_CasBin/sqwcas_RollingRestart.ksh -I $CAS_SID -A <Action> -S <scope>
#Display generated commands without execute them !

$gvsqw_CasBin/sqwcas_RollingRestart.ksh -I $CAS_SID -A <Action> -S <scope> -Exec
#Execute action <Action> (start, stop, restart is default) on the instance $CAS_SID and for the <scope> selected : All, AllDC (by default is locale) or -Dynamic

$gvsqw_CasBin/sqwcas_RollingRestart.ksh -I CAS_01 -A 'stop' -Dynamic -Wait 42 -Exec
#Execute stop on the instance CAS_01, for dynamic discovery of nodes and wait 42 secondes between each retart

$gvsqw_CasBin/sqwcas_RollingRestart.ksh -I $CAS_SID -S <scope> -Timeout 1500 -Exec
#Timeout in seconds for kill inactive ssh session (by default is 7200, manage by $gvsqw_TimeOutStop)

$gvsqw_CasBin/sqwcas_RollingRestart.ksh -I $CAS_SID -AddMail 'mymail1@mydomaine.com,mymail2@mydomaine.com' -Exec
#Add the mail list to the default address managed by $gvsqw_GlobalMail (only this time), if needed separate by commas

$gvsqw_CasBin/sqwcas_RollingRestart.ksh -I $CAS_SID -SendReport -Exec
#Send the log by email at the end of the treatment even if there is no error

$gvsqw_CasBin/sqwcas_RollingRestart.ksh -I $CAS_SID -NoMail -Exec
#Disables sending an email on error to $gvsqw_GlobalMail (by default, send on error)

$gvsqw_CasBin/sqwcas_RollingRestart.ksh -I $CAS_SID -FRT <NumericValue> -Exec
#Force return code to '<NumericValue>' on error (if no error, "exit 0!")
#You can also force return code of this script on all your
#environnement if you set the variable: $gvsqw_ForcedReturnCodeScript_sqwcas_RollingRestart=<NumericValue>
#in configuration file $gvsqw_CasBin/../etc_cust/sqwcas_GlobalVar.cfg
Note:
To be sure the examples are accurate, refer directly to the online help script -s option.