nodetool disablebinary
Disables the CQL native transport, stopping the node from accepting new client connections.
Synopsis
Section titled “Synopsis”nodetool [connection_options] disablebinarySee connection options for connection options.
Description
Section titled “Description”nodetool disablebinary disables the CQL native transport protocol, which handles all CQL client connections. Once disabled, the node stops listening on the native transport port, and existing connections are terminated.
Native Transport Port Configuration
Section titled “Native Transport Port Configuration”The native transport port is configured in cassandra.yaml:
native_transport_port: 9042 # Default CQL portTo verify the current port and whether it is listening:
# Check if Cassandra is listening on the CQL portnetstat -tlnp | grep 9042
# Alternative using ssss -tlnp | grep 9042
# Check the configured port in cassandra.yamlgrep native_transport_port /etc/cassandra/cassandra.yamlThis command is commonly used for:
- Controlled maintenance - Stop new traffic before maintenance
- Load shedding - Remove node from client traffic during issues
- Graceful node removal - First step before gossip disable or drain
- Rolling restarts - Prevent traffic during restart procedure
Client Impact
Disabling binary causes clients to lose their connection to this node. Ensure CQL drivers are configured with multiple contact points so they can failover to other nodes.
Behavior
Section titled “Behavior”When binary transport is disabled:
- The node stops listening on the native transport port
- New connection attempts are refused
- Existing connections are terminated (may take a few seconds)
- The node remains in the cluster and participates in gossip
- The node can still receive replicated writes (as a replica, not coordinator)
Examples
Section titled “Examples”Basic Usage
Section titled “Basic Usage”nodetool disablebinaryVerify Disabled
Section titled “Verify Disabled”nodetool disablebinarynodetool statusbinary# Expected output: not runningVerify Port Closed
Section titled “Verify Port Closed”nodetool disablebinarysleep 2netstat -tlnp | grep 9042# Should return nothing (port not listening)When to Use
Section titled “When to Use”Pre-Maintenance
Section titled “Pre-Maintenance”Stop client traffic before maintenance:
# Stop accepting new clientsnodetool disablebinary
# Wait for in-flight requestssleep 10
# Perform maintenance...
# Restore client accessnodetool enablebinaryBefore Node Restart
Section titled “Before Node Restart”Graceful traffic removal before restart:
# Remove from client trafficnodetool disablebinary
# Wait for connections to drainsleep 30
# Perform drain for graceful shutdownnodetool drain
# Restartsystemctl restart cassandraLoad Shedding
Section titled “Load Shedding”Temporarily remove an overloaded node from client traffic:
# Check current loadnodetool tpstats # Look for backed up requests
# Remove from client trafficnodetool disablebinary
# Address the issue...
# Restorenodetool enablebinaryRolling Upgrade Procedure
Section titled “Rolling Upgrade Procedure”# Step 1: Remove from client trafficnodetool disablebinarysleep 10
# Step 2: Wait for in-flight operationsnodetool tpstats # Verify queues drain
# Step 3: Drain and stopnodetool drainsystemctl stop cassandra
# Step 4: Perform upgrade...
# Step 5: Start Cassandra (binary auto-enables)systemctl start cassandra
# Step 6: Verifynodetool statusbinary # Should be: runningControlled Node Isolation
Section titled “Controlled Node Isolation”For full isolation, disable binary first, then gossip:
# Step 1: Stop client trafficnodetool disablebinary
# Step 2: Wait for requests to completesleep 15
# Step 3: Isolate from clusternodetool disablegossipWhat Happens to Existing Connections
Section titled “What Happens to Existing Connections”When binary is disabled:
| Phase | Duration | Client Experience |
|---|---|---|
| Immediate | 0-1 second | New connections refused |
| Short-term | 1-10 seconds | Existing queries may complete |
| Cleanup | 10-30 seconds | All connections terminated |
Client Driver Behavior
Section titled “Client Driver Behavior”Most CQL drivers handle this gracefully:
| Driver Feature | Behavior |
|---|---|
| Connection pooling | Detects closed connections, removes from pool |
| Failover | Routes to other nodes automatically |
| Reconnection | Attempts reconnect per policy |
| Request retry | Retries on different coordinator |
Order of Operations
Section titled “Order of Operations”Graceful Maintenance Sequence
Section titled “Graceful Maintenance Sequence”| Step | Command | Wait | Reason |
|---|---|---|---|
| 1 | disablebinary | 10-30s | Stop new client traffic |
| 2 | Wait | varies | Allow in-flight requests to complete |
| 3 | Maintenance | - | Perform the actual maintenance |
| 4 | enablebinary | 2s | Restore client access |
| 5 | Verify | - | Confirm clients can connect |
Graceful Shutdown Sequence
Section titled “Graceful Shutdown Sequence”| Step | Command | Wait | Reason |
|---|---|---|---|
| 1 | disablebinary | 10s | Stop clients |
| 2 | drain | varies | Flush data, stop gossip |
| 3 | Stop service | - | Shutdown process |
Binary vs Gossip vs Drain
Section titled “Binary vs Gossip vs Drain”| Command | Binary | Gossip | Memtables | Use Case |
|---|---|---|---|---|
disablebinary | Disabled | Running | In memory | Maintenance (stay in cluster) |
disablegossip | Unchanged | Disabled | In memory | Network isolation |
drain | Disabled | Disabled | Flushed | Graceful shutdown |
Choosing the Right Command
Section titled “Choosing the Right Command”| Scenario | Use |
|---|---|
| Quick maintenance, stay in cluster | disablebinary |
| Network debugging, isolation | disablegossip |
| Node restart or shutdown | drain |
| Full isolation before shutdown | disablebinary → disablegossip |
Verification
Section titled “Verification”Command Verification
Section titled “Command Verification”nodetool statusbinary# Expected: not runningPort Verification
Section titled “Port Verification”# Port should not be listeningnetstat -tlnp | grep 9042# (no output expected)
ss -tlnp | grep 9042# (no output expected)Connection Count
Section titled “Connection Count”# Before disable - count connectionsnetstat -an | grep 9042 | grep ESTABLISHED | wc -l# Output: 42
# After disablenodetool disablebinarysleep 5netstat -an | grep 9042 | grep ESTABLISHED | wc -l# Output: 0Impact Assessment
Section titled “Impact Assessment”On This Node
Section titled “On This Node”| Aspect | Impact |
|---|---|
| Client connections | Refused |
| Coordinator role | Cannot serve as coordinator |
| Replica role | Still receives writes from coordinators |
| Gossip | Still participating |
| Cluster membership | Still visible as UP |
On Cluster
Section titled “On Cluster”| Aspect | Impact |
|---|---|
| Client capacity | Reduced by one node |
| Coordinator load | Distributed to other nodes |
| Replication | Unchanged (node still receives replicas) |
| Consistency | Unchanged (if RF > 1) |
On Clients
Section titled “On Clients”| Aspect | Impact |
|---|---|
| Active connections | Terminated |
| New connections | Refused, failover to other nodes |
| In-flight requests | May fail or retry |
| Request latency | May increase (fewer coordinators) |
Monitoring
Section titled “Monitoring”Before Disabling
Section titled “Before Disabling”# Count current connectionsnetstat -an | grep 9042 | grep ESTABLISHED | wc -l
# Check for active requestsnodetool tpstats | grep -E "Native|Request"During Disable
Section titled “During Disable”# Watch connections drainwatch 'netstat -an | grep 9042 | wc -l'After Disabling
Section titled “After Disabling”# Verify statusnodetool statusbinary
# Check other nodes absorbed trafficssh other_node "nodetool tpstats"Troubleshooting
Section titled “Troubleshooting”Binary Won't Disable
Section titled “Binary Won't Disable”If status still shows "running":
# Retrynodetool disablebinary
# Check JMX connectivitynodetool info
# Check logstail /var/log/cassandra/system.log | grep -i binaryConnections Still Showing
Section titled “Connections Still Showing”If connections persist after disable:
# Check TIME_WAIT connections (normal)netstat -an | grep 9042 | grep TIME_WAIT | wc -l
# These will clear automatically in ~60 secondsClients Not Failing Over
Section titled “Clients Not Failing Over”If clients report errors instead of failing over:
# Check client driver configuration:# - Multiple contact points configured?# - Reconnection policy enabled?# - Appropriate retry policy?
# Check other nodes are healthynodetool statusAutomation Script
Section titled “Automation Script”#!/bin/bash# disable_client_access.sh - Safely remove node from client traffic
echo "=== Current State ==="echo "Binary: $(nodetool statusbinary)"echo "Connections: $(netstat -an 2>/dev/null | grep 9042 | grep ESTABLISHED | wc -l)"
echo ""echo "=== Disabling Binary Transport ==="
# Disable binarynodetool disablebinary
# Wait for connections to drainecho "Waiting for connections to drain..."for i in {1..30}; do conns=$(netstat -an 2>/dev/null | grep 9042 | grep ESTABLISHED | wc -l) if [ "$conns" -eq 0 ]; then echo "All connections drained" break fi echo " Remaining connections: $conns" sleep 1done
# Verifyecho ""echo "=== Verification ==="echo "Binary: $(nodetool statusbinary)"echo "Connections: $(netstat -an 2>/dev/null | grep 9042 | grep ESTABLISHED | wc -l)"
# Check node still in clusterecho ""echo "=== Cluster Status ==="nodetool status | head -10
echo ""echo "Node removed from client traffic but still in cluster."echo "To restore: nodetool enablebinary"Wait Time Recommendations
Section titled “Wait Time Recommendations”| Scenario | Recommended Wait After Disable |
|---|---|
| Quick config change | 5-10 seconds |
| Rolling restart | 30-60 seconds |
| Before drain | 10-30 seconds |
| Heavy load node | 60-120 seconds |
Calculating Wait Time
Section titled “Calculating Wait Time”# Check current request ratenodetool proxyhistograms | head -5
# General rule: wait until tpstats shows minimal pendingnodetool tpstats | grep -E "Native|Read|Write"# Wait until "Pending" columns are near zeroBest Practices
Section titled “Best Practices”Binary Disable Guidelines
- Monitor before disabling - Know current connection count and load
- Allow drain time - Wait for in-flight requests to complete
- Verify client failover - Ensure clients connect to other nodes
- Keep gossip running - Node stays in cluster for replication
- Document the action - Note when and why binary was disabled
- Set time limits - Don't leave disabled indefinitely
- Re-enable promptly - Restore client access after maintenance
Related Commands
Section titled “Related Commands”| Command | Relationship |
|---|---|
| enablebinary | Re-enable CQL transport |
| statusbinary | Check transport status |
| disablegossip | Disable gossip (further isolation) |
| drain | Full graceful shutdown prep |
| tpstats | Monitor request handling |
| netstats | Network/streaming statistics |