|
| 1 | +# Actions (Async Tasks) |
| 2 | + |
| 3 | +Actions in Redis Enterprise represent asynchronous operations or tasks that are running or have completed. The action commands allow you to monitor and manage these background operations. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +Many Redis Enterprise operations are asynchronous, returning an action ID that can be used to track progress. Actions include database creation/deletion, backup operations, imports/exports, and cluster maintenance tasks. |
| 8 | + |
| 9 | +## Available Commands |
| 10 | + |
| 11 | +### List All Actions |
| 12 | + |
| 13 | +List all actions in the cluster with optional filtering: |
| 14 | + |
| 15 | +```bash |
| 16 | +# List all actions |
| 17 | +redisctl enterprise action list |
| 18 | + |
| 19 | +# Filter by status |
| 20 | +redisctl enterprise action list --status completed |
| 21 | +redisctl enterprise action list --status running |
| 22 | + |
| 23 | +# Filter by type |
| 24 | +redisctl enterprise action list --type bdb_backup |
| 25 | + |
| 26 | +# Combine filters |
| 27 | +redisctl enterprise action list --status running --type bdb_import |
| 28 | + |
| 29 | +# Output as table |
| 30 | +redisctl enterprise action list -o table |
| 31 | +``` |
| 32 | + |
| 33 | +### Get Action Details |
| 34 | + |
| 35 | +Get detailed information about a specific action: |
| 36 | + |
| 37 | +```bash |
| 38 | +# Get action by UID |
| 39 | +redisctl enterprise action get <action_uid> |
| 40 | + |
| 41 | +# Get action with specific fields using JMESPath |
| 42 | +redisctl enterprise action get <action_uid> -q "status" |
| 43 | +``` |
| 44 | + |
| 45 | +### Check Action Status |
| 46 | + |
| 47 | +Quick status check for an action (returns just the status field): |
| 48 | + |
| 49 | +```bash |
| 50 | +redisctl enterprise action status <action_uid> |
| 51 | +``` |
| 52 | + |
| 53 | +### Cancel Running Action |
| 54 | + |
| 55 | +Cancel a running action: |
| 56 | + |
| 57 | +```bash |
| 58 | +redisctl enterprise action cancel <action_uid> |
| 59 | +``` |
| 60 | + |
| 61 | +### List Actions for Database |
| 62 | + |
| 63 | +List all actions for a specific database: |
| 64 | + |
| 65 | +```bash |
| 66 | +redisctl enterprise action list-for-bdb <bdb_uid> |
| 67 | + |
| 68 | +# Filter by status for specific database |
| 69 | +redisctl enterprise action list-for-bdb <bdb_uid> --status running |
| 70 | +``` |
| 71 | + |
| 72 | +## Action Types |
| 73 | + |
| 74 | +Common action types you'll encounter: |
| 75 | + |
| 76 | +- `bdb_create` - Database creation |
| 77 | +- `bdb_delete` - Database deletion |
| 78 | +- `bdb_update` - Database configuration update |
| 79 | +- `bdb_backup` - Database backup operation |
| 80 | +- `bdb_import` - Database import operation |
| 81 | +- `bdb_export` - Database export operation |
| 82 | +- `crdb_create` - Active-Active database creation |
| 83 | +- `node_join` - Node joining cluster |
| 84 | +- `cluster_recovery` - Cluster recovery operation |
| 85 | + |
| 86 | +## Action Statuses |
| 87 | + |
| 88 | +Actions can have the following statuses: |
| 89 | + |
| 90 | +- `queued` - Action is queued for execution |
| 91 | +- `running` - Action is currently executing |
| 92 | +- `completed` - Action completed successfully |
| 93 | +- `failed` - Action failed with errors |
| 94 | +- `canceled` - Action was canceled |
| 95 | + |
| 96 | +## Examples |
| 97 | + |
| 98 | +### Monitor Database Creation |
| 99 | + |
| 100 | +```bash |
| 101 | +# Create a database (returns action_uid) |
| 102 | +ACTION_UID=$(redisctl enterprise database create --data @db.json -q "action_uid") |
| 103 | + |
| 104 | +# Check status |
| 105 | +redisctl enterprise action status $ACTION_UID |
| 106 | + |
| 107 | +# Get full details when complete |
| 108 | +redisctl enterprise action get $ACTION_UID |
| 109 | +``` |
| 110 | + |
| 111 | +### List Recent Failed Actions |
| 112 | + |
| 113 | +```bash |
| 114 | +# List failed actions in table format |
| 115 | +redisctl enterprise action list --status failed -o table |
| 116 | + |
| 117 | +# Get details of a failed action |
| 118 | +redisctl enterprise action get <failed_action_uid> -q "{error: error_message, started: start_time}" |
| 119 | +``` |
| 120 | + |
| 121 | +### Cancel Long-Running Import |
| 122 | + |
| 123 | +```bash |
| 124 | +# List running imports |
| 125 | +redisctl enterprise action list --status running --type bdb_import |
| 126 | + |
| 127 | +# Cancel specific import |
| 128 | +redisctl enterprise action cancel <import_action_uid> |
| 129 | +``` |
| 130 | + |
| 131 | +### Monitor All Database Actions |
| 132 | + |
| 133 | +```bash |
| 134 | +# Watch all actions for a database |
| 135 | +watch -n 5 "redisctl enterprise action list-for-bdb 1 -o table" |
| 136 | +``` |
| 137 | + |
| 138 | +## Integration with Async Operations |
| 139 | + |
| 140 | +The action commands work seamlessly with the `--wait` flag available on create/update/delete operations: |
| 141 | + |
| 142 | +```bash |
| 143 | +# This uses action monitoring internally |
| 144 | +redisctl enterprise database create --data @db.json --wait |
| 145 | + |
| 146 | +# Equivalent to manually monitoring: |
| 147 | +ACTION_UID=$(redisctl enterprise database create --data @db.json -q "action_uid") |
| 148 | +while [ "$(redisctl enterprise action status $ACTION_UID)" = "running" ]; do |
| 149 | + sleep 5 |
| 150 | +done |
| 151 | +``` |
| 152 | + |
| 153 | +## API Versions |
| 154 | + |
| 155 | +The action commands support both v1 and v2 API endpoints: |
| 156 | +- v2 endpoints (`/v2/actions`) are preferred when available |
| 157 | +- v1 endpoints (`/v1/actions`) are used as fallback |
| 158 | +- Both return the same data structure |
| 159 | + |
| 160 | +## Best Practices |
| 161 | + |
| 162 | +1. **Always check action status** for async operations before proceeding |
| 163 | +2. **Use filtering** to reduce output when listing many actions |
| 164 | +3. **Save action UIDs** from create/update operations for tracking |
| 165 | +4. **Set up monitoring** for critical long-running actions |
| 166 | +5. **Check failed actions** for error details to diagnose issues |
| 167 | + |
| 168 | +## Related Commands |
| 169 | + |
| 170 | +- [`enterprise database`](./databases.md) - Database operations that create actions |
| 171 | +- [`enterprise cluster`](./cluster.md) - Cluster operations that create actions |
| 172 | +- [`enterprise crdb`](./crdb.md) - Active-Active operations that create actions |
0 commit comments