这几天运行搜索功能的时候,最新的数据总是出不来,一查该目录空间基本上用完,担心是不是空间不够用了,于是就把sphinx的配置sphinx.conf索引目录更改了一下,结果还是搜索不到更新的内容,就重建了一下索引,结果就出现了这两个警告,在重新查询还是查不到更新的数据,急需解决在线等
[root@localhost etc]# /usr/local/sphinx/bin/indexer --rotate --all
Sphinx 0.9.8-rc2 (r1234)
Copyright (c) 2001-2008, Andrew Aksyonoffusing config file '/usr/local/sphinx/etc/sphinx.conf'...
indexing index 'test1'...
collected 16953 docs, 22.0 MB
sorted 4.5 Mhits, 100.0% done
total 16953 docs, 22031499 bytes
total 13.168 sec, 1673095.13 bytes/sec, 1287.43 docs/sec
indexing index 'indexposition'...
collected 112018 docs, 54.3 MB
sorted 10.6 Mhits, 100.0% done
total 112018 docs, 54305866 bytes
total 35.854 sec, 1514626.08 bytes/sec, 3124.26 docs/sec
indexing index 'zhinaowisdom'...
collected 3160 docs, 0.6 MB
collected 3026 attr values
sorted 0.0 Mvalues, 100.0% done
sorted 0.1 Mhits, 100.0% done
total 3160 docs, 633657 bytes
total 0.592 sec, 1069711.06 bytes/sec, 5334.57 docs/sec
indexing index 'institue'...
collected 2 docs, 0.0 MB
collected 3026 attr values
sorted 0.0 Mvalues, 100.0% done
sorted 0.0 Mhits, 100.0% done
total 2 docs, 3542 bytes
total 0.069 sec, 51631.51 bytes/sec, 29.15 docs/sec
indexing index 'demand'...
collected 2400 docs, 0.5 MB
sorted 0.1 Mhits, 100.0% done
total 2400 docs, 520777 bytes
total 0.350 sec, 1485904.61 bytes/sec, 6847.79 docs/sec
indexing index 'school'...
collected 33 docs, 0.0 MB
collected 3026 attr values
sorted 0.0 Mvalues, 100.0% done
sorted 0.0 Mhits, 100.0% done
total 33 docs, 6251 bytes
total 0.015 sec, 415041.37 bytes/sec, 2191.07 docs/sec
WARNING: no process found by PID 7077.
WARNING: indices NOT rotated.

