Skip to content

Commit 8c1288a

Browse files
fix(mcs): MCOL-5618: change list option to --list and refactor.
fix(mcs): list option to -li/--list for mcs backup, restore and dbrm_restore commands fix(mcs): add missed option "aro" fix(mcs): resort options for backup and dbrm_backup to keep same ordering as in original scrypt fix(mcs docs): updated README.md + mcs.1
1 parent 6a57537 commit 8c1288a

File tree

4 files changed

+143
-111
lines changed

4 files changed

+143
-111
lines changed

cmapi/mcs_cluster_tool/README.md

+19-14
Original file line numberDiff line numberDiff line change
@@ -53,26 +53,28 @@ Name of the bucket to store the columnstore backups.
5353
Example: "s3://my-cs-backups"
5454
* `-url, --endpoint-url TEXT`: Used by on premise S3 vendors.
5555
Example: "http://127.0.0.1:8000"
56-
* `-nv-ssl, --no-verify-ssl / -v-ssl, --verify-ssl`: Skips verifying ssl certs, useful for onpremise s3 storage. [default: v-ssl]
5756
* `-s, --storage TEXT`: What storage topogoly is being used by Columnstore - found in /etc/columnstore/storagemanager.cnf.
5857
Options: "LocalStorage" or "S3" [default: LocalStorage]
5958
* `-i, --incremental TEXT`: Adds columnstore deltas to an existing full backup. Backup folder to apply increment could be a value or "auto_most_recent" - the incremental backup applies to last full backup.
59+
* `-P, --parallel INTEGER`: Determines if columnstore data directories will have multiple rsync running at the same time for different subfolders to parallelize writes. Ignored if "-c/--compress" argument not set. [default: 4]
6060
* `-ha, --highavilability / -no-ha, --no-highavilability`: Hint wether shared storage is attached @ below on all nodes to see all data
6161
HA LocalStorage ( /var/lib/columnstore/dataX/ )
6262
HA S3 ( /var/lib/columnstore/storagemanager/ ) [default: no-ha]
63-
* `-f, --config-file TEXT`: Path to backup configuration file to load variables from.
63+
* `-f, --config-file TEXT`: Path to backup configuration file to load variables from - relative or full path accepted.
6464
* `-sbrm, --skip-save-brm / -no-sbrm, --no-skip-save-brm`: Skip saving brm prior to running a backup - ideal for dirty backups. [default: no-sbrm]
6565
* `-spoll, --skip-polls / -no-spoll, --no-skip-polls`: Skip sql checks confirming no write/cpimports running. [default: no-spoll]
6666
* `-slock, --skip-locks / -no-slock, --no-skip-locks`: Skip issuing write locks - ideal for dirty backups. [default: no-slock]
6767
* `-smdb, --skip-mariadb-backup / -no-smdb, --no-skip-mariadb-backup`: Skip running a mariadb-backup for innodb data - ideal for incremental dirty backups. [default: no-smdb]
6868
* `-sb, --skip-bucket-data / -no-sb, --no-skip-bucket-data`: Skip taking a copy of the columnstore data in the bucket. [default: no-sb]
69+
* `-nb, --name-backup TEXT`: Define the name of the backup - default: $(date +%m-%d-%Y) [default: 03-20-2025]
70+
* `-c, --compress TEXT`: Compress backup in X format - Options: [ pigz ].
71+
* `-q, --quiet / -no-q, --no-quiet`: Silence verbose copy command outputs. [default: no-q]
72+
* `-nv-ssl, --no-verify-ssl / -v-ssl, --verify-ssl`: Skips verifying ssl certs, useful for onpremise s3 storage. [default: v-ssl]
6973
* `-pi, --poll-interval INTEGER`: Number of seconds between poll checks for active writes & cpimports. [default: 5]
7074
* `-pmw, --poll-max-wait INTEGER`: Max number of minutes for polling checks for writes to wait before exiting as a failed backup attempt. [default: 60]
71-
* `-q, --quiet / -no-q, --no-quiet`: Silence verbose copy command outputs. [default: no-q]
72-
* `-c, --compress TEXT`: Compress backup in X format - Options: [ pigz ].
73-
* `-P, --parallel INTEGER`: Determines if columnstore data directories will have multiple rsync running at the same time for different subfolders to parallelize writes. Ignored if "-c/--compress" argument not set. [default: 4]
74-
* `-nb, --name-backup TEXT`: Define the name of the backup - default: $(date +%m-%d-%Y) [default: 03-06-2025]
7575
* `-r, --retention-days INTEGER`: Retain backups created within the last X days, default 0 == keep all backups. [default: 0]
76+
* `-aro, --apply-retention-only`: Only apply retention policy to existing backups, does not run a backup.
77+
* `-li, --list`: List backups.
7678
* `--help`: Show this message and exit.
7779

