BuddyJoe
BuddyJoe

Reputation: 71111

How do you change the default location of all your data / cores under Solr?

How do you change the default location of where your data is kept under Solr. On an AWS setup everything I create goes into /var/solr/data In what config file is this default location stored? I'd like to point it at the /data directory which is a 100GB mounted hard drive.

Upvotes: 2

Views: 1647

Answers (1)

Zak
Zak

Reputation: 7515

Aside from editing each solrconfig.xml for each collection (or index) there is a work around that I've come up with in past installations.

Instead of editing 4 files to point to the new location, it is easier to simply "trick" SOLR into storing on your mounted drive using a symlink.

You will point your SOLR directory to your mounted drive:

/var/solr/data -> /data/whatever/directory

Copy your SOLR files:

cp /var/solr/data /data/whatever/directory

Back up your current data:

mv /var/solr/data/ /var/solr/data_backup

Create you symink (target -> symlink):

ln -s /data/whatever/directory /var/solr/data

After all is said and done, you, probably need to repair permissions, setting ownership to SOLR and ensuring that the linking worked correctly. Inside the /var/solr directory .. You can run a ls -lah and you should be able to see whether the link is correctly routed. If it is not, it'll be highlighted in red on most Debian systems. It should look something like:

 lrwxrwxrwx  1 solr solr   31 Apr 30  2021 data -> /data/whatever/directory

Once all finished up .. Restart the SOLR service and re-index your collections.

Upvotes: 2

Related Questions