Skocz do zawartości
"Idzie nowe..." - o zmianach i nie tylko ×
Przeniesienie zakupów z IPS Marketplace / Moving bought items from IPS Marketplace ×

[resources.invisionpower.com - pliki] Tips and Tricks > Troubleshooting Sphinx


Rekomendowane odpowiedzi

Opublikowano

Sphinx search is excellent.. Until it stops working.

It is quite difficult to troubleshoot, as it is new to IPB and as it it new, it tends to change rather frequently. This should settle down as time goes by, but in the beginning, you will have to make updates to it to keep it working. It does require maintenance whereas FullText searching is totally set it and forget it. The advantage, however, is that Sphinx beats the pants off FullText searching in performance, usability and resource usage.

The first main problem seen is that Sphinx returns results for admins only. This is a problem in IPB 3.0.2 and lower. The suggestion would be to upgrade to 3.0.3 or higher, but if that is not possible, the quick fix would be to run the following query on your database..

update ibf_permission_index set authorized_users = NULL where authorized_users = ''

You may need to adjust the query, pending on your database prefix.

Then rebuild your master Sphinx indexes with the command

/usr/local/bin/indexer --config /path/to/sphinx.conf --all --rotate

Using your path to sphinx.conf. That should take care of it.

----------------------------------------------------------------------

Next.. General Sphinx problems.

Run a search for the term test

Click the tabs across the top of the search results for Members, Help Files, Calendar, Blogs, Gallery, etc (if installed). Are results returned for ANY of those items?

If not.. It is likely that Sphinx is not running on your server..

Login as root and run the command

ps -A | grep searchd

Is anything returned?

You should have a line returned similar to

20723 pts/0 00:00:00 searchd

The numbers may be different, pending on what ID the process is, however, the searchd process should show up.. If it doesn't, you need to start the process using the command

/usr/local/bin/searchd --config /path/to/sphinx.conf

again, subbing your exact path to sphinx.conf.

If you *DO* have results returned for other items, just not for posts.. Then you have a problem with your post indexes.

On a default installation of Sphinx, according to the instructions at This Link, the indexes are built in /var/sphinx, so, go to that directory.

cd /var/sphinx

List the contents of that directory.

ls -l

You should see a listing of a number of .spa, .spd, .sph, .spi, .spl, .spm and .spp files. Things such as members_search_delta, members_search_main, core_search_main, core_search_delta and so on. One for each component of your forum.

What we're interested in is the component that isn't working. Most likely, the forums component.

If you are using IPB 3.0.2 or prior, ignore the below, because your problem is likely the above issue.. Login as admin and see if results are returned.

The forums component is broken down into 2 sections, posts and topics as of 3.0.3. So, you should have 7 different files for each of the following..

forums_search_posts_main

forums_search_posts_delta

forums_search_topics_main

forums_search_topics_delta

If you have ANY other files, such as forums_search_main and forums_search_delta those indexes are being read, and that's causing the problem. Those files are likely being generated by the cron job. You'd need to delete the forums_search_main and forums_search_delta files, update the cron job and change forums_search_delta in the 15 minute update to forums_search_topics_delta and forums_search_posts_delta, then rebuild the indexes with

/usr/local/bin/indexer --config /path/to/sphinx.conf --all --rotate

THEN kill the sphinx process by finding the process id with

ps -A | grep searchd

note the number returned at the far left, in the previous example of

20723 pts/0 00:00:00 searchd

that would be 20723.. So you would then run the command

kill -9 20723

to stop the process.

Now, you need to restart sphinx, by running

/usr/local/bin/searchd --config /path/to/sphinx.conf

And that should bring things back up.

--------------------------------------------------------------------

Worst case situation.. We go nuclear. This just basically knocks out any potential problems. Really doesn't take long, and covers every base, so it should fix any problem.

If you are running IPB 3.0.2 or LOWER, run this query from ACP->Support->SQL Toolbox, this step is not needed on IPB 3.0.3 or HIGHER.

update ibf_permission_index set authorized_users = NULL where authorized_users = '';

Next, shut down sphinx

ps -A | grep searchd

Find the process ID and kill it (see process for doing that above)

Go into the directory that holds your sphinx index files and clear it of all index files. Anything that has 'search' in it.. So

*search* should be removed.

Next, edit your crontab and verify that it is correct. THIS IS IMPORTANT.

From IPB 3.0.3 on, it should read at a minimum

*/15 * * * * /usr/local/bin/indexer --config /path/to/sphinx.conf core_search_delta members_search_delta forums_search_posts_delta forums_search_topics_delta --rotate

0 4 * * * /usr/local/bin/indexer --config /path/to/sphinx.conf --all --rotate

NOTE that it is forums_search_posts_delta and forums_search_topics_delta and NOT forums_search_delta.

For IPB 3.0.2 and PRIOR, it should read at a minimum

*/15 * * * * /usr/local/bin/indexer --config /path/to/sphinx.conf core_search_delta members_search_delta forums_search_delta --rotate

0 4 * * * /usr/local/bin/indexer --config /path/to/sphinx.conf --all --rotate

Note that it is forums_search_delta and NOT forums_search_topics_delta and forums_search_posts_delta.

Next, rebuild your master indexes using the command

/usr/local/bin/indexer --config /path/to/sphinx.conf --all

Finally, restart sphinx itself with the command

/usr/local/bin/searchd --config /path/to/sphinx.conf

That is a total rebuild of all Sphinx data from the ground up. Pending on the size of your forum, it may take a while to rebuild the indexes, but it's almost a foregone conclusion that it will correct any problem if done properly.

--------------------------------------------------------------------------------------------------

Learning a little about Sphinx, you can watch the logs.. You don't really see the internal workings, but you can watch it a bit from the peripheral.

In your sphinx log directory, which should be /var/sphinx/log on a default installation, you will find a query.log and a searchd.log file.

The query.log file contains information on what, where and when your users are searching, along with how long the search took.

If you run the command

tail -f query.log

from the /var/sphinx/log directory, you can watch this file real-time. As users search, new lines will appear on screen. The first portion is the time the search was run, immediately after that is the time the search took, followed by some internal sphinx data, such as the number of results returned, then the location that was searched (normally forums) and at the very end, the term that was searched for. If you're not getting any results, this log might be worthwhile to check.

You can press Ctrl-C to break out of that.

The other file, searchd.log, contains information about the searchd process itself, when index rotation happens, when the process starts and stops, and things of that nature. If the process is stopping and you're having to restart it daily or something along those lines, that would be the file you would want to check.

Wyświetl pełny artykuł

Jeśli chcesz dodać odpowiedź, zaloguj się lub zarejestruj nowe konto

Jedynie zarejestrowani użytkownicy mogą komentować zawartość tej strony.

Zarejestruj nowe konto

Załóż nowe konto. To bardzo proste!

Zarejestruj się

Zaloguj się

Posiadasz już konto? Zaloguj się poniżej.

Zaloguj się
  • Ostatnio przeglądający   0 użytkowników

    • Brak zarejestrowanych użytkowników przeglądających tę stronę.
×
×
  • Dodaj nową pozycję...

Powiadomienie o plikach cookie

Umieściliśmy na Twoim urządzeniu pliki cookie, aby pomóc Ci usprawnić przeglądanie strony. Możesz dostosować ustawienia plików cookie, w przeciwnym wypadku zakładamy, że wyrażasz na to zgodę.