shpinx安装配置

死玻璃卖宝石发达了,要弄网站做强做大,搞了套icms迁移到阿里云
修改了一些小bug外增加了shpinx检索服务,未做分词优化

apt-get install sphinxsearch

vi /etc/sphinxsearch/sphinx.conf

source iCMS_article
{
  type    = mysql
  sql_host  = localhost
  sql_user  = gemknow
  sql_pass  = gemknow
  sql_db    = gemknow
  sql_port  = 3306  # optional, default is 3306
  sql_query_pre =  SET NAMES utf8mb4
  sql_query_pre   = REPLACE INTO gn_sph_counter SELECT 1, MAX(id) FROM gn_article

  sql_query = SELECT a.id, a.cid,a.userid, a.comments, a.pubdate,a.hits_today, a.hits_yday, a.hits_week, a.hits_month,a.hits, a.haspic, a.title, a.keywords, a.tags, a.status FROM gn_article a,gn_category c WHERE a.cid=c.cid AND a.status ='1' AND a.id<=( SELECT max_doc_id FROM gn_sph_counter WHERE counter_id=1 )
  sql_attr_uint   = cid
  sql_attr_uint   = userid
  sql_attr_uint   = comments
  sql_attr_uint   = hits
  sql_attr_uint   = hits_week
  sql_attr_uint   = hits_month
  sql_attr_uint   = status
  sql_attr_timestamp  = pubdate
  sql_attr_bool   = haspic

  sql_ranged_throttle = 0

}
source iCMS_article_delta : iCMS_article
{
  sql_query_pre =  SET NAMES utf8
  sql_query = SELECT a.id, a.cid,a.userid, a.comments, a.pubdate,a.hits_today, a.hits_yday, a.hits_week, a.hits_month,a.hits, a.haspic, a.title, a.keywords, a.tags, a.status FROM gn_article a,gn_category c WHERE a.cid=c.cid AND a.status ='1' AND a.id>( SELECT max_doc_id FROM gn_sph_counter WHERE counter_id=1 )
}
index iCMS_article
{
  source      = iCMS_article
  path      = /var/lib/sphinxsearch/data/iCMS_article
        docinfo                 = extern
        mlock                   = 0
        morphology              = none
        min_word_len            = 1
        min_prefix_len          = 0
        html_strip              = 1
        charset_table           = 0..9, A..Z->a..z, _, a..z, U+410..U+42F->U+430..U+44F, U+430..U+44F
        ngram_len               = 1
        ngram_chars             = U+3000..U+2FA1F
}
index iCMS_article_delta : iCMS_article
{
  source  = iCMS_article_delta
  path  = /var/lib/sphinxsearch/data/iCMS_article_delta
}

indexer
{
  mem_limit   = 128M
}

searchd
{
  listen      = 9312
  listen      = 9306:mysql41
  log     = /var/log/sphinxsearch/searchd.log
  query_log   = /var/log/sphinxsearch/query.log
  read_timeout    = 5
  client_timeout    = 300
  max_children    = 30
  persistent_connections_limit  = 30
  pid_file    = /var/run/sphinxsearch/searchd.pid
  seamless_rotate   = 1
  preopen_indexes   = 1
  unlink_old    = 1
  mva_updates_pool  = 1M
  max_packet_size   = 8M
  max_filters   = 256
  max_filter_values = 4096
  max_batch_queries = 32
  workers     = threads # for RT to work
}

common
{

}
indexer --all

#如果没问题加crontab
@hourly /usr/bin/indexer --rotate --config /etc/sphinxsearch/sphinx.conf --all

发表评论

电子邮件地址不会被公开。 必填项已用*标注