sphinx增量索引的一個問題_PHP教程

來源:互聯網
上載者:User
但最近發現增量的總是搜尋不到,今天看了下作業記錄,有如下提示:

[Sun Apr 17 19:30:01.876 2011] [ 3400] WARNING: rotating index 'news_delta': cur to old rename failed: rename /dev/shm/sphinx/data/news_delta.spa to /dev/shm/sphinx/data/news_delta.old.spa failed: No such file or directory

[Sun Apr 17 19:30:01.881 2011] [ 3400] WARNING: rotating index 'article_delta': cur to old rename failed: rename /dev/shm/sphinx/data/article_delta.spa to /dev/shm/sphinx/data/article_delta.old.spa failed: No such file or directory

為提高增量索引速度,我將增量索引存放在/dev/shm中,看了下/dev/shm/sphinx/data/目錄下的內容:
-rw-r--r-- 1 root root 385762 Apr 17 19:21 article_delta.new.spd
-rw-r--r-- 1 root root 3713 Apr 17 19:21 article_delta.new.sph
-rw-r--r-- 1 root root 46260 Apr 17 19:21 article_delta.new.spi
-rw-r--r-- 1 root root 0 Apr 17 19:21 article_delta.new.spk
-rw-r--r-- 1 root root 0 Apr 17 19:21 article_delta.new.spm
-rw-r--r-- 1 root root 261402 Apr 17 19:21 article_delta.new.spp

奇怪,應該要有article_delta.spd等檔案,不應該是.new的檔案。
增量索引時是使用--rotate參數的,
複製代碼 代碼如下:
bin/indexer --rotate news_delta
bin/indexer --rotate article_delta

在rotate時,需要將原article_delta.spa重新命名為article_delta.old.spa,然後將article_delta.new.spa重新命名為article_delta.spa,再通知searchd重啟完成rotate。

想起應該是前幾天淩晨重啟過機器,原檔案都丟了,導致無法rotate:(

解決方案:
運行:bin/indexer article_delta
建立了article_delta.spd,sph等檔案。

再運行:bin/indexer article_delta --rotate
作業記錄提示:rotating index 'article_delta': success
正常了!

把要做增量索引的命令寫了個指令碼,放在rc.local中,這樣重啟過機器就不會再出現這種問題了。
複製代碼 代碼如下:
echo "start:" $(date +"%y-%m-%d %H:%M:%S")
cd /usr/local/coreseek/bin
./indexer news_delta
./indexer article_delta
echo "end:" $(date +"%y-%m-%d %H:%M:%S")

http://www.bkjia.com/PHPjc/323698.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/323698.htmlTechArticle但最近發現增量的總是搜尋不到,今天看了下作業記錄,有如下提示: [Sun Apr 17 19:30:01.876 2011] [ 3400] WARNING: rotating index 'news_delta': cur to old...

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.