MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
restart_node.inc
1 ##
2 ## Restarts a single NDB data node
3 ##
4 ## Parameters:
5 ## $ndb_node_id - The node to be restarted
6 ## $waiter_timeout_start - How long wo tait for a single node to start, default 120 seconds
7 ## $waiter_timeout_stop - How long to wait for a single node to stop, default 60 seconds
8 ##
9 ## In addition, $NDB_CONNECTSTRING, $NDB_MGM, $NDB_TOOLS_DIR and $NDB_TOOLS_OUTPUT
10 ## must be set (they are normally proivided by MTR).
11 ##
12 
13 # Default values
14 if (`SELECT LENGTH('$waiter_timeout_start') = 0`) {
15  let $waiter_timeout_start= 120;
16 }
17 if (`SELECT LENGTH('$waiter_timeout_stop') = 0`) {
18  let $waiter_timeout_stop= 60;
19 }
20 
21 --echo # Restarting node $ndb_node_id, timeouts: start: $waiter_timeout_start seconds, stop: $waiter_timeout_stop seconds:
22 
23 --append_file $NDB_TOOLS_OUTPUT
24 # Restarting random node, stopping part:
25 EOF
26 --exec $NDB_MGM -e "show" >> $NDB_TOOLS_OUTPUT
27 --exec $NDB_MGM -e "$ndb_node_id restart -n" >> $NDB_TOOLS_OUTPUT
28 --exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" --wait-nodes=$ndb_node_id --not-started --timeout=$waiter_timeout_stop >> $NDB_TOOLS_OUTPUT
29 
30 --append_file $NDB_TOOLS_OUTPUT
31 # Restarting random node, starting part:
32 EOF
33 --exec $NDB_MGM -e "show" >> $NDB_TOOLS_OUTPUT
34 --exec $NDB_MGM -e "$ndb_node_id start" >> $NDB_TOOLS_OUTPUT
35 --exec $NDB_TOOLS_DIR/ndb_waiter --no-defaults --ndb-connectstring="$NDB_CONNECTSTRING" --timeout=$waiter_timeout_start >> $NDB_TOOLS_OUTPUT
36 --exec $NDB_MGM -e "show" >> $NDB_TOOLS_OUTPUT