无法将mysql连接到sphinx搜索

alen0pnh  于 2021-06-20  发布在  Mysql
关注(0)|答案(2)|浏览(321)

我使用的是mysql服务器的最新版本,我希望将其连接到sphinx搜索。但是,当我尝试通过带有“sphinxql”的cmd连接到服务器时,我遇到:

ERROR 200 (HY000): Unknown MySQL error

这是通过尝试:

searchd -P9306

接收:

[Wed Aug 29 10:41:28.893 2018] [22560] listening on 127.0.0.1:9312
[Wed Aug 29 10:41:28.893 2018] [22560] listening on all interfaces, port=9306
[Wed Aug 29 10:41:28.959 2018] [22560] WARNING: No extra index definitions found in data folder
[Wed Aug 29 10:41:28.965 2018] [22560] accepting connections
[Wed Aug 29 10:41:28.966 2018] [21976] prereading 2 indexes
[Wed Aug 29 10:41:28.966 2018] [21976] prereaded 2 indexes in 0.000 sec

但是,我可以用同样的方法连接到3306端口,并成功地进入基本mysql服务器。我听说sphinx和sql保存密码的方式有些不同,所以我使用mysql\u native\u密码和更新版本的用户都没有用。
索引器运行得很好,但是当我具体地旋转索引时,遇到了一个关于无法打开pid\u文件的错误。这可能没有关系。
下面是我的代码剪报:


# 

# Minimal Sphinx configuration sample (clean, simple, functional)

# 

source src1
{
    type            = mysql

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

    sql_query       = SELECT id, name, storage, colour, network, quality, price, UNIX_TIMESTAMP() AS last_modified FROM phones
    # UNIX_TIMESTAMP() AS

    sql_attr_timestamp  = last_modified
}

index test1
{
    source          = src1
    path            = C:/Program Files/sphinx-3.0.3/data/test1
}

index testrt
{
    type            = rt
    rt_mem_limit    = 128M

    path            = C:/Program Files/sphinx-3.0.3/data/testrt

    rt_field        = id
    rt_field        = name
    rt_field        = storage
    rt_field        = colour
    rt_field        = network
    rt_field        = condition
    rt_field        = price
    rt_field        = last_modified
    rt_attr_uint    = gid
}

indexer
{
    mem_limit       = 128M
}

searchd
{
    mysql_version_string = 5.0.37
    listen          = localhost:9312
    listen          = 9306:mysql41
    log         = C:/Program Files/sphinx-3.0.3/log/searchd.log
    query_log       = C:/Program Files/sphinx-3.0.3/log/query.log
    read_timeout        = 5
    max_children        = 30
    pid_file        = C:/Program Files/sphinx-3.0.3/log/searchd.pid
    seamless_rotate     = 1
    preopen_indexes     = 1
    unlink_old      = 1
    workers         = threads # for RT to work
    binlog_path     = C:/Program Files/sphinx-3.0.3/data
}
ktca8awb

ktca8awb1#

使用较旧版本的mysql客户机进行连接可以很好地工作,即使sphinx从较新的服务器上拉过来。谢谢你们的帮助。

piztneat

piztneat2#

看起来您正在使用mysql 8客户端。斯芬克斯还不能与之兼容。你可以尝试manticore搜索(斯芬克斯的一个分支)。

[root@sehs01 mysql-8.0.11-el7-x86_64]# ./bin/mysql --version
./bin/mysql  Ver 8.0.11 for el7 on x86_64 (MySQL Community Server - GPL)

[root@sehs01 mysql-8.0.11-el7-x86_64]# ./bin/mysql -hse01 -P6312
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 2.7.2 58d96fd@180822 dev

相关问题