Rate This Document
Findability
Accuracy
Completeness
Readability

Migrating from Elasticsearch to Elasticsearch

  1. Download the Elasticsearch installation package on the target host. Download the installation package of the required version from the official website. The following uses 7.15.0 as an example.
    1
    wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.15.0-linux-aarch64.tar.gz
    
  2. Decompress the package and start the installation.
    1. Decompress the installation package in the upper-level directory of {software_install_path}.
      If the target path does not exist, manually create the required directory structure. The following uses {software_install_path} on the source host as an example. You can change the path and adjust the path information in subsequent steps.
      1
      tar -zxvf elasticsearch-7.15.0-linux-aarch64.tar.gz
      
    2. After the decompression is successful, delete the installation package.
      1
      rm -f elasticsearch-7.15.0-linux-aarch64.tar.gz
      
  3. Migrate data, configuration, and log files.
    1. On the source host, go to the source Elasticsearch installation directory {software_install_path}.
      cd {software_install_path}
    2. Copy the config, logs, and plugins directories to the new installation directory on the target host. (If a file with the same name exists, overwrite it.)
      scp -r config username@TARGET_IP:None
      scp -r logs username@TARGET_IP:None
      scp -r plugins username@TARGET_IP:None
    3. Go to the config directory on the source host and open the elasticsearch.yml file.
      cd {software_install_path}/config
      vi elasticsearch.yml
    4. Search the configuration file for the path.data and path.logs file paths and copy the files to the same location on the target VM. For example, you can copy the files as follows. Replace the example address with the actual one.
      scp -r {software_install_path}/data username@TARGET_IP:None/data
      scp -r {software_install_path}/logs username@TARGET_IP:None/logs
  4. Switch to the target host and create a user.
    1. Create a user, for example, elasticsearch.
      1
      sudo useradd -M -s /bin/bash elasticsearch
      
    2. Change the owner group of the Elasticsearch directory and migrated data files to the new user.
      1
      2
      3
      sudo chown -R elasticsearch:elasticsearch None
      sudo chown -R elasticsearch:elasticsearch /data_path_in_conf_file/
      sudo chown -R elasticsearch:elasticsearch /logs_path_in_conf_file/
      
  5. Modify system limit settings.
    1. Open the system limit configuration file.
      1
      sudo vi /etc/security/limits.conf
      
    2. Press i to enter the insert mode and add or modify the following parameters:
      Note that you need to replace the asterisk (*) in the following command with the name of the user account that you have created.
      * soft nofile 65536
      * hard nofile 131072
      * soft nproc 4096
      * hard nproc 4096
  6. Start Elasticsearch.
    1. Switch to the bin directory of the Elasticsearch installation directory and start Elasticsearch as the new user.
      1
      2
      cd None/bin
      ./elasticsearch
      
    2. Check whether Elasticsearch is running properly.

      Change the IP address and port based on the None/config/elasticsearch.yml file.

      • Open a new terminal window and run the following command to verify the startup status.
        1
        curl -X GET "localhost:9200/"
        
      • If SSL is enabled, verify the user name and password. Run the following command to verify the startup status, where you need to replace the example CA certificate path /path/to with the actual path.
        1
        curl -u <Username>:<Password> -X GET "https://localhost:9200/" --cacert /path/to/ca.crt
        

      If "You Know, for Search" is displayed, Elasticsearch is started successfully.

      For more configuration information, see the official document.