Search code examples
mysqlsphinxindexer

why index is not displayed, while indexer indexed successfully in sphinx?


When I run indexer -all then I don't get any error, but then also I'm unable to see it. indexer --all

using config file '/etc/sphinx/sphinx.conf'...
indexing index 'indtest'...
collected 4 docs, 0.0 MB
sorted 0.0 Mhits, 100.0% done
total 4 docs, 193 bytes
total 0.008 sec, 21627 bytes/sec, 448.22 docs/sec
skipping non-plain index 'testrt'...
total 4 reads, 0.000 sec, 0.1 kb/call avg, 0.0 msec/call avg
total 12 writes, 0.000 sec, 0.1 kb/call avg, 0.0 msec/call avg

In sphinx.conf, I have given:

source src1
{
    type            = mysql

    sql_host        = <myhostname>
    sql_user        = <myusername>
    sql_pass        = <mypass>
    sql_db          = test
    sql_port        = 3306  # optional, default is 3306

    sql_query       = \
        SELECT id, group_id, UNIX_TIMESTAMP(date_added) AS date_added, title, content \
        FROM documents

    sql_attr_uint       = group_id
    sql_attr_timestamp  = date_added
}
index indtest
{
    source          = src1
    path            = /mypath/sphinx/data/indtest
}

I checked at the given path, 9 files of indtest are created with extensions spa,spd,spe,sph,spi,spk,spm,spp,sps.
But when I fire show tables; after connecting to searchd (mysql -h0 -P9306), I couldn't see my index. What could be the problem and solution? Is anything related to file access permission issue?


Solution

  • Got it solved, after too much struggle. Problem got caught when I ran indexer with --rotate option. Error thrown after running indexer --rotate --all

    WARNING: failed to open pid_file '/mypath/sphinx/log/searchd.pid'.
    WARNING: indices NOT rotated.
    

    When tried to stop searchd, /usr/bin/searchd --stop, I got

    FATAL: stop: pid file '/mypath/sphinx/log/searchd.pid' does not exist or is not readable Finally, killed the process and started again.

    Thanks @barryhunter for help. I am newbie, so I might have taken too much time to get the problem fixed.