searchd error
I'm working through setting up Sopac, and after running ./indexer --all and then ./searchd I get this:
/usr/local/sphinx/bin$ sudo ./searchd
Sphinx 0.9.8-release (r1371)
Copyright (c) 2001-2008, Andrew Aksyonoff
using config file '/usr/local/sphinx/etc/sphinx.conf'...
WARNING: index 'bib_items_tags': preload: failed to load /usr/local/sphinx/var/data/bib_items_tags.spa: bad size 0 (at least 56 bytes expected); NOT SERVING
WARNING: index 'bib_items_reviews': preload: failed to load /usr/local/sphinx/var/data/bib_items_reviews.spa: bad size 0 (at least 56 bytes expected); NOT SERVING
I'm using the sample data.
Any ideas what may be wrong?



Not sure--a couple things to check though might be the permissions on sphinx files. Also check to make sure that you're using the correct username and password and dbname in the sphinx configuration file.
What should the permissions be set to?
I just double checked the sphinx config file, and I do have the correct permissions set for each part in there.
I'm not sure if this helps or not, but when I run:
./indexer --all --rotate
I get this for results:
Sphinx 0.9.8-release (r1371)
Copyright (c) 2001-2008, Andrew Aksyonoff
using config file '/usr/local/sphinx/etc/sphinx.conf'...
indexing index 'bib_items_keyword'...
collected 137147 docs, 46.0 MB
sorted 42.1 Mhits, 100.0% done
total 137147 docs, 45978133 bytes
total 37.074 sec, 1240157.00 bytes/sec, 3699.23 docs/sec
indexing index 'bib_items_author'...
collected 137147 docs, 5.2 MB
sorted 4.6 Mhits, 100.0% done
total 137147 docs, 5195493 bytes
total 6.529 sec, 795777.81 bytes/sec, 21006.39 docs/sec
indexing index 'bib_items_title'...
collected 137147 docs, 5.3 MB
sorted 5.2 Mhits, 100.0% done
total 137147 docs, 5262059 bytes
total 4.530 sec, 1161684.88 bytes/sec, 30277.43 docs/sec
indexing index 'bib_items_subject'...
collected 137147 docs, 17.2 MB
sorted 14.7 Mhits, 100.0% done
total 137147 docs, 17241088 bytes
total 7.495 sec, 2300293.00 bytes/sec, 18298.05 docs/sec
indexing index 'bib_items_callnum'...
collected 137147 docs, 1.1 MB
sorted 1.1 Mhits, 100.0% done
total 137147 docs, 1075405 bytes
total 2.525 sec, 425916.22 bytes/sec, 54317.34 docs/sec
indexing index 'bib_items_tags'...
collected 137147 docs, 0.0 MB
total 137147 docs, 0 bytes
total 1.784 sec, 0.00 bytes/sec, 76863.45 docs/sec
indexing index 'bib_items_reviews'...
collected 137147 docs, 0.0 MB
total 137147 docs, 0 bytes
total 1.763 sec, 0.00 bytes/sec, 77810.66 docs/sec
rotating indices: succesfully sent SIGHUP to searchd (pid=1978).
Both bib_items_tags and review show 'collected 137147 docs, 0.0 MB where all the others have a size greater than one. Since those are the two causing the errors, could the reason be because they're showing up with 0 for size? If so, what did I do wrong?
Take a look at the permission in /usr/local/sphinx/var/* (esp data/) and make sure that everything is readable by the sphinx user:
drwxr-sr-x 2 sphinx sphinx 4096 2009-05-11 09:18 data/
drwxr-sr-x 2 sphinx sphinx 40 2008-07-31 10:06 log/
drwxr-sr-x 2 sphinx sphinx 24 2009-03-15 08:37 run/
I double checked, and my permissions were 777 for all those directories. So, I changed them so they match what you mentioned:
/usr/local/sphinx/var$ ls -l
total 12
drwxr-xr-x 2 sphinx sphinx 4096 2009-05-06 12:53 data
drwxr-xr-x 2 sphinx sphinx 4096 2009-05-04 17:31 log
drwxr-xr-x 2 sphinx sphinx 4096 2009-05-04 18:50 run
Re-ran searchd and still got this:
/usr/local/sphinx/bin$ sudo ./searchd
Sphinx 0.9.8-release (r1371)
Copyright (c) 2001-2008, Andrew Aksyonoff
using config file '/usr/local/sphinx/etc/sphinx.conf'...
WARNING: index 'bib_items_tags': preload: failed to load /usr/local/sphinx/var/data/bib_items_tags.spa: bad size 0 (at least 56 bytes expected); NOT SERVING
WARNING: index 'bib_items_reviews': preload: failed to load /usr/local/sphinx/var/data/bib_items_reviews.spa: bad size 0 (at least 56 bytes expected); NOT SERVING
What about the permissions of the files inside those directories? Sometimes if the initial index was run as root, the files are unreadable by sphinx.
You know... I really should have known to check those...
Anyway, they were off. And, the permissions were all set with ownership and group of root. Changed them to be the user and group of sphinx. Still get the same error message.
Since it's saying the files bib_items_tags.spa and bib_items_reviews.spa are zero bytes in the error, I took a look at both files. they do exist, but they are both empty. What's are those files normally supposed to look like?
Ultimately, the problem I'm having is when I try to search from my drupal site using sopac, I get this error message:
Fatal error: Call to undefined method MDB2_Error::fetchAll() in /usr/local/lib/locum/locum-client.php on line 284
I thought, since I got those errors with searchd, that could be related. Are they related, or is that something else entirely?
Another thing to check would be to see if the SQL queries in the conf file work..if they don't then you're not going to get any data to index. You might also try deleting all of your data files and re-indexing.
I tried deleting the data files and re-indexed, but I end up getting the same error messages.
How do I check to see if the SQL queries in the conf file work?
You can run them directly in mysql, but you might want to throw in a LIMIT.
I'm able to search within phpmyadmin just fine.
PHPmyadmin will prepare the query for you, so it might not be the best place to test out the query you have in your sphinx conf. That's why troubleshooting in the mysql shell itself can often turn up those niggly little syntax errors that trip you up.
I am facing the same problem as mentioned above i.e the bib_items_tags.spa and bib_items_reviews.spa are zero bytes and hence I get the same error when I run searchd.
I have tried running the queries in sphinx.conf in the mysql shell, the queries run without any error. However, I noticed that after harvesting the records, when I run update-index.php, the insurge_tags,insurge_reviews and insurge_ratings tables are empty. Is that why the the bib_items_tags.spa and bib_items_reviews.spa files do not have any data?
Are you running Sphinx 0.9.8.1? I've noticed that the newer versions seem to have some compatibility issues with locum and insurge.
Also, are you running update-index as a user that has write permissions to those files?
I am running sphinx-0.9.8.
I am running update-index as superuser. The insurge_index table has data i.e the bnum field has bib numbers, but the rating_idx, tag_idx and review_idx fields are empty and the insurge_ratings ,insurge_reviews , insurge_tags tables are still empty.
The update-index.php has the following permissions:
-rwxr-xr-x 1 501 staff 894 2009-07-15 09:15 update-index.php
Does that make a difference?
Well, what you're describing suggests that you have not inputted any social data at all yet. If the insurge_index table is populated in the manner that you describe, then the update-index script has done its job.
What are the file permissions of your sphinx data files? The sphinx user need write access to all the .spl files and read access to everything else.
Also, what do you see when you run
./indexer --all --rotate?Thank you so much for your reply.It really helped.
I added a few tags, reviews and ratings to some records through the front end and the sphinx server started without any errors.
The permissions for the sphinx data files are as follows:
-rw-r--r-- 1 root sphinx 24787840 2009-07-16 10:28 bib_items_author.spa
-rw-r--r-- 1 root sphinx 68933490 2009-07-16 10:29 bib_items_author.spd
-rw-r--r-- 1 root sphinx 525 2009-07-16 10:29 bib_items_author.sph
-rw-r--r-- 1 root sphinx 2662679 2009-07-16 10:29 bib_items_author.spi
-rw------- 1 sphinx sphinx 0 2009-07-16 10:42 bib_items_author.spl
However, the tags don't show up on the item record page even after running update-index.php again.
Also, Is it necessary to download the views module to be able to search using the search box on the 'cat/seek/search' page?
Thank you once again for your help.