Page 1 of 2

moving the data folder for ES

Posted: Wed Sep 11, 2019 10:26 am
by newmember
I followed the instructions for moving the /data folder for ES from this document.
https://assets.nagios.com/downloads/nag ... Server.pdf

When I restart the service ES recreates the shard in the original installation directory /usr/local/elasticsearch/data


Thoughts, suggestions?

Thanks
Chris

Re: moving the data folder for ES

Posted: Wed Sep 11, 2019 10:57 am
by scottwilkerson
Did you edit /etc/sysconfig/elasticsearch as outlined on page 2 of that document?

to something like this

Code: Select all

DATA_DIR="/new/path/data"
and then restart ES

Re: moving the data folder for ES

Posted: Wed Sep 11, 2019 11:28 am
by newmember
correct

I had set it to

DATA_DIR=/elasticsearch/data

/elasticsearch/data is on its own 1000G partition

I didnt change any of the the file folder variables.

Re: moving the data folder for ES

Posted: Wed Sep 11, 2019 1:52 pm
by scottwilkerson
Can you show the results of the following commands

Code: Select all

ps -ef|grep elasticsearch
cat /etc/sysconfig/elasticsearch

Re: moving the data folder for ES

Posted: Wed Sep 11, 2019 1:58 pm
by newmember
I would like too but,

I had to rebuild everything last night just so I could get the system setup today.

I would have to retrace my steps.
However if I did what I did before I think it will break again.

If the doc I refenced is correct I will do it again in my new deployment.

Your thoughts?

Thanks

Re: moving the data folder for ES

Posted: Wed Sep 11, 2019 2:15 pm
by scottwilkerson
I have done this procedure before without issue.

Unfortunately in order to see what is going wrong, I would need to see what ES is setting as the -Des.default.path.data which is derived from /etc/sysconfig/elasticsearch and would display in the ps -ef|grep elasticsearch command

Re: moving the data folder for ES

Posted: Wed Sep 11, 2019 2:18 pm
by newmember
Just updating apache with the certs etc.

Ill do change next

Thanks

Re: moving the data folder for ES

Posted: Wed Sep 11, 2019 3:37 pm
by scottwilkerson
newmember wrote:Just updating apache with the certs etc.

Ill do change next

Thanks
Sounds good

Re: moving the data folder for ES

Posted: Wed Sep 11, 2019 6:04 pm
by newmember
Okay

I made an error in my etc so a started an entire new vm.

First thing I did was mount my 1TB drive
Then I installed LS
Then I went to move ES data.

I have attached the CLI steps.


Here is login error I get from the login page:
Login
The username specified does not exist.

In the logs i attached:
You will also notice the the shard has also been recreated in the original spot, I assume my user account is missing from the new shard in the original folder.




One additional note:
Ubuntu 18.04 puts the service in this file, not whats listed in the doc
/etc/init.d/elasticsearch

https://assets.nagios.com/downloads/nag ... Server.pdf
Changing Path
Now you need to change the configuration to point Nagios Log Server to the new data path. Open the file
/etc/sysconfig/elasticsearch in vi by executing the following command:

Re: moving the data folder for ES

Posted: Thu Sep 12, 2019 7:01 am
by scottwilkerson
Sorry I didn't realuse you were on Ubuntu, and I now see the document needs to be updated.

The file the DATA_DIR needs to be edited in is /etc/default/elasticsearch instead of /etc/sysconfig/elasticsearch.

You edited them in the init script but that file has this disclaimer just above where you edited them

Code: Select all

# The following variables can be overwritten in $DEFAULT
$DEFAULT on Unbuntu is /etc/default/elasticsearch

I will have out team get the document updated for Ubuntu.

Sorry for the confusion