In this article, we address a common issue that users frequently encounter when attempting to import data from MySQL into Manticore.
Manticore’s ability to index data from MySQL using the indexer
tool is widely recognized. However, before we delve into the specific issue headlined in this article, let’s first establish an understanding of the relationship between Manticore and MySQL.
Currently, the most potent API Manticore offers is SphinxQL. This API utilizes the MySQL transport protocol, greatly simplifying search tasks and other operations due to the similarity of its query language syntax with MySQL. MySQL protocol commands needed for SphinxQL are natively implemented in the searchd
. Therefore, Manticore does not have a minimum MySQL library or MySQL requirement to operate on the host where Manticore is installed.
The indexer
tool can interface with a MySQL database and retrieve data to construct a Manticore index. This connection to a MySQL database is facilitated via the official C++ client provided for MySQL developers. Importantly, when Manticore is compiled, the MySQL client library is not embedded in Manticore binaries. This is also the case for PostgreSQL, XML pipes, and ODBC. If an indexer
user wishes to connect to PostgreSQL, MySQL, or a database supporting ODBC, the requisite driver libraries must be installed on the same system where the indexer resides.
So, what causes the ‘MySQL source wasn’t initialized. Wrong name in dlopen?’ error message?
There are several potential culprits:
libmysqlclient
may not be installed on your system. This library is distributed with the Linux package and can be labeled differently across platforms:- On CentOS/RHEL, it’s termed
mysql-libs
. - Debian/Ubuntu users should look for
default-libmysqlclient-dev
. - Alpine includes
mariadb-connector-c-dev
packages.
- On CentOS/RHEL, it’s termed
Even if
libmysqlclient
is installed, it might not be the correct version. Indexer is compiled against a particular client library version, which is typically bundled with the default MySQL package of the Linux distribution. MySQL versions can vary across Linux distributions, with some using the official MySQL, and others opting for MariaDB as the default.Issues arise when you upgrade to a new major version of MySQL or switch to a different MySQL variant. Both scenarios can lead to compatibility problems, as these actions can introduce a different (typically newer) version of the client library.
MySQL distributions provide a compatibility package that includes older versions of the client library for applications designed to operate with those versions. For instance, if you’re switching to a distribution that defaults to MariaDB but wish to use the latest official MySQL, you should install the
mysql-community-libs-compat
compatibility package from the official MySQL source.You might have installed an inappropriate Manticore package. For example, you could be using Ubuntu but accidentally installed the Manticore Debian package. While
searchd
may function, the indexer may not work if it was intended for a different version than the one supplied by your current distribution.A less common scenario occurs when MySQL is manually installed, or the MySQL client library is not included in the shared libraries path for some reason. Although Manticore is indifferent to the installation method of MySQL, it must be able to locate the client library using the operating system’s shared library path, typically found at
/usr/lib
or/usr/lib/x86_64-linux-gnu/
. In such cases,libmysqlclient
should be added (or symlinked) to the default ld path. If you’re using a custom path, you’ll need to include that path in/etc/ld.so.conf.d/
. For instance, in some distributions, the client libraries are situated in the/usr/lib/mysql
folder, and the package that installs these files also contributes an entry to/etc/ld.so.conf.d/
. Alternatively, the ld library path can be adjusted to include the MySQL library when initiating a daemon, such asLD_LIBRARY_PATH=/path/to/mysql searchd
. If you utilize a systemd unit file, you can set it in theEnvironment
, but it is generally recommended to resolve the client library path system-wide. This is due to potential changes in unit files brought about by future updates.