Quote:
Originally Posted by Mb81
Thanks alot ! That was the problem. Thanks again.
|
No problem! Having just gone through all this myself, I am happy to help by passing on what I have learned.
I also like to give credit where it is due:
so thank you
Orban (
https://vborg.vbsupport.ru/showpost.php?p=1104866 )
Quote:
Another question; what are recommended update settings ?
|
If you are asking about indexing, keep on reading!
Quote:
Originally Posted by eoc_Jason
Just curious for people's indexer updates, how often do you do them and how to you manage the delta vs full?
Right now I have a cron job running every 5 minutes to do the delta files since they only take a few seconds. I do a full rebuild maybe once a week or so (after disabling the delta cronjob so it doesn't try to run at the same time).
I would like to automate the full rebuild, but changing the delta one would require a really ugly cron looking line. Alternatively I could have another script check the time and figure out which job to run and if a job is already running and all that.
Second, how do you guys rotate your searchd & query log files? The only way I have gotten it to do that is to kill searchd completely and restart it. It would be nice if there was a more graceful method.
|
When to run the indexer seems to be a matter of preference, keeping in mind the usage/size of the database in question. I run two (almost) identical crons, one every 20 min (for the deltas) and one every day (for the full index). The LOCKFILE helps to keep them from stepping on each other.
Code:
#!/bin/sh
LOCKFILE=/var/lock/sphinx.cron.lock
INDEXER_CONF=/usr/local/etc/sphinx.conf
# the lockfile is not meant to be perfect, it's just in case the
# two sphinx cron scripts get run close to each other to keep
# them from stepping on each other's toes.
[ -f $LOCKFILE ] && exit 0
trap "{ rm -f $LOCKFILE ; exit 255; }" EXIT
touch $LOCKFILE
cd /usr/local/bin/ #(NOTE: this should be where indexer is located)
DELTAS_ONLY_LINE: ./indexer --config $INDEXER_CONF --rotate YOUR_POST_INDEX_DELTA YOUR_THREAD_INDEX_DELTA >/dev/null 2>&1
OR
FULL_INDEX_LINE ./indexer --all --rotate --config $INDEXER_CONF >/dev/null 2>&1
exit 0
You could also replace ">/dev/null 2>&1" with "| mail -s "Sphinx Report" YOUR_EMAIL_HERE" to get an email of the output.
I created a folder called: "/etc/cron.20minutes" and then added the line "*/20 * * * * root run-parts /etc/cron.20minutes" to "/etc/crontab"
then put the cron with the DELTAS_ONLY_LINE in that folder and put the cron with FULL_INDEX_LINE in my "/etc/cron.daily" (you could also put it in "/etc/cron.weekly")
As far as log rotation goes, I used the Power of Linux once more! I just created the file:
"/etc/logrotate.d/sphinx"
Code:
/var/log/searchd.log /var/log/query.log {
notifempty
missingok
}
NOTE: the two paths/files need to match your sphinx.conf
log = /var/log/searchd.log
query_log = /var/log/query.log
Now they rotate all by themselves!
-RayJ