7880
## `mcs dbrm_backup`
@@ -87,13 +89,14 @@ $ mcs dbrm_backup [OPTIONS]
8789

8890
**Options**:
8991

90-
* `-m, --mode TEXT`: "loop" or "once" ; Determines if this script runs in a forever loop sleeping -i minutes or just once. [default: once]
9192
* `-i, --interval INTEGER`: Number of minutes to sleep when --mode=loop. [default: 90]
9293
* `-r, --retention-days INTEGER`: Retain dbrm backups created within the last X days, the rest are deleted [default: 7]
93-
* `-p, --path TEXT`: Path of where to save the dbrm backups on disk. [default: /tmp/dbrm_backups]
94-
* `-nb, --name-backup TEXT`: Custom name to prefex dbrm backups with. [default: dbrm_backup]
95-
* `-q, --quiet / -no-q, --no-quiet`: Silence verbose copy command outputs. [default: no-q]
94+
* `-bl, --backup-location TEXT`: Path of where to save the dbrm backups on disk. [default: /tmp/dbrm_backups]
95+
* `-m, --mode TEXT`: "loop" or "once" ; Determines if this script runs in a forever loop sleeping -i minutes or just once. [default: once]
96+
* `-nb, --name-backup TEXT`: Define the prefix of the backup - default: dbrm_backup+date +%Y%m%d_%H%M%S [default: dbrm_backup]
9697
* `-ssm, --skip-storage-manager / -no-ssm, --no-skip-storage-manager`: Skip backing up storagemanager directory. [default: no-ssm]
98+
* `-q, --quiet / -no-q, --no-quiet`: Silence verbose copy command outputs. [default: no-q]
99+
* `-li, --list`: List backups.
97100
* `--help`: Show this message and exit.
98101

99102
## `mcs restore`
@@ -127,15 +130,16 @@ Options: "LocalStorage" or "S3" [default: LocalStorage]
127130
* `-nr, --new-region TEXT`: Defines the region of the new bucket to copy the s3 data to from the backup bucket.
128131
* `-nk, --new-key TEXT`: Defines the aws key to connect to the new_bucket.
129132
* `-ns, --new-secret TEXT`: Defines the aws secret of the aws key to connect to the new_bucket.
133+
* `-P, --parallel INTEGER`: Determines number of decompression and mdbstream threads. Ignored if "-c/--compress" argument not set. [default: 4]
130134
* `-ha, --highavilability / -no-ha, --no-highavilability`: Flag for high available systems (meaning shared storage exists supporting the topology so that each node sees all data) [default: no-ha]
131135
* `-cont, --continue / -no-cont, --no-continue`: This acknowledges data in your --new_bucket is ok to delete when restoring S3. When set to true skips the enforcement that new_bucket should be empty prior to starting a restore. [default: no-cont]
132-
* `-f, --config-file TEXT`: Path to backup configuration file to load variables from.
136+
* `-f, --config-file TEXT`: Path to backup configuration file to load variables from - relative or full path accepted.
133137
* `-smdb, --skip-mariadb-backup / -no-smdb, --no-skip-mariadb-backup`: Skip restoring mariadb server via mariadb-backup - ideal for only restoring columnstore. [default: no-smdb]
134138
* `-sb, --skip-bucket-data / -no-sb, --no-skip-bucket-data`: Skip restoring columnstore data in the bucket - ideal if looking to only restore mariadb server. [default: no-sb]
135139
* `-c, --compress TEXT`: Hint that the backup is compressed in X format. Options: [ pigz ].
136-
* `-P, --parallel INTEGER`: Determines number of decompression and mdbstream threads. Ignored if "-c/--compress" argument not set. [default: 4]
137140
* `-q, --quiet / -no-q, --no-quiet`: Silence verbose copy command outputs. [default: no-q]
138141
* `-nv-ssl, --no-verify-ssl / -v-ssl, --verify-ssl`: Skips verifying ssl certs, useful for onpremise s3 storage. [default: v-ssl]
142+
* `-li, --list`: List backups.
139143
* `--help`: Show this message and exit.
140144

