其他分享
首页 > 其他分享> > sphinx配置启动

sphinx配置启动

作者:互联网

vim  /usr/local/sphinx/etc/sphinx-min.conf

source main
{
    type            = mysql

    sql_host        = localhost
    sql_user        = root
    sql_pass        = root
    sql_db          = test
    sql_port        = 3306  # optional, default is 3306

    sql_query       = \
        SELECT id, title, content FROM post

}


index main
{
    source          = main
    path            = /usr/local/sphinx/data/main
}



indexer
{
    mem_limit       = 128M
}


searchd
{
    listen          = 9312
    listen          = 9306:mysql41
    log             = /usr/local/sphinx/sphinxdata/logs/searchd.log
    query_log       = /usr/local/sphinx/sphinxdata/logs/query.log
    read_timeout    = 5
    max_children    = 30
    pid_file        = /var/log/searchd.pid
    seamless_rotate = 1
    preopen_indexes = 1
    unlink_old      = 1
    workers         = threads # for RT to work
    binlog_path     = /usr/local/sphinx/sphinxdata
}

建立索引 indexer -c sphinx-min.conf --all

启动 searchd --config /usr/local/sphinx/etc/sphinx-min.conf

启动可能报错:WARNING: both 'sphinxdata' and config file 'sphinx-min.conf' exist; using 'sphinxdata' folder

no config file, using 'sphinxdata' folder...

解决方法:

将 /usr/local/sphinx/etc/sphinxdata重命名为sphinxdata_tmp即可

 

重建索引:indexer -c sphinx-min.conf --all --rotate

标签:sphinx,启动,sphinxdata,配置,usr,conf,sql,local
来源: https://www.cnblogs.com/fyiyy/p/15054899.html