Repository settings

edit

The Azure repository supports following settings:

client
Azure named client to use. Defaults to default.
container
Container name. You must create the azure container before creating the repository. Defaults to elasticsearch-snapshots.
base_path
Specifies the path within container to repository data. Defaults to empty (root directory).
chunk_size
Big files can be broken down into multiple smaller blobs in the blob store during snapshotting. It is not recommended to change this value from its default unless there is an explicit reason for limiting the size of blobs in the repository. Setting a value lower than the default can result in an increased number of API calls to the Azure blob store during snapshot create as well as restore operations compared to using the default value and thus make both operations slower as well as more costly. Specify the chunk size as a value and unit, for example: 10MB, 5KB, 500B. Defaults to the maximum size of a blob in the Azure blob store which is 5TB.
compress
When set to true metadata files are stored in compressed format. This setting doesn’t affect index files that are already compressed by default. Defaults to false.
max_restore_bytes_per_sec
Throttles per node restore rate. Defaults to unlimited. Note that restores are also throttled through recovery settings.
max_snapshot_bytes_per_sec
Throttles per node snapshot rate. Defaults to 40mb per second.
readonly
Makes repository read-only. Defaults to false.
location_mode
primary_only or secondary_only. Defaults to primary_only. Note that if you set it to secondary_only, it will force readonly to true.

Some examples, using scripts:

# The simplest one
PUT _snapshot/my_backup1
{
  "type": "azure"
}

# With some settings
PUT _snapshot/my_backup2
{
  "type": "azure",
  "settings": {
    "container": "backup-container",
    "base_path": "backups",
    "chunk_size": "32MB",
    "compress": true
  }
}


# With two accounts defined in elasticsearch.yml (my_account1 and my_account2)
PUT _snapshot/my_backup3
{
  "type": "azure",
  "settings": {
    "client": "secondary"
  }
}
PUT _snapshot/my_backup4
{
  "type": "azure",
  "settings": {
    "client": "secondary",
    "location_mode": "primary_only"
  }
}

Example using Java:

client.admin().cluster().preparePutRepository("my_backup_java1")
    .setType("azure").setSettings(Settings.builder()
        .put(Storage.CONTAINER, "backup-container")
        .put(Storage.CHUNK_SIZE, new ByteSizeValue(32, ByteSizeUnit.MB))
    ).get();