141145
## `mcs dbrm_restore`
@@ -150,11 +154,12 @@ $ mcs dbrm_restore [OPTIONS]
150154

151155
**Options**:
152156

153-
* `-p, --path TEXT`: Path of where dbrm backups stored on disk. [default: /tmp/dbrm_backups]
154-
* `-d, --directory TEXT`: Date or directory chose to restore from.
157+
* `-bl, --backup-location TEXT`: Path of where dbrm backups exist on disk. [default: /tmp/dbrm_backups]
158+
* `-l, --load TEXT`: Name of the directory to restore from -bl
155159
* `-ns, --no-start`: Do not attempt columnstore startup post dbrm_restore.
156160
* `-sdbk, --skip-dbrm-backup / -no-sdbk, --no-skip-dbrm-backup`: Skip backing up dbrms before restoring. [default: sdbk]
157161
* `-ssm, --skip-storage-manager / -no-ssm, --no-skip-storage-manager`: Skip backing up storagemanager directory. [default: ssm]
162+
* `-li, --list`: List backups.
158163
* `--help`: Show this message and exit.
159164

160165
## `mcs help-all`

cmapi/mcs_cluster_tool/backup_commands.py

+84-67
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,6 @@ def backup(
7676
)
7777
)
7878
] = '',
79-
nv_ssl: Annotated[
80-
bool,
81-
typer.Option(
82-
'-nv-ssl/-v-ssl','--no-verify-ssl/--verify-ssl',
83-
help='Skips verifying ssl certs, useful for onpremise s3 storage.'
84-
)
85-
] = False,
8679
s: Annotated[
8780
str,
8881
typer.Option(
@@ -107,6 +100,18 @@ def backup(
107100
show_default=False
108101
)
109102
] = '',
103+
P: Annotated[
104+
int,
105+
typer.Option(
106+
'-P', '--parallel',
107+
help=(
108+
'Determines if columnstore data directories will have '
109+
'multiple rsync running at the same time for different '
110+
'subfolders to parallelize writes. '
111+
'Ignored if "-c/--compress" argument not set.'
112+
)
113+
)
114+
] = 4,
110115
ha: Annotated[
111116
bool,
112117
typer.Option(
@@ -171,73 +176,68 @@ def backup(
171176
help='Skip taking a copy of the columnstore data in the bucket.'
172177
)
173178
] = False,
174-
pi: Annotated[
175-
int,
179+
nb: Annotated[
180+
str,
176181
typer.Option(
177-
'-pi', '--poll-interval',
178-
help=(
179-
'Number of seconds between poll checks for active writes & '
180-
'cpimports.'
181-
)
182+
'-nb', '--name-backup',
183+
help='Define the name of the backup - default: $(date +%m-%d-%Y)'
182184
)
183-
] = 5,
184-
pmw: Annotated[
185-
int,
185+
] = datetime.now().strftime('%m-%d-%Y'),
186+
m: Annotated[
187+
str,
186188
typer.Option(
187-
'-pmw', '--poll-max-wait',
189+
'-m', '--mode',
188190
help=(
189-
'Max number of minutes for polling checks for writes to wait '
190-
'before exiting as a failed backup attempt.'
191-
)
191+
'Modes ["direct","indirect"] - direct backups run on the '
192+
'columnstore nodes themselves. indirect run on another '
193+
'machine that has read-only mounts associated with '
194+
'columnstore/mariadb\n'
195+
),
196+
hidden=True
192197
)
193-
] = 60,
198+
] = 'direct',
199+
c: Annotated[
200+
str,
201+
typer.Option(
202+
'-c', '--compress',
203+
help='Compress backup in X format - Options: [ pigz ].',
204+
show_default=False
205+
)
206+
] = '',
194207
q: Annotated[
195208
bool,
196209
typer.Option(
197210
'-q/-no-q', '--quiet/--no-quiet',
198211
help='Silence verbose copy command outputs.'
199212
)
200213
] = False,
201-
c: Annotated[
202-
str,
214+
nv_ssl: Annotated[
215+
bool,
203216
typer.Option(
204-
'-c', '--compress',
205-
help='Compress backup in X format - Options: [ pigz ].',
206-
show_default=False
217+
'-nv-ssl/-v-ssl','--no-verify-ssl/--verify-ssl',
218+
help='Skips verifying ssl certs, useful for onpremise s3 storage.'
207219
)
208-
] = '',
209-
P: Annotated[
220+
] = False,
221+
pi: Annotated[
210222
int,
211223
typer.Option(
212-
'-P', '--parallel',
224+
'-pi', '--poll-interval',
213225
help=(
214-
'Determines if columnstore data directories will have '
215-
'multiple rsync running at the same time for different '
216-
'subfolders to parallelize writes. '
217-
'Ignored if "-c/--compress" argument not set.'
226+
'Number of seconds between poll checks for active writes & '
227+
'cpimports.'
218228
)
219229
)
220-
] = 4,
221-
nb: Annotated[
222-
str,
223-
typer.Option(
224-
'-nb', '--name-backup',
225-
help='Define the name of the backup - default: $(date +%m-%d-%Y)'
226-
)
227-
] = datetime.now().strftime('%m-%d-%Y'),
228-
m: Annotated[
229-
str,
230+
] = 5,
231+
pmw: Annotated[
232+
int,
230233
typer.Option(
231-
'-m', '--mode',
234+
'-pmw', '--poll-max-wait',
232235
help=(
233-
'Modes ["direct","indirect"] - direct backups run on the '
234-
'columnstore nodes themselves. indirect run on another '
235-
'machine that has read-only mounts associated with '
236-
'columnstore/mariadb\n'
237-
),
238-
hidden=True
236+
'Max number of minutes for polling checks for writes to wait '
237+
'before exiting as a failed backup attempt.'
238+
)
239239
)
240-
] = 'direct',
240+
] = 60,
241241
r: Annotated[
242242
int,
243243
typer.Option(
@@ -248,13 +248,23 @@ def backup(
248248
)
249249
)
250250
] = 0,
251+
aro: Annotated[
252+
bool,
253+
typer.Option(
254+
'-aro', '--apply-retention-only',
255+
help=(
256+
'Only apply retention policy to existing backups, '
257+
'does not run a backup.'
258+
)
259+
)
260+
] = False,
251261
list: Annotated[
252262
bool,
253263
typer.Option(
254-
'list',
264+
'-li', '--list',
255265
help='List backups.'
256266
)
257-
] = False
267+
] = False,
258268
):
259269
"""Backup Columnstore and/or MariDB data."""
260270

