# Elasticsearch Upgarde from 7.17.x to 9.x (Ubuntu)

This article describes the procedure to upgrade Elasticsearch from version 7.17.x to 9.3.1 on an Ubuntu environment. The guide includes prerequisite validation, backup procedures, upgrade steps, and post-upgrade verification activities. The procedure helps maintain metadata availability and reduces service interruption during the upgrade process. Follow each step in sequence to ensure a successful Elasticsearch upgrade for the OvalEdge platform.

## **Prerequisites**

Ensure the following prerequisites are completed before starting the upgrade:

* Verify sudo or root access on the Ubuntu server.
* Verify internet connectivity to download required packages.
* Verify sufficient disk space for the existing and upgraded Elasticsearch versions.
* Back up the following Elasticsearch directories:
  * /etc/elasticsearch
  * /var/lib/elasticsearch
  * /var/log/elasticsearch
* Verify Apache Tomcat services are active before shutdown.
* Verify the current Elasticsearch version.

## Steps Involved

1. **Backup Existing Elasticsearch Directories**
   * Run the following commands to back up the existing Elasticsearch configuration, data, and log directories:

     ```
     sudo cp -r /etc/elasticsearch /etc/elasticsearch_backup
     sudo cp -r /var/lib/elasticsearch /var/lib/elasticsearch_backup
     sudo cp -r /var/log/elasticsearch /var/log/elasticsearch_backup
     ```
2. **Stop Apache Tomcat Services**
   * Stop all Apache Tomcat services to prevent application interruption during the upgrade.

     ```
     sudo systemctl stop tomcat.service
     sudo systemctl stop tomcat-ui
     sudo systemctl stop tomcat-job
     ```
   * Verify the Tomcat service status.

     ```
     sudo systemctl status tomcat
     ```
3. **Verify the Current Elasticsearch Version**
   * Run the following command to verify the currently installed Elasticsearch version:

     ```
     curl -u elastic:<password> http://localhost:9200
     ```
   * Expected response:

     <pre class="language-json"><code class="lang-json"><strong>{
     </strong>  "version": {
         "number": "7.17.x"
       }
     }
     </code></pre>
4. **Stop the Elasticsearch Service**
   * Stop the Elasticsearch service before installing the upgraded version.

     ```
     sudo systemctl stop elasticsearch
     ```
   * Verify the Elasticsearch service status:

     ```
     sudo systemctl status elasticsearch
     ```
5. **Download Elasticsearch 9.3.1**
   * Download the Elasticsearch Debian package.

     ```
     wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-9.3.1-amd64.deb

     ```
6. **Install Elasticsearch 9.3.1**
   * Install the downloaded Elasticsearch package.

     <pre><code><strong>sudo dpkg -i elasticsearch-9.3.1-amd64.deb
     </strong></code></pre>
   * If dependency issues occur, run the following command:

     ```
     sudo apt-get install -f -y
     ```
7. **Verify the Elasticsearch Data Directory**
   * Verify the Elasticsearch data directory configuration.

     ```
     sudo grep -i "^path.data" /etc/elasticsearch/elasticsearch.yml
     ```
   * Expected configuration:

     ```
     path.data: /var/lib/elasticsearch
     ```
   * Set the required permissions on the data directory.

     ```
     sudo chown -R elasticsearch:elasticsearch /var/lib/elasticsearch
     sudo chmod -R 750 /var/lib/elasticsearch
     ```
8. **Reload Systemd Configuration**
   * Reload the systemd configuration and enable the Elasticsearch service.

     ```
     sudo systemctl daemon-reexec
     sudo systemctl daemon-reload
     sudo systemctl enable elasticsearch
     ```
9. **Start the Elasticsearch Service**
   * Start the Elasticsearch service.

     ```
     sudo systemctl start elasticsearch
     ```
10. **Verify the Elasticsearch Upgrade**
    * Verify the Elasticsearch service status.

      ```
      sudo systemctl status elasticsearch
      ```
    * Verify the upgraded Elasticsearch version.

      ```
      curl -u elastic:<password> http://localhost:9200
      ```
    * Expected response:

      ```json
      {
        "name": "Your_Node_Name",
        "cluster_name": "elasticsearch",
        "cluster_uuid": "xxxxxxxxxxxx",
        "version": {
          "number": "9.3.1"
        },
        "tagline": "You Know, for Search"
      }
      ```
11. **Update the oasis.properties File (If Password Changes)**\
    If the Elasticsearch password changes after the upgrade, update the Elasticsearch credentials in the oasis.properties file.
    * Navigate to the OvalEdge external properties directory:

      ```
      cd <OVALEDGE_INSTALLATION_PATH>/extprop
      ```
    * Open the oasis.properties configuration file:

      ```
      vi oasis.properties
      ```
    * Update the Elasticsearch configuration values:

      <pre><code><strong>elasticsearch.username=elastic
      </strong>elasticsearch.password=&#x3C;new_password>
      elasticsearch.url=http://localhost:9200
      </code></pre>
    * Save the changes and exit the editor.
12. **Restart Apache Tomcat Services**
    * Restart all Apache Tomcat services after updating the Elasticsearch configuration.

      ```
      sudo systemctl start tomcat.service
      sudo systemctl start tomcat-ui
      sudo systemctl start tomcat-job
      ```
    * Verify the Tomcat service status:

      ```
      sudo systemctl status tomcat
      ```

***

Copyright © 2026, OvalEdge LLC, Peachtree Corners, GA, USA.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ovaledge.com/release8.1/deployment-and-maintenance/upgrade/elasticsearch-upgarde-from-7.17.x-to-9.x-ubuntu.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
