forked from richrein/cassandra.bin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cassandra_node_quiesce
executable file
·35 lines (27 loc) · 2.35 KB
/
cassandra_node_quiesce
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env bash
# Use nodetool to disable Cassandra only on a specific node.
# There are times when you would like a Cassandra node to stop receiving requests or appear like it is down to outside clients.
# You may want to use this to disable a node and adjust your log4j properties for more debugging,
# or your may be running some administrative action like repair or rebuildsstables and you want this action to complete as quickly as possible.
# Being able to disable Cassandra without shutting it down completely can be very handy.
# How it works:
# Gossip is the protocol that Cassandra nodes use to determine which nodes are UP or DOWN.
# Cassandra nodes gossip to each other and maintain a state of the cluster.
# By disabling gossip other Cassandra nodes will stop forwarding read and write requests to this node
# because they will believe the node is down. Client using thrift will still be able to connect to a node in this state.
# Disablebinary disables the client port 9042 which prevents clients from connecting to this node.
# Disablethrift disables the client port 9160 which prevents clients from connecting to this node.
trace_cmd=true
cassandra_nodetool disablegossip "$@" # Disable gossip (effectively marking the node down)
cassandra_nodetool disablethrift "$@" # Disable thrift server
cassandra_nodetool disablebinary "$@" # Disable native transport (binary protocol)
# cassandra_nodetool disableautocompaction "$@" # Disable autocompaction for the given keyspace and table
# cassandra_nodetool disablebackup "$@" # Disable incremental backup
# cassandra_nodetool disablehandoff "$@" # Disable storing hinted handoffs
# cassandra_nodetool disablehintsfordc "$@" # Disable hints for a data center
# warning: test and add disabling streaming and binary protocol if needed
cassandra_nodetool drain "$@" # In theory, this should be the only request needed, but different versions have different issues justifying the rest of the lines in this file.
# sleep 300 # If flush is interrupted, manually perform sleep for 5 minutes to wait for all data to get flushed.
cassandra_nodetool flush "$@" # Empty the memtables and pending commit log changes into sstables
# sleep 300 # If flush is interrupted, manually perform sleep for 5 minutes to wait for all data to get flushed.
sync; sync # Force Linux all cached file data to disk. The second sync waits.