Migrating from Elasticsearch to Elasticsearch
- 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.
1wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.15.0-linux-aarch64.tar.gz - Decompress the package and start the installation.
- 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.
1tar -zxvf elasticsearch-7.15.0-linux-aarch64.tar.gz
- After the decompression is successful, delete the installation package.
1rm -f elasticsearch-7.15.0-linux-aarch64.tar.gz
- Decompress the installation package in the upper-level directory of {software_install_path}.
- Migrate data, configuration, and log files.
- On the source host, go to the source Elasticsearch installation directory {software_install_path}.
cd {software_install_path} - 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
- Go to the config directory on the source host and open the elasticsearch.yml file.
cd {software_install_path}/config vi elasticsearch.yml - 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
- On the source host, go to the source Elasticsearch installation directory {software_install_path}.
- Switch to the target host and create a user.
- Create a user, for example, elasticsearch.
1sudo useradd -M -s /bin/bash elasticsearch
- 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/
- Create a user, for example, elasticsearch.
- Modify system limit settings.
- Open the system limit configuration file.
1sudo vi /etc/security/limits.conf
- 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
- Open the system limit configuration file.
- Start Elasticsearch.
- Switch to the bin directory of the Elasticsearch installation directory and start Elasticsearch as the new user.
1 2
cd None/bin ./elasticsearch
- 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.
1curl -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.
1curl -u <Username>:<Password> -X GET "https://localhost:9200/" --cacert /path/to/ca.crt
If "You Know, for Search" is displayed, Elasticsearch is started successfully.
- Open a new terminal window and run the following command to verify the startup status.
- Switch to the bin directory of the Elasticsearch installation directory and start Elasticsearch as the new user.
Parent topic: Middleware Migration Guide
