Skip to content

AxonOps — AI-Native Control Plane for Open Source Data Platforms

nodetool invalidatepermissionscache

Invalidates the permissions cache on the node.


Terminal window
nodetool [connection_options] invalidatepermissionscache

See connection options for connection options.

nodetool invalidatepermissionscache clears all cached permission entries on the node. The permissions cache stores authorization information, allowing Cassandra to avoid querying the system_auth.role_permissions table for every operation.

After invalidation, subsequent operations trigger fresh permission lookups from the system tables, which are then re-cached.

Authentication Required

The permissions cache is only relevant when authentication and authorization are enabled. If running with default settings (no auth), this cache is not used.


Terminal window
nodetool invalidatepermissionscache
Terminal window
# After GRANT or REVOKE operations
nodetool invalidatepermissionscache

Cached DataDescription
RoleThe authenticated role/user
ResourceThe protected resource (keyspace, table)
PermissionsGranted permissions (SELECT, MODIFY, etc.)
Without Permissions Cache:
Every Operation → Query system_auth.role_permissions → Check permission → Execute
With Permissions Cache:
Operation → Check cached permission → Execute
(Avoids repeated auth table queries)
PermissionOperations
SELECTRead data
MODIFYWrite data (INSERT, UPDATE, DELETE)
CREATECreate resources
ALTERModify resources
DROPDelete resources
AUTHORIZEGrant/revoke permissions

When GRANT or REVOKE statements don't immediately take effect:

Terminal window
# Permission change
cqlsh -e "GRANT SELECT ON my_keyspace.my_table TO analyst_role;"
# If permission not immediately effective
nodetool invalidatepermissionscache

When immediate permission revocation is critical:

Terminal window
# Revoke access immediately
cqlsh -e "REVOKE ALL ON ALL KEYSPACES FROM compromised_user;"
# Force cache refresh on all nodes
for node in $(nodetool status | grep "^UN" | awk '{print $2}'); do
ssh "$node" "nodetool invalidatepermissionscache"
done

When role hierarchies change:

Terminal window
# After modifying role membership
cqlsh -e "REVOKE admin_role FROM former_admin;"
# Invalidate to ensure changes take effect
nodetool invalidatepermissionscache

When permissions appear incorrect:

Terminal window
# Clear potentially stale permissions
nodetool invalidatepermissionscache
# Retry operation

AspectImpact
Cached permissionsAll cleared
Next operationsRequire auth table lookups
Operation latencySlight increase until cache warms
ScenarioBehavior
Permission revocationTakes effect immediately
New grantsAvailable immediately
Role changesReflected immediately

The cassandra.yaml parameter names vary by version:

Cassandra VersionValidity ParameterUpdate Interval Parameter
Pre-4.1permissions_validity_in_mspermissions_update_interval_in_ms
4.1+permissions_validitypermissions_update_interval
# cassandra.yaml (4.1+)
permissions_validity: 2s
permissions_update_interval: 1s
permissions_cache_max_entries: 1000
# cassandra.yaml (Pre-4.1)
# permissions_validity_in_ms: 2000
# permissions_update_interval_in_ms: 1000
# permissions_cache_max_entries: 1000

Permissions are automatically refreshed based on permissions_validity. Invalidation forces immediate refresh.


For permission changes to take effect cluster-wide immediately:

invalidate_permissions_cluster.sh
#!/bin/bash
echo "Invalidating permissions cache cluster-wide..."
# Get list of node IPs from local nodetool status
nodes=$(nodetool status | grep "^UN" | awk '{print $2}')
for node in $nodes; do
echo -n "$node: "
ssh "$node" 'nodetool invalidatepermissionscache 2>/dev/null && echo "invalidated" || echo "FAILED"'
done
echo "Permissions cache cleared on all nodes."
emergency_permission_revoke.sh
#!/bin/bash
USER_TO_REVOKE="$1"
if [ -z "$USER_TO_REVOKE" ]; then
echo "Usage: $0 <username>"
exit 1
fi
echo "=== Emergency Permission Revocation ==="
echo "Revoking all permissions for: $USER_TO_REVOKE"
# 1. Revoke permissions
cqlsh -e "REVOKE ALL PERMISSIONS ON ALL KEYSPACES FROM $USER_TO_REVOKE;"
# 2. Invalidate cache on all nodes
# Get list of node IPs from local nodetool status
nodes=$(nodetool status | grep "^UN" | awk '{print $2}')
for node in $nodes; do
ssh "$node" "nodetool invalidatepermissionscache 2>/dev/null"
done
echo "Permissions revoked and cache cleared."

Workflow: Permission Change with Validation

Section titled “Workflow: Permission Change with Validation”
permission_change_validated.sh
#!/bin/bash
ROLE="$1"
RESOURCE="$2"
PERMISSION="$3"
echo "=== Permission Change Workflow ==="
# 1. Show current permissions
echo "1. Current permissions for $ROLE:"
cqlsh -e "LIST ALL PERMISSIONS OF $ROLE;"
# 2. Make change
echo ""
echo "2. Granting $PERMISSION on $RESOURCE to $ROLE..."
cqlsh -e "GRANT $PERMISSION ON $RESOURCE TO $ROLE;"
# 3. Invalidate cache
echo ""
echo "3. Invalidating permissions cache..."
nodetool invalidatepermissionscache
# 4. Verify change
echo ""
echo "4. Permissions after change:"
cqlsh -e "LIST ALL PERMISSIONS OF $ROLE;"
echo ""
echo "=== Complete ==="

Terminal window
# Invalidate on the specific node handling the request
nodetool invalidatepermissionscache
# Or invalidate cluster-wide
for node in $(nodetool status | grep "^UN" | awk '{print $2}'); do
ssh "$node" "nodetool invalidatepermissionscache"
done
Terminal window
# Check system_auth tables are accessible
cqlsh -e "SELECT * FROM system_auth.roles LIMIT 1;"
# Check for auth-related errors in logs
grep -i "auth\|permission" /var/log/cassandra/system.log | tail -20
Terminal window
# Temporary increase in auth lookups is expected
# Cache will warm up quickly with normal operations
# Monitor auth-related metrics
nodetool tpstats | grep -i auth

Permissions Cache Guidelines

  1. Invalidate after critical changes - Don't wait for cache expiry for security-sensitive changes
  2. Cluster-wide for security - Always invalidate all nodes when revoking access
  3. Test permission changes - Verify changes took effect
  4. Document procedures - Have runbooks for permission-related incidents
  5. Monitor auth performance - Watch for auth-related latency

Security Considerations

  • Always invalidate cluster-wide when revoking permissions
  • Consider the cache validity period for security-sensitive environments
  • Shorter permissions_validity = more responsive but higher overhead
  • Log all permission changes for audit purposes

CommandRelationship
invalidatecredentialscacheInvalidate credentials cache
invalidaterolescacheInvalidate roles cache
invalidatenetworkpermissionscacheInvalidate network permissions