Introduction
In this article, we will explain how to transfer Elasticsearch and Hadoop data to a different disk and create a symbolic link in Cluster systems.
Elasticsearch
First, stop the Elasticsearch service with the following command:
#systemctl stop elasticsearch
Next, navigate to the /var/lib directory using the command below:
#mc /var/lib
Then, depending on where the new LVM or new disk is mounted, navigate to that location in the right pane, and on the left pane, select the "elasticsearch" directory. Use the "F6" key to move the"elasticsearch" folder to the new location.
After the transfer process is completed, while you are on the newly moved elasticsearch
folder, press the CTRL+X and then S key combination on your keyboard to create a symbolic link.
Next, navigate to the /var/lib
directory and create the symbolic link to the new location by pointing to the moved elasticsearch
folder. The system will treat the newly moved data as if it is still in the original location.
By using this method, the link will ensure that all the references to the original /var/lib/elasticsearch
folder now point to the new disk where the data was moved.
After the process is completed, the symbolic link on the left side should appear as shown in the screenshot below.
Finally, the following command is executed to start the Elasticsearch service:
#systemctl start elasticsearch
Hadoop Data Transfer to Another Disk
To move the Hadoop data to a different disk, follow the steps below:
1. Stop All Hadoop Services: First, stop all Hadoop services to ensure data consistency during the move. Run the following command to stop Hadoop HDFS services:
# systemctl stop hadoop-hdfs*
2. Navigate to the /var/lib
Directory: Next, use the following command to navigate to the /var/lib
directory where the Hadoop HDFS data is stored:
#mc /var/lib
3. Move the Data: Once you're inside the /var/lib
directory, identify the new LVM or disk that you’ve mounted. On the right side of the Midnight Commander interface, navigate to the mounted directory (where the new disk is located).
4. Move the hadoop-hdfs
Directory: Select the hadoop-hdfs
folder in the /var/lib
directory on the left side, and press F6
to initiate the move operation. Move the hadoop-hdfs
folder to the mounted directory on the right side of Midnight Commander.
Once the move is complete, proceed with creating a symbolic link, as described in the next steps.
After the transfer process is complete, while on the moved hadoop-hdfs
file, press the CTRL+X, S
key combination and create a symbolic link in the /var/lib
directory.
After the process is complete, the symbolic link on the left side should appear as shown in the screenshot below.
Finally, the following command is applied to start the Hadoop services:
# systemctl start hadoop-hdfs*