<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Emre</title>
    <description>The latest articles on DEV Community by Emre (@emrecakmak).</description>
    <link>https://dev.to/emrecakmak</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1093263%2F69cbac7a-b348-4494-8a31-cb45b52ee6e3.png</url>
      <title>DEV Community: Emre</title>
      <link>https://dev.to/emrecakmak</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/emrecakmak"/>
    <language>en</language>
    <item>
      <title>Elasticsearch and Kibana: A Roller Coaster Full of Exciting Changes: The Rolling Upgrade Adventure.</title>
      <dc:creator>Emre</dc:creator>
      <pubDate>Wed, 31 May 2023 21:33:09 +0000</pubDate>
      <link>https://dev.to/emrecakmak/elasticsearch-and-kibana-a-roller-coaster-full-of-exciting-changes-the-rolling-upgrade-adventure-37lp</link>
      <guid>https://dev.to/emrecakmak/elasticsearch-and-kibana-a-roller-coaster-full-of-exciting-changes-the-rolling-upgrade-adventure-37lp</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fv2%2Fresize%3Afit%3A1244%2F0%2A7dwP5sAGpE5Yonyh.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fv2%2Fresize%3Afit%3A1244%2F0%2A7dwP5sAGpE5Yonyh.jpg"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Elasticsearch Rolling Upgrade is a method of gradually transitioning from an old version of Elasticsearch to a new version. In this approach, Elasticsearch nodes are updated one by one, and after each update process is completed, the cluster remains operational. This allows for updating the Elasticsearch version without any interruptions in the system.&lt;/p&gt;

&lt;p&gt;This document will describe the process of performing a rolling upgrade to 8.7.0. Before proceeding with the upgrade, it is essential to read the release officail documentation and verify if there are any breaking changes that might affect the services.&lt;/p&gt;

&lt;h3&gt;
  
  
  Important Notes
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Make sure to take a backup of the elasticsearch.yml, kibana.yml file.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Before the upgrade, be sure to take snapshot from all nodes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Start the process by upgrading the nodes which are not master eligible, and then proceed to upgrade the master eligible nodes, be carefull to update the asterisk (*) marked one must be last.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;To avoid any performance issues during the upgrade, please execute the following commands in Kibana DevTools:&lt;/p&gt;

&lt;h4&gt;
  
  
  Disable shard allocation
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PUT _cluster/settings
{
  "persistent": {
    "cluster.routing.allocation.enable": "primaries"
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Stop non-essential indexing and perform a flush
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;POST /_flush

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then connect the node you want to upgrade and run following commands to upgrade 8.7.0 version.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;apt update

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;systemctl stop elasticsearch

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt-get --only-upgrade install elasticsearch=8.7.0

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you want to keep your settings as they are (elasticsearch.yml), you can proceed with the default option, which is "no" (N).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;systemctl daemon-reload
systemctl start elasticsearch
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After these commands, you can check if the Elasticsearch service is up and running using the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;systemctl status elasticsearch

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the service is active, it means there are no issues. However, if there are problems with the service, you can check the relevant logs under the /var/log/elasticsearch directory. These logs contain important information about the Elasticsearch service, such as error messages, warnings, and other diagnostic details. Examining these logs can help you identify and troubleshoot any issues that may have occurred during or after the upgrade process.&lt;/p&gt;

&lt;p&gt;Once you see that the node has rejoined the cluster using the "GET _cat/nodes?v" command in Kibana, you can wait for the unassigned shards to be allocated by running the following command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;PUT _cluster/settings
{
  "persistent": {
    "cluster.routing.allocation.enable": null
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When the cluster becomes green again, you can repeat the process for other nodes.&lt;/p&gt;

&lt;h1&gt;
  
  
  Kibana
&lt;/h1&gt;

&lt;p&gt;To ensure compatibility, it is indeed recommended to update Kibana along with Elasticsearch to the compatible version. Before performing the Kibana upgrade, it is advisable to take a snapshot of the data and also create a backup of the kibana.yml configuration file.&lt;/p&gt;

&lt;p&gt;Additionally, it is crucial to review the &lt;a href="https://www.elastic.co/guide/en/elastic-stack/8.7/kibana-breaking-changes.html" rel="noopener noreferrer"&gt;release notes&lt;/a&gt;&lt;br&gt;
 of the target Kibana version to check for any critical changes or considerations.&lt;/p&gt;

&lt;p&gt;By following these recommendations, you can minimize the risk of version incompatibilities and ensure a smooth upgrade of both Elasticsearch and Kibana while preserving your data and configurations.&lt;/p&gt;



&lt;p&gt;After performing the necessary checks, you can proceed with updating Kibana using the following commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;apt update

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;systemctl stop kibana

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt-get --only-upgrade install kibana=8.7.0

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;systemctl restart kibana

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Important Note!
&lt;/h3&gt;

&lt;p&gt;By default, Kibana uses port 5601. After executing the previous commands, Kibana will start up and become accessible after a while.&lt;/p&gt;

&lt;p&gt;However, in some cases, the port used by Kibana may be different. For example, if Kibana is configured to use HTTPS, it may attempt to start on port 443. In such cases, it is necessary to grant permissions for Kibana to use the specific port.&lt;/p&gt;

&lt;p&gt;If you face such a situation, you can use the following commands to grant permissions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;setcap cap_net_bind_service=+epi /usr/share/kibana/bin/kibana
setcap cap_net_bind_service=+epi /usr/share/kibana/bin/kibana-plugin
setcap cap_net_bind_service=+epi /usr/share/kibana/bin/kibana-keystore
setcap cap_net_bind_service=+epi /usr/share/kibana/node/bin/node
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;systemctl restart kibana

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;If everything went well, it means you have successfully performed a rolling upgrade of Elasticsearch and Kibana!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmedia3.giphy.com%2Fmedia%2FjJQC2puVZpTMO4vUs0%2Fgiphy.gif%3Fcid%3Decf05e47g7vv2qgdhb19e2sbj5u9lyoiok9c6heqomo3tb93%26ep%3Dv1_gifs_search%26rid%3Dgiphy.gif%26ct%3Dg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmedia3.giphy.com%2Fmedia%2FjJQC2puVZpTMO4vUs0%2Fgiphy.gif%3Fcid%3Decf05e47g7vv2qgdhb19e2sbj5u9lyoiok9c6heqomo3tb93%26ep%3Dv1_gifs_search%26rid%3Dgiphy.gif%26ct%3Dg"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>elasticsearch</category>
      <category>devops</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
