cluster_restart.asciidoc 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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. added[1.6.0,Synced flush is only supported in Elasticsearch 1.6.0 and above]
  36. Shard recovery will be much faster if you stop indexing and issue a
  37. <<indices-synced-flush, synced-flush>> request:
  38. [source,sh]
  39. --------------------------------------------------
  40. POST /_flush/synced
  41. --------------------------------------------------
  42. // AUTOSENSE
  43. A synced flush request is a ``best effort'' operation. It will fail if there
  44. are any pending indexing operations, but it is safe to reissue the request
  45. multiple times if necessary.
  46. ==== Step 3: Shutdown and upgrade all nodes
  47. Stop all Elasticsearch services on all nodes in the cluster. Each node can be
  48. upgraded following the same procedure described in <<upgrade-node>>.
  49. ==== Step 4: Start the cluster
  50. If you have dedicated master nodes -- nodes with `node.master` set to
  51. `true`(the default) and `node.data` set to `false` -- then it is a good idea
  52. to start them first. Wait for them to form a cluster and to elect a master
  53. before proceding with the data nodes. You can check progress by looking at the
  54. logs.
  55. As soon as the <<master-election,minimum number of master-eligible nodes>>
  56. have discovered each other, they will form a cluster and elect a master. From
  57. that point on, the <<cat-health,`_cat/health`>> and <<cat-nodes,`_cat/nodes`>>
  58. APIs can be used to monitor nodes joining the cluster:
  59. [source,sh]
  60. --------------------------------------------------
  61. GET _cat/health
  62. GET _cat/nodes
  63. --------------------------------------------------
  64. // AUTOSENSE
  65. Use these APIs to check that all nodes have successfully joined the cluster.
  66. ==== Step 5: Wait for yellow
  67. As soon as each node has joined the cluster, it will start to recover any
  68. primary shards that are stored locally. Initially, the
  69. <<cat-health,`_cat/health`>> request will report a `status` of `red`, meaning
  70. that not all primary shards have been allocated.
  71. Once each node has recovered its local shards, the `status` will become
  72. `yellow`, meaning all primary shards have been recovered, but not all replica
  73. shards are allocated. This is to be expected because allocation is still
  74. disabled.
  75. ==== Step 6: Reenable allocation
  76. Delaying the allocation of replicas until all nodes have joined the cluster
  77. allows the master to allocate replicas to nodes which already have local shard
  78. copies. At this point, with all the nodes in the cluster, it is safe to
  79. reenable shard allocation:
  80. [source,js]
  81. ------------------------------------------------------
  82. PUT /_cluster/settings
  83. {
  84. "persistent": {
  85. "cluster.routing.allocation.enable": "all"
  86. }
  87. }
  88. ------------------------------------------------------
  89. // AUTOSENSE
  90. If upgrading from 0.90.x to 1.x, then use these settings instead:
  91. [source,js]
  92. --------------------------------------------------
  93. PUT /_cluster/settings
  94. {
  95. "persistent": {
  96. "cluster.routing.allocation.disable_allocation": true,
  97. "cluster.routing.allocation.enable": "all"
  98. }
  99. }
  100. --------------------------------------------------
  101. // AUTOSENSE
  102. The cluster will now start allocating replica shards to all data nodes. At this
  103. point it is safe to resume indexing and searching, but your cluster will
  104. recover more quickly if you can delay indexing and searching until all shards
  105. have recovered.
  106. You can monitor progress with the <<cat-health,`_cat/health`>> and
  107. <<cat-recovery,`_cat/recovery`>> APIs:
  108. [source,sh]
  109. --------------------------------------------------
  110. GET _cat/health
  111. GET _cat/recovery
  112. --------------------------------------------------
  113. // AUTOSENSE
  114. Once the `status` column in the `_cat/health` output has reached `green`, all
  115. primary and replica shards have been successfully allocated.