如何解决sphinx启动报错:sql_connect: failed to load libmysqlclient (or libmariadb)
本篇内容主要讲解"如何解决sphinx启动报错:sql_connect: failed to load libmysqlclient (or libmariadb)",感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习"如何解决sphinx启动报错:sql_connect: failed to load libmysqlclient (or libmariadb)"吧!
问题
在centos 7 下载shpinx 3 后,启动./bin/indexer 或 ./bin/searchd 报错:
ERROR: index 'attr_node': sql_connect: failed to load libmysqlclient (or libmariadb) (DSN=mysql://apps:***@localhost:3306/phalapi).
解决方案
1、尝试添加软链接
# find / -name 'libmysqlclient*'
/usr/lib64/mysql/libmysqlclient.so.18
/usr/lib64/mysql/libmysqlclient.so.18.0.0
# ll /usr/lib64/mysql/libmysqlclient.so.18*
# ln -s /usr/lib64/mysql/libmysqlclient.so.18.0.0 /usr/lib/libmysqlclient.so
但是发现不行。
2、尝试添加环境变量
# vim /etc/ld.so.conf
export LD_LIBRARY_PATH=/usr/lib64/mysql:$LD_LIBRARY_PATH
source后再次执行启动脚本 也不行。
3、修改/etc/ld.so.conf,可以了!
执行:
[root@localhost sphinx-3.1.1]# echo "/usr/lib64/mysql" >> /etc/ld.so.conf && ldconfig
结果,成功了!索引构建与启动都成功了!
[root@localhost sphinx-3.1.1]# ./bin/indexer --all
Sphinx 3.1.1 (commit 612d99f)
Copyright (c) 2001-2018, Andrew Aksyonoff
Copyright (c) 2008-2016, Sphinx Technologies Inc (http://sphinxsearch.com)
using config file './sphinx.conf'...
WARNING: key 'docinfo' was permanently removed from Sphinx configuration. Refer to documentation for details.
WARNING: key 'dict' was permanently removed from Sphinx configuration. Refer to documentation for details.
WARNING: key 'mva_updates_pool' was permanently removed from Sphinx configuration. Refer to documentation for details.
indexing index 'attr_node'...
collected 10 docs, 0.0 MB
sorted 0.0 Mhits, 100.0% done
total 10 docs, 3.7 Kb
total 0.0 sec, 149.3 Kb/sec, 400 docs/sec
[root@localhost sphinx-3.1.1]# ./bin/searchd
Sphinx 3.1.1 (commit 612d99f)
Copyright (c) 2001-2018, Andrew Aksyonoff
Copyright (c) 2008-2016, Sphinx Technologies Inc (http://sphinxsearch.com)
using config file './sphinx.conf'...
WARNING: key 'docinfo' was permanently removed from Sphinx configuration. Refer to documentation for details.
WARNING: key 'dict' was permanently removed from Sphinx configuration. Refer to documentation for details.
WARNING: key 'mva_updates_pool' was permanently removed from Sphinx configuration. Refer to documentation for details.
listening on all interfaces, port=9312
listening on all interfaces, port=9306
precaching index 'attr_node'
precached 1 indexes in 0.007 sec
到此,相信大家对"如何解决sphinx启动报错:sql_connect: failed to load libmysqlclient (or libmariadb)"有了更深的了解,不妨来实际操作一番吧!这里是网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!