Можно ли удалить таблицу из хранилища таблиц Azure с помощью AzCopy

Я создаю набор веб-заданий для резервного копирования моих больших двоичных объектов и таблиц службы хранилища Azure в отдельную учетную запись хранения (которая будет использоваться в случае непреднамеренного повреждения данных, и в этом случае встроенная репликация не будет полезна).

Я успешно создал рабочие места как для резервного копирования, так и для восстановления данных. Сейчас я работаю над удалением старых резервных копий, и я могу удалить капли, но у меня проблемы с удалением таблиц. В AzCopy 10 есть операция remove, но не поддерживаются таблицы. AzCopy 7.3 поддерживает таблицы, но не имеет возможности удалять объекты. Мне что-то здесь не хватает, или это единственный вариант - как-то вызвать REST API для удаления этих таблиц?


person FlintZA    schedule 17.01.2020    source источник


Ответы (2)


Мне что-то здесь не хватает, или это единственный вариант - как-то вызвать REST API для удаления этих таблиц?

Если я не ошибаюсь, в AzCopy такой функции нет.

Что касается использования REST API, я не думаю, что вам это нужно. Вы можете просто использовать Azure Storage .Net SDK (который является оболочкой над REST API) для выполнения операций удаления с объектами.

person Gaurav Mantri    schedule 17.01.2020
comment
Спасибо, это было решение, которым я воспользовался, и, поскольку я уже обрабатывал строку подключения для azCopy, это было невероятно просто. - person FlintZA; 21.01.2020

Не похоже. Запустите azcopy --help, чтобы просмотреть полный список команд, или Запустите azcopy remove --help, чтобы просмотреть полный список действий, доступных для удаления команды.

Usage:
  azcopy remove [resourceURL] [flags]

Aliases:
  remove, rm, r

Examples:

Remove a single blob by using a SAS token:

   - azcopy rm "https://[account].blob.core.windows.net/[container]/[path/to/blob]?[SAS]"

Remove an entire virtual directory by using a SAS token:

   - azcopy rm "https://[account].blob.core.windows.net/[container]/[path/to/directory]?[SAS]" --recursive=true

Remove only the blobs inside of a virtual directory, but don't remove any subdirectories or blobs within those subdirectories:

   - azcopy rm "https://[account].blob.core.windows.net/[container]/[path/to/virtual/dir]" --recursive=false

Remove a subset of blobs in a virtual directory (For example: remove only jpg and pdf files, or if the blob name is "exactName"):

   - azcopy rm "https://[account].blob.core.windows.net/[container]/[path/to/directory]?[SAS]" --recursive=true --include="*.jpg;*.pdf;exactName"

Remove an entire virtual directory but exclude certain blobs from the scope (For example: every blob that starts with foo or ends with bar):

   - azcopy rm "https://[account].blob.core.windows.net/[container]/[path/to/directory]?[SAS]" --recursive=true --exclude="foo*;*bar"

Remove specific blobs and virtual directories by putting their relative paths (NOT URL-encoded) in a file:

   - azcopy rm "https://[account].blob.core.windows.net/[container]/[path/to/parent/dir]" --recursive=true --list-of-files=/usr/bar/list.txt
   - file content:
           dir1/dir2
           blob1
           blob2

Remove a single file from a Blob Storage account that has a hierarchical namespace (include/exclude not supported):

   - azcopy rm "https://[account].dfs.core.windows.net/[container]/[path/to/file]?[SAS]"

Remove a single directory from a Blob Storage account that has a hierarchical namespace (include/exclude not supported):

   - azcopy rm "https://[account].dfs.core.windows.net/[container]/[path/to/directory]?[SAS]"


Flags:
      --delete-snapshots string   By default, the delete operation fails if a blob has snapshots. Specify 'include' to remove the root blob and all its snapshots; alternatively specify 'only' to remove only the snapshots but keep the root blob.
      --exclude-path string       Exclude these paths when removing. This option does not support wildcard characters (*). Checks relative path prefix. For example: myFolder;myFolder/subDirName/file.pdf
      --exclude-pattern string    Exclude files where the name matches the pattern list. For example: *.jpg;*.pdf;exactName
  -h, --help                      help for remove
      --include-path string       Include only these paths when removing. This option does not support wildcard characters (*). Checks relative path prefix. For example: myFolder;myFolder/subDirName/file.pdf
      --include-pattern string    Include only files where the name matches the pattern list. For example: *.jpg;*.pdf;exactName
      --list-of-files string      Defines the location of a file which contains the list of files and directories to be deleted. The relative paths should be delimited by line breaks, and the paths should NOT be URL-encoded.
      --log-level string          Define the log verbosity for the log file. Available levels include: INFO(all requests/responses), WARNING(slow responses), ERROR(only failed requests), and NONE(no output logs). (default 'INFO') (default "INFO")
      --recursive                 Look into sub-directories recursively when syncing between directories.

Flags Applying to All Commands:
      --cap-mbps uint32      Caps the transfer rate, in megabits per second. Moment-by-moment throughput might vary slightly from the cap. If this option is set to zero, or it is omitted, the throughput isn't capped.
      --output-type string   Format of the command's output. The choices include: text, json. The default value is 'text'. (default "text")
person DreadedFrost    schedule 17.01.2020
comment
Я рассмотрел варианты для обеих версий, и, насколько я могу судить, v10 определенно не поддерживает (и никогда не будет) поддерживать таблицы, а v7 явно предназначен только для копирования. - person FlintZA; 20.01.2020