@@ -286,16 +296,6 @@ def backup(
286296

287297
@handle_output
288298
def dbrm_backup(
289-
m: Annotated[
290-
str,
291-
typer.Option(
292-
'-m', '--mode',
293-
help=(
294-
'"loop" or "once" ; Determines if this script runs in a '
295-
'forever loop sleeping -i minutes or just once.'
296-
),
297-
)
298-
] = 'once',
299299
i: Annotated[
300300
int,
301301
typer.Option(
@@ -320,6 +320,16 @@ def dbrm_backup(
320320
help='Path of where to save the dbrm backups on disk.'
321321
)
322322
] = '/tmp/dbrm_backups',
323+
m: Annotated[
324+
str,
325+
typer.Option(
326+
'-m', '--mode',
327+
help=(
328+
'"loop" or "once" ; Determines if this script runs in a '
329+
'forever loop sleeping -i minutes or just once.'
330+
),
331+
)
332+
] = 'once',
323333
nb: Annotated[
324334
str,
325335
typer.Option(
@@ -330,18 +340,25 @@ def dbrm_backup(
330340
)
331341
)
332342
] = 'dbrm_backup',
343+
ssm: Annotated[
344+
bool,
345+
typer.Option(
346+
'-ssm/-no-ssm', '--skip-storage-manager/--no-skip-storage-manager',
347+
help='Skip backing up storagemanager directory.'
348+
)
349+
] = False,
333350
q: Annotated[
334351
bool,
335352
typer.Option(
336353
'-q/-no-q', '--quiet/--no-quiet',
337354
help='Silence verbose copy command outputs.'
338355
)
339356
] = False,
340-
ssm: Annotated[
357+
list: Annotated[
341358
bool,
342359
typer.Option(
343-
'-ssm/-no-ssm', '--skip-storage-manager/--no-skip-storage-manager',
344-
help='Skip backing up storagemanager directory.'
360+
'-li', '--list',
361+
help='List backups.'
345362
)
346363
] = False,
347364
):

0 commit comments

Comments
 (0)