repository-azure.asciidoc 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. [[repository-azure]]
  2. === Azure Repository Plugin
  3. The Azure Repository plugin adds support for using Azure as a repository for
  4. {ref}/modules-snapshots.html[Snapshot/Restore].
  5. :plugin_name: repository-azure
  6. include::install_remove.asciidoc[]
  7. [[repository-azure-usage]]
  8. ==== Azure Repository
  9. To enable Azure repositories, you have first to define your azure storage settings as
  10. {ref}/secure-settings.html[secured settings]:
  11. [source,sh]
  12. ----------------------------------------------------------------
  13. bin/elasticsearch-keystore add azure.client.default.account
  14. bin/elasticsearch-keystore add azure.client.default.key
  15. ----------------------------------------------------------------
  16. Where `account` is the azure account name and `key` the azure secret key.
  17. Note that you can also define more than one account:
  18. [source,sh]
  19. ----------------------------------------------------------------
  20. bin/elasticsearch-keystore add azure.client.default.account
  21. bin/elasticsearch-keystore add azure.client.default.key
  22. bin/elasticsearch-keystore add azure.client.secondary.account
  23. bin/elasticsearch-keystore add azure.client.secondary.key
  24. ----------------------------------------------------------------
  25. `default` is the default account name which will be used by a repository unless you set an explicit one.
  26. You can set the client side timeout to use when making any single request. It can be defined globally, per account or both.
  27. It's not set by default which means that elasticsearch is using the
  28. http://azure.github.io/azure-storage-java/com/microsoft/azure/storage/RequestOptions.html#setTimeoutIntervalInMs(java.lang.Integer)[default value]
  29. set by the azure client (known as 5 minutes).
  30. `max_retries` can help to control the exponential backoff policy. It will fix the number of retries
  31. in case of failures before considering the snapshot is failing. Defaults to `3` retries.
  32. The initial backoff period is defined by Azure SDK as `30s`. Which means `30s` of wait time
  33. before retrying after a first timeout or failure. The maximum backoff period is defined by Azure SDK as
  34. `90s`.
  35. [source,yaml]
  36. ----
  37. cloud.azure.storage.timeout: 10s
  38. azure.client.default.max_retries: 7
  39. azure.client.secondary.timeout: 30s
  40. ----
  41. In this example, timeout will be `10s` per try for `default` with `7` retries before failing
  42. and `30s` per try for `secondary` with `3` retries.
  43. [IMPORTANT]
  44. .Supported Azure Storage Account types
  45. ===============================================
  46. The Azure Repository plugin works with all Standard storage accounts
  47. * Standard Locally Redundant Storage - `Standard_LRS`
  48. * Standard Zone-Redundant Storage - `Standard_ZRS`
  49. * Standard Geo-Redundant Storage - `Standard_GRS`
  50. * Standard Read Access Geo-Redundant Storage - `Standard_RAGRS`
  51. https://azure.microsoft.com/en-gb/documentation/articles/storage-premium-storage[Premium Locally Redundant Storage] (`Premium_LRS`) is **not supported** as it is only usable as VM disk storage, not as general storage.
  52. ===============================================
  53. [[repository-azure-repository-settings]]
  54. ===== Repository settings
  55. The Azure repository supports following settings:
  56. `client`::
  57. Azure named client to use. Defaults to `default`.
  58. `container`::
  59. Container name. You must create the azure container before creating the repository.
  60. Defaults to `elasticsearch-snapshots`.
  61. `base_path`::
  62. Specifies the path within container to repository data. Defaults to empty
  63. (root directory).
  64. `chunk_size`::
  65. Big files can be broken down into chunks during snapshotting if needed.
  66. The chunk size can be specified in bytes or by using size value notation,
  67. i.e. `1g`, `10m`, `5k`. Defaults to `64m` (64m max)
  68. `compress`::
  69. When set to `true` metadata files are stored in compressed format. This
  70. setting doesn't affect index files that are already compressed by default.
  71. Defaults to `false`.
  72. `readonly`::
  73. Makes repository read-only. Defaults to `false`.
  74. `location_mode`::
  75. `primary_only` or `secondary_only`. Defaults to `primary_only`. Note that if you set it
  76. to `secondary_only`, it will force `readonly` to true.
  77. Some examples, using scripts:
  78. [source,js]
  79. ----
  80. # The simpliest one
  81. PUT _snapshot/my_backup1
  82. {
  83. "type": "azure"
  84. }
  85. # With some settings
  86. PUT _snapshot/my_backup2
  87. {
  88. "type": "azure",
  89. "settings": {
  90. "container": "backup-container",
  91. "base_path": "backups",
  92. "chunk_size": "32m",
  93. "compress": true
  94. }
  95. }
  96. # With two accounts defined in elasticsearch.yml (my_account1 and my_account2)
  97. PUT _snapshot/my_backup3
  98. {
  99. "type": "azure",
  100. "settings": {
  101. "client": "secondary"
  102. }
  103. }
  104. PUT _snapshot/my_backup4
  105. {
  106. "type": "azure",
  107. "settings": {
  108. "client": "secondary",
  109. "location_mode": "primary_only"
  110. }
  111. }
  112. ----
  113. // CONSOLE
  114. // TEST[skip:we don't have azure setup while testing this]
  115. Example using Java:
  116. [source,java]
  117. ----
  118. client.admin().cluster().preparePutRepository("my_backup_java1")
  119. .setType("azure").setSettings(Settings.builder()
  120. .put(Storage.CONTAINER, "backup-container")
  121. .put(Storage.CHUNK_SIZE, new ByteSizeValue(32, ByteSizeUnit.MB))
  122. ).get();
  123. ----
  124. [[repository-azure-validation]]
  125. ===== Repository validation rules
  126. According to the http://msdn.microsoft.com/en-us/library/dd135715.aspx[containers naming guide], a container name must
  127. be a valid DNS name, conforming to the following naming rules:
  128. * Container names must start with a letter or number, and can contain only letters, numbers, and the dash (-) character.
  129. * Every dash (-) character must be immediately preceded and followed by a letter or number; consecutive dashes are not
  130. permitted in container names.
  131. * All letters in a container name must be lowercase.
  132. * Container names must be from 3 through 63 characters long.