msyql没有与sphinxsearch连接

时间:2016-04-27 10:32:51

标签: sphinx

我无法连接sphinxsearch mysql mysql -h0 -P3306

ERROR 2003(HY000):无法在' 0'上连接到MySQL服务器(111)

如何删除此错误

这是我的配置文件代码 sphinx.conf

我们需要开始任何服务吗?

source src1
{
    type            = mysql
    sql_host        = localhost
    sql_user        = root
    sql_pass        = india@123
    sql_db          = test
    sql_port        = 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
    sql_ranged_throttle = 0
    sql_query_info        = SELECT * FROM documents WHERE id=$id

}

source src1throttled : src1
{
    sql_ranged_throttle = 100
}
index test1
{
    source          = src1
    path            = /var/lib/sphinxsearch/data/test1
    docinfo         = extern
    dict            = keywords
    mlock           = 0 
    morphology      = none
    min_word_len    = 1
    html_strip      = 0
}
index test1stemmed : test1
{
    path            = /var/lib/sphinxsearch/data/test1stemmed
    morphology      = stem_en
}
index dist1
{
    type            = distributed
    local           = test1
    local           = test1stemmed
    agent           = localhost:9313:remote1
    agent           = localhost:9314:remote2,remote3
    agent_connect_timeout   = 1000
    agent_query_timeout     = 3000
}
index rt
{
    type            = rt
    path            = /var/lib/sphinxsearch/data/rt
    rt_field        = title
    rt_field        = content
    rt_attr_uint        = gid
}
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
{
}

2 个答案:

答案 0 :(得分:0)

  

mysql -h0 -P3306

你正试图连接到3306端口。为什么?

您似乎已经在端口9306上搜索了

listen          = 9306:mysql41

......是的,您需要searchd实际运行。服务'在不同的发行版中可能被称为不同的东西。

答案 1 :(得分:0)

确保sphinx用户拥有此文件夹的权限!

chown -R sphinx:sphinx /var/lib/sphinxsearch/