cluster_restart.asciidoc 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. [[restart-upgrade]]
  2. === Full cluster restart upgrade
  3. Elasticsearch requires a full cluster restart when upgrading across major
  4. versions: from 0.x to 1.x or from 1.x to 2.x. Rolling upgrades are not
  5. supported across major versions.
  6. The process to perform an upgrade with a full cluster restart is as follows:
  7. ==== Step 1: Disable shard allocation
  8. When you shut down a node, the allocation process will immediately try to
  9. replicate the shards that were on that node to other nodes in the cluster,
  10. causing a lot of wasted I/O. This can be avoided by disabling allocation
  11. before shutting down a node:
  12. [source,js]
  13. --------------------------------------------------
  14. PUT /_cluster/settings
  15. {
  16. "persistent": {
  17. "cluster.routing.allocation.enable": "none"
  18. }
  19. }
  20. --------------------------------------------------
  21. // AUTOSENSE
  22. If upgrading from 0.90.x to 1.x, then use these settings instead:
  23. [source,js]
  24. --------------------------------------------------
  25. PUT /_cluster/settings
  26. {
  27. "persistent": {
  28. "cluster.routing.allocation.disable_allocation": false,
  29. "cluster.routing.allocation.enable": "none"
  30. }
  31. }
  32. --------------------------------------------------
  33. // AUTOSENSE
  34. ==== Step 2: Perform a synced flush
  35. Shard recovery will be much faster if you stop indexing and issue a
  36. <<indices-synced-flush, synced-flush>> request:
  37. [source,sh]
  38. --------------------------------------------------
  39. POST /_flush/synced
  40. --------------------------------------------------
  41. // AUTOSENSE
  42. A synced flush request is a ``best effort'' operation. It will fail if there
  43. are any pending indexing operations, but it is safe to reissue the request
  44. multiple times if necessary.
  45. ==== Step 3: Shutdown and upgrade all nodes
  46. Stop all Elasticsearch services on all nodes in the cluster. Each node can be
  47. upgraded following the same procedure described in <<upgrade-node>>.
  48. ==== Step 4: Start the cluster
  49. If you have dedicated master nodes -- nodes with `node.master` set to
  50. `true`(the default) and `node.data` set to `false` -- then it is a good idea
  51. to start them first. Wait for them to form a cluster and to elect a master
  52. before proceding with the data nodes. You can check progress by looking at the
  53. logs.
  54. As soon as the <<master-election,minimum number of master-eligible nodes>>
  55. have discovered each other, they will form a cluster and elect a master. From
  56. that point on, the <<cat-health,`_cat/health`>> and <<cat-nodes,`_cat/nodes`>>
  57. APIs can be used to monitor nodes joining the cluster:
  58. [source,sh]
  59. --------------------------------------------------
  60. GET _cat/health
  61. GET _cat/nodes
  62. --------------------------------------------------
  63. // AUTOSENSE
  64. Use these APIs to check that all nodes have successfully joined the cluster.
  65. ==== Step 5: Wait for yellow
  66. As soon as each node has joined the cluster, it will start to recover any
  67. primary shards that are stored locally. Initially, the
  68. <<cat-health,`_cat/health`>> request will report a `status` of `red`, meaning
  69. that not all primary shards have been allocated.
  70. Once each node has recovered its local shards, the `status` will become
  71. `yellow`, meaning all primary shards have been recovered, but not all replica
  72. shards are allocated. This is to be expected because allocation is still
  73. disabled.
  74. ==== Step 6: Reenable allocation
  75. Delaying the allocation of replicas until all nodes have joined the cluster
  76. allows the master to allocate replicas to nodes which already have local shard
  77. copies. At this point, with all the nodes in the cluster, it is safe to
  78. reenable shard allocation:
  79. [source,js]
  80. ------------------------------------------------------
  81. PUT /_cluster/settings
  82. {
  83. "persistent": {
  84. "cluster.routing.allocation.enable": "all"
  85. }
  86. }
  87. ------------------------------------------------------
  88. // AUTOSENSE
  89. If upgrading from 0.90.x to 1.x, then use these settings instead:
  90. [source,js]
  91. --------------------------------------------------
  92. PUT /_cluster/settings
  93. {
  94. "persistent": {
  95. "cluster.routing.allocation.disable_allocation": true,
  96. "cluster.routing.allocation.enable": "all"
  97. }
  98. }
  99. --------------------------------------------------
  100. // AUTOSENSE
  101. The cluster will now start allocating replica shards to all data nodes. At this
  102. point it is safe to resume indexing and searching, but your cluster will
  103. recover more quickly if you can delay indexing and searching until all shards
  104. have recovered.
  105. You can monitor progress with the <<cat-health,`_cat/health`>> and
  106. <<cat-recovery,`_cat/recovery`>> APIs:
  107. [source,sh]
  108. --------------------------------------------------
  109. GET _cat/health
  110. GET _cat/recovery
  111. --------------------------------------------------
  112. // AUTOSENSE
  113. Once the `status` column in the `_cat/health` output has reached `green`, all
  114. primary and replica shards have been successfully allocated.