0

I have a config file that takes a long time to rotate using the indexer to do so e.g.

indexer --config /home/indexer/MyConfig.conf.php  --rotate idx_Big

I can live with that however sometimes when I want to test an updated config it might either break or not deliver desired results. Usually what I do then is

  1. Revert the Config back to the original working settings
  2. Index/Rotate again

However I am wondering if I can just copy the 'good' index out of the directory sphinx accesses (e.g. root), index/rotate the new one and then if I don't like the results, instead of doing another hour long index/rotate back to old index just copy the newly indexed idx over with the one I saved in root and then stop/restart e.g..

/usr/bin/searchd -c /home/indexer/MyConf.php --stop
/usr/bin/searchd -c /home/indexer/MyConf.conf.php

Yes I do get that the conf will still be the one with the changes I don't like but the larger question is still relevant to my personal situation; can I replace an index I rotated with a saved version and restart to get back to where I was or do I need to index/rotate the old settings to do so?

user3649739
  • 1,829
  • 2
  • 18
  • 28

2 Answers2

1

Yes you can do this.

  1. When copying the index out, best to not copy the .spl (lock) file. Copying that back might confuse sphinx.

  2. Also ideally its best copy the index back to the sphinx folder while searchd is shutdown. Overwriting the index files might confuse and/or crash sphinx. Not a big deal as you about to stop it and clearly dont care about the currupted index, but best less chance of confusing side effects.

If wanted to be fancy....

  • Could just copy the the old index back, with append '.new' to the index name (eg index.spd becomes index.new.spd), rather than overwriting the active files, and then send searchd sighup signal. Searchd will then load this new version (which is actually just the old version again) - seamlessly. This is using the same rotate uses to load a new version into searchd, just doing it 'manually'.
barryhunter
  • 20,886
  • 3
  • 30
  • 43
0

do I need to index/rotate the old settings to do so?

You can test whether it works. I do not know Sphinx, but seems simple:

  1. Stop the Sphinx program/service.
  2. Move the index folder to whatever you want to.
  3. Backup your default configuration file, your index folder is tied to.
  4. Create the new configuration file you want to test.
  5. To start the Sphinx for testing as you wish.

After when you want to go back with your backup settings, the process is similar:

  1. Stop the Sphinx program/service.
  2. Delete the index folder.
  3. Restore the index folder from whatever place else you have put it on last time.
  4. Restore the backup of your default configuration file to where it belongs originally.
  5. To start the Sphinx for testing as you wish.

Now you should not need to wait one hour for the Sphinx to index again, as you placed everything in place. The application should not be aware of your fast ninja moves.

If it not works, Sphinx is probably change other files than you are backup.

Evandro Coan
  • 8,560
  • 11
  • 83
  • 144