解决方案 »

  1.   

    --rotate 参数是searchd开着的时候用的, 如果没开的话就不用加这个参数了。
      

  2.   

    看一下searchd的 pid 是不是 和 indexer提示的一致阿。或者把searchd停了再建索引试试。WARNING: no process found by PID 7077.
    WARNING: indices NOT rotated.
    没有在PID 7077找到进程
    索引没有轮换
      

  3.   

    能详细点吗?我是刚接触sphinx.不怎么会用。
      

  4.   

    我看了一下searchd.log日志[Fri May  7 09:59:47.620 2010] [ 9391] failed to bind on 0.0.0.0:3312, retrying...
    [Fri May  7 09:59:50.620 2010] [ 9391] failed to bind on 0.0.0.0:3312, retrying...
    [Fri May  7 09:59:53.620 2010] [ 9391] failed to bind on 0.0.0.0:3312, retrying...
    [Fri May  7 09:59:56.620 2010] [ 9391] failed to bind on 0.0.0.0:3312, retrying...
    [Fri May  7 09:59:59.620 2010] [ 9391] failed to bind on 0.0.0.0:3312, retrying...
    [Fri May  7 10:00:02.620 2010] [ 9391] failed to bind on 0.0.0.0:3312, retrying...
    [Fri May  7 10:00:05.620 2010] [ 9391] failed to bind on 0.0.0.0:3312, retrying...
    [Fri May  7 10:00:08.619 2010] [ 9391] failed to bind on 0.0.0.0:3312, retrying...
    [Fri May  7 10:00:11.619 2010] [ 9391] failed to bind on 0.0.0.0:3312, retrying...绑定失败怎么解决?
      

  5.   

    使用--rotate参数的时候 indexer 生成新的索引不影响当前的searchd进程,但是当索引生成完毕会通知searchd使用新的索引,也就是轮换索引。
    你的情况是indexer通知searchd换索引的时候。根据PID没有找到searchd的进程,所以索引没有更新成功。
    你的searchd.log日志 提示没有成功邦定3312端口。有可能是有进程占用了该端口。建议你找到占用3312的程序并停止,然后再开启searchd试一下。
    如果是已有的searchd占用3312,可以先kill掉再重启searchd试一下。
      

  6.   

    在这里谢谢vn700上面的问题已经解决了,但是又出现了新的问题,就是说建索引不会出问题,但是在运行/usr/local/sphinx/bin/indexer --rotate --all 的时候,查出来的数据和sphinx.conf配置里面的sql_query=.......的语句在数据库里面查的数据不一至,是怎么回事,还有一个问题是其中的一个用searchd一条数据也查不出来
      

  7.   

    检查一下 indexer 指定的 sphinx.conf 是不是你的 sphinx.conf 可以通过添加 config参数 指定 配置文件位置: --config /usr/local/etc/sphinx.conf
    检查一下sphinx.conf文件.是否有重名的source ,index对应的source是否正确。。"其中的一个用searchd一条数据也查不出来" 是指其中的一个index,还是说你做了searchd 集群阿- -|检查一下sphinx.conf先吧
      

  8.   

    [root@localhost /]# /usr/local/sphinx/bin/indexer --rotate --all
    Sphinx 0.9.8-rc2 (r1234)
    Copyright (c) 2001-2008, Andrew Aksyonoffusing config file '/usr/local/sphinx/etc/sphinx.conf'...
    indexing index 'test1'...
    collected 16994 docs, 22.1 MB
    sorted 4.5 Mhits, 100.0% done
    total 16994 docs, 22097511 bytes
    total 13.373 sec, 1652350.17 bytes/sec, 1270.73 docs/sec
    indexing index 'indexposition'...
    collected 112055 docs, 54.3 MB
    sorted 10.6 Mhits, 100.0% done
    total 112055 docs, 54327964 bytes
    total 35.848 sec, 1515507.98 bytes/sec, 3125.83 docs/sec
    indexing index 'zhinaowisdom'...
    collected 3174 docs, 0.6 MB
    collected 3028 attr values
    sorted 0.0 Mvalues, 100.0% done
    sorted 0.1 Mhits, 100.0% done
    total 3174 docs, 633860 bytes
    total 0.573 sec, 1106052.04 bytes/sec, 5538.46 docs/sec
    indexing index 'institue'...
    collected 2 docs, 0.0 MB
    collected 3028 attr values
    sorted 0.0 Mvalues, 100.0% done
    sorted 0.0 Mhits, 100.0% done
    total 2 docs, 3542 bytes
    total 0.069 sec, 51637.41 bytes/sec, 29.16 docs/sec
    indexing index 'demand'...
    collected 2407 docs, 0.5 MB
    sorted 0.1 Mhits, 100.0% done
    total 2407 docs, 521688 bytes
    total 0.356 sec, 1467316.22 bytes/sec, 6770.00 docs/sec
    indexing index 'school'...
    collected 33 docs, 0.0 MB
    collected 3028 attr values
    sorted 0.0 Mvalues, 100.0% done
    sorted 0.0 Mhits, 100.0% done
    total 33 docs, 6251 bytes
    total 0.015 sec, 411122.20 bytes/sec, 2170.38 docs/sec
    rotating indices: succesfully sent SIGHUP to searchd (pid=9186).
      

  9.   

    indexing index 'test1'
    查不到数据
    indexing index 'school'...
    collected 33 docs, 0.0 MB
    collected 3028 attr values
    sorted 0.0 Mvalues, 100.0% done
    sorted 0.0 Mhits, 100.0% done这个才查到33条,和数据库需的数据不符