Skip to content

Commit 82aab24

Browse files
authored
Add scheduled repair (#42)
1 parent e9207f5 commit 82aab24

File tree

7 files changed

+1709
-23
lines changed

7 files changed

+1709
-23
lines changed

cli/README.md

Lines changed: 204 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# AxonOps CLI
1+
# AxonOps CLI
22

33
This CLI is designed to extend the AxonOps Configuration Automation Ansible module.
44

@@ -23,72 +23,258 @@ All commands accept those attributes
2323
* `--password` Password used for AxonOps Self-Hosted when authentication is enabled.
2424
* `--url` Specify the AxonOps URL if not using the AxonOps Cloud environment.
2525

26-
### `repair` Subcommand
26+
### Connections
27+
28+
The CLI uses the same connection methods as the Ansible module. Please refer to the connection section of the main
29+
project for more information.
30+
31+
The following examples are for the organisation `test` and the cluster `thingscluster` on AxonOps Cloud.
32+
For self-hosted authentication, refer to the authentication section of the main project.
33+
34+
Authenticate to the cluster:
35+
36+
```shell
37+
export AXONOPS_ORG='test'
38+
export AXONOPS_CLUSTER="thingscluster"
39+
export AXONOPS_TOKEN='aaaaabbbbccccddddeeee'
40+
```
41+
42+
### `adaptiverepair` Subcommand
2743

2844
Manages **Adaptive Repair** in AxonOps.
2945

3046
#### Options:
3147

3248
* `--enabled` Enables AxonOps Adaptive Repair.
3349
* `--disabled` Disable AxonOps Adaptive Repair.
34-
* `--excludedtables` Excluded Tables. This parameter accepts a comma-separated list in the format `keyspace.table1,keyspace.table2`.
50+
* `--excludedtables` Excluded Tables. This parameter accepts a comma-separated list in the format
51+
`keyspace.table1,keyspace.table2`.
3552
* `--excludetwcstables` Exclude TWCS tables.
3653
* `--gcgrace` GG Grace Threshold in Seconds.
3754
* `--segmentretries` Segment Retries.
3855
* `--maxsegmentspertable` Max Segments Per Table.
3956
* `--segmenttargetsizemb` Segment Target Size in MB.
4057
* `--tableparallelism` Concurrent Repair Processes.
4158

42-
#### Examples:
43-
44-
The following Activating Adaptive Repair examples are for the organisation `test` and the cluster `thingscluster` on AxonOps Cloud.
45-
For self-hosted authentication, refer to the authentication section of the main project.
46-
47-
Authenticate to the cluster:
48-
```shell
49-
export AXONOPS_ORG='test'
50-
export AXONOPS_CLUSTER="thingscluster"
51-
export AXONOPS_TOKEN='aaaaabbbbccccddddeeee'
52-
```
59+
#### Examples:
5360

5461
Print the list of options for the repair command:
62+
5563
```shell
5664
$ pipenv run python axonops.py repair -h
5765
```
66+
5867
Enable the AxonOps Adaptive Repair:
68+
5969
```shell
6070
pipenv run python axonops.py repair --enabled
6171
```
72+
6273
Disable the repair:
74+
6375
```shell
6476
$ pipenv run python axonops.py repair --disable
6577
```
66-
Enable the repair and set the GC Grace Threshold to 86,400 seconds (AxonOps will ignore tables that have a gc_grace_seconds value lower than the specified threshold):
78+
79+
Enable the repair and set the GC Grace Threshold to 86,400 seconds (AxonOps will ignore tables that have a
80+
gc_grace_seconds value lower than the specified threshold):
81+
6782
```shell
6883
$ pipenv run python axonops.py repair --enable --gcgrace 86400
6984
```
85+
7086
Enable the repair and set the table parallelism to 100 (number of tables processed in parallel):
87+
7188
```shell
7289
$ pipenv run python axonops.py repair --enable --tableparallelism 100
7390
```
74-
Enable the repair and set the segment retry limit to 10 (number of times a segment can fail before raising an alert and stopping repairs for that cycle):
91+
92+
Enable the repair and set the segment retry limit to 10 (number of times a segment can fail before raising an alert and
93+
stopping repairs for that cycle):
94+
7595
```shell
7696
$ pipenv run python axonops.py repair --enable --segmentretries 10
7797
```
98+
7899
Enable the repair and set the segment chunk size to 250 MB (amount of data repaired at a time):
100+
79101
```shell
80102
$ pipenv run python axonops.py repair --enable --segmenttargetsizemb 250
81103
```
104+
82105
Exclude specific tables from repair (comma separated list of `keyspace.table`):
106+
83107
```shell
84-
pipenv run python axonops.py repair --enable --excludedtables system_auth.roles,system_auth.role_permissions
108+
$ pipenv run python axonops.py repair --enable --excludedtables system_auth.roles,system_auth.role_permissions
85109
```
110+
86111
Set the Maximum Segments Per Table to 131,072:
112+
87113
```shell
88-
pipenv run python axonops.py repair --enable --maxsegmentspertable 131072
114+
$ pipenv run python axonops.py repair --enable --maxsegmentspertable 131072
89115
```
90116

91117
Set the timeout per Segment to 3 hours:
118+
92119
```shell
93120
pipenv run python axonops.py repair --enable --segmenttimeout 3h
121+
```
122+
123+
### `scheduledrepair` Subcommand
124+
125+
Manages **Scheduled Repair** in AxonOps.
126+
127+
#### Options:
128+
129+
* `--keyspace` Keyspace to repair. If not set, all keyspaces will be repaired.
130+
* `--tables` Comma-separated list of tables to repair within the specified keyspace. If not set, all tables in the
131+
keyspace will be repaired.
132+
* `--excludedtables` Excluded Tables. This parameter accepts a comma-separated list in the format
133+
`keyspace.table1,keyspace.table2`.
134+
* `--nodes` Comma-separated list of node IP addresses to run the repair on. If not set, all nodes in the cluster will be
135+
included.
136+
* `--scheduleexpr` Cron Expression for Scheduled Repair. If not set, Scheduled Repair will run immediately.
137+
* `--segmented` Enables Segmented Repair.
138+
* `--segmentspernode` Number of Segments Per Token Range (only applicable if `--segmented` is set).
139+
* `--incremental` Enables Incremental Repair. If not set, a full repair will be performed.
140+
* `--jobthreads` Number of Job Threads to use for the repair process. If not set, the default value of 1 will be used.
141+
* `--partitionerrange` Repair Partitioner Range Only.
142+
* `--parallelism` Repair Parallelism. Accepted values are `sequential`, `parallel`, and `dc_parallel`. If not set, the
143+
default value of `sequential` will be used.
144+
* `--optimisestreams` Optimize Streams during repair (require Cassandra 4.1+).
145+
* `--datacenters` Comma-separated list of datacenters to include in the repair. If not set, all datacenters will be
146+
included.
147+
* `--tags` Tags to associate with the scheduled repair job. Tags are used to identify repair jobs in AxonOps.
148+
This parameter accepts a string value.
149+
* `--paxosonly` Run paxos repair only. Default is false.
150+
* `--skippaxos` Skip paxos repair. Default is false.
151+
* `--delete` Delete Scheduled Repair. This option needs to be paired with a tags value to identify which scheduled
152+
repair job to delete.
153+
* `--deleteall` Delete all Scheduled Repairs. This removes all scheduled repair jobs from the cluster.
154+
155+
#### Examples:
156+
157+
Print the list of options for the scheduled repair command:
158+
159+
```shell
160+
$ pipenv run python axonops.py scheduledrepair -h
161+
```
162+
163+
Run a scheduled repair immediately:
164+
165+
```shell
166+
$ pipenv run python axonops.py scheduledrepair
167+
```
168+
169+
Run a scheduled repair with a cron expression (this example runs the repair every Sunday at midnight):
170+
171+
```shell
172+
$ pipenv run python axonops.py scheduledrepair --scheduleexpr '0 0 * * 0'
173+
```
174+
175+
Run a scheduled repair for a specific keyspace with a cron expression (this example runs the repair for the
176+
`axonopslove` keyspace every Sunday at midnight):
177+
178+
```shell
179+
$ pipenv run python axonops.py scheduledrepair --scheduleexpr '0 0 * * 0' --keyspace axonopslove
180+
```
181+
182+
Run a scheduled repair for specific tables in a keyspace with a cron expression (this example runs the repair for the
183+
`steps5` and `steps60` tables in the `axonopslove` keyspace every Sunday at midnight):
184+
185+
```shell
186+
$ pipenv run python axonops.py scheduledrepair --scheduleexpr '0 0 * * 0' --keyspace axonopslove --tables steps5,steps60
187+
```
188+
189+
Run a scheduled repair for a specific keyspace excluding certain tables with a cron expression (this example runs the
190+
repair for the `axonopslove` keyspace every Sunday at midnight, excluding the `bad1` and `bad6` tables):
191+
192+
```shell
193+
$ pipenv run python axonops.py scheduledrepair --scheduleexpr '0 0 * * 0' --keyspace axonopslove --excludedtables axonopslove.bad1,axonopslove.bad6
194+
```
195+
196+
Run a scheduled repair on specific nodes with a cron expression (this example runs the repair every Sunday at midnight
197+
on nodes with IP addresses `172.18.0.[1,2]`):
198+
199+
```shell
200+
$ pipenv run python axonops.py scheduledrepair --scheduleexpr '0 0 * * 0' --nodes 172.18.0.1,172.18.0.2
201+
```
202+
203+
Run a segmented scheduled repair with a cron expression:
204+
205+
```shell
206+
$ pipenv run python axonops.py scheduledrepair --scheduleexpr '0 0 * * 0' --segmented
207+
```
208+
209+
Run a segmented scheduled repair with a cron expression and specify the number of segments per node (100 in this
210+
example):
211+
212+
```shell
213+
$ pipenv run python axonops.py scheduledrepair --scheduleexpr '0 0 * * 0' --segmented --segmentspernode 100
214+
```
215+
216+
Run an incremental scheduled repair with a cron expression:
217+
218+
```shell
219+
$ pipenv run python axonops.py scheduledrepair --scheduleexpr '0 0 * * 0' --incremental
220+
```
221+
222+
Run a scheduled repair with 100 job threads and a cron expression:
223+
224+
```shell
225+
$ pipenv run python axonops.py scheduledrepair --scheduleexpr '0 0 * * 0' --jobthreads 100
226+
```
227+
228+
Run a scheduled repair for the partitioner range only with a cron expression:
229+
230+
```shell
231+
$ pipenv run python axonops.py scheduledrepair --scheduleexpr '0 0 * * 0' --partitionerrange
232+
```
233+
234+
Run a scheduled repair with parallelism set to 'parallel' with a cron expression:
235+
236+
```shell
237+
$ pipenv run python axonops.py scheduledrepair --scheduleexpr '0 0 * * 0' --parallelism parallel
238+
```
239+
240+
Run a scheduled repair optimizing streams with a cron expression:
241+
242+
```shell
243+
$ pipenv run python axonops.py scheduledrepair --scheduleexpr '0 0 * * 0' --optimisestreams
244+
```
245+
246+
Run a scheduled repair for a specific datacenter with a cron expression (`dc` in this example):
247+
248+
```shell
249+
$ pipenv run python axonops.py scheduledrepair --scheduleexpr '0 0 * * 0' --datacenters dc
250+
```
251+
252+
Run a scheduled repair with tags with a cron expression:
253+
254+
```shell
255+
$ pipenv run python axonops.py scheduledrepair --scheduleexpr '0 0 * * 0' --tags 'Weekly repair'
256+
```
257+
258+
Run a scheduled paxos-only repair with a cron expression:
259+
260+
```shell
261+
$ pipenv run python axonops.py scheduledrepair --scheduleexpr '0 0 * * 0' --skippaxos
262+
```
263+
264+
Run a scheduled repair skipping paxos repair with a cron expression:
265+
266+
```shell
267+
$ pipenv run python axonops.py scheduledrepair --scheduleexpr '0 0 * * 0' --paxosonly
268+
```
269+
270+
Delete a scheduled repair job with specific tags:
271+
272+
```shell
273+
$ pipenv run python axonops.py scheduledrepair --delete --tags 'Weekly repair'
274+
```
275+
276+
Delete all scheduled repair jobs:
277+
278+
```shell
279+
$ pipenv run python axonops.py scheduledrepair --deleteall
94280
```

0 commit comments

Comments
 (0)