📜 ⬆️ ⬇️

Installing SphinxSE on Percona Server

Neither Sphinx , nor Percona Server needs any special introduction. SphinxSE is not the main, but in some way more convenient access interface to Sphinx searchd, designed as a storage engine of the MySQL plugin.

The Sphinx documentation describes the installation of SphinxSE, but it does not work. Under the cut there is a short instruction on a bunch of percones with a sphinx, which worked for me and, possibly, will save someone a few hours of healthy sleep.

So, we have Percona Server 5.5.28 and Sphinx 2.0.6 installed from the packages. In my case, this is RPM on CentOS 6.
If sphinx is not installed, requiring libmysqlclient.so.x
And in the system there is only a more recent version of the library, just put the package Percona-Server-shared-compat

To build the plugin, we need the source of both packages. Download and unpack:
[user@host ~]$ wget http://sphinxsearch.com/files/sphinx-2.0.6-release.tar.gz [user@host ~]$ tar -xzf sphinx-2.0.6-release.tar.gz [user@host ~]$ wget http://www.percona.com/redir/downloads/Percona-Server-5.5/Percona-Server-5.5.28-29.1/source/Percona-Server-55-5.5.28-rel29.1.334.rhel6.src.rpm [user@host ~]$ rpm -i Percona-Server-55-5.5.28-rel29.1.334.rhel6.src.rpm [user@host ~]$ cd rpmbuild/ [user@host rpmbuild]$ rpmbuild -bp SPECS/percona-server.spec 

We carry out the first two steps from the official documentation , they are common to both methods:
 [user@host rpmbuild]$ cd BUILD/Percona-Server-5.5.28-rel29.1/Percona-Server-5.5.28-rel29.1/ [user@host Percona-Server-5.5.28-rel29.1]$ cp -R ~/sphinx-2.0.6-release/mysqlse storage/sphinx [user@host Percona-Server-5.5.28-rel29.1]$ sh BUILD/autorun.sh 

Method 1 - official


We offer to build and install MySQL completely. Understandably, this does not suit us. We are trying to build only the plugin:
 [user@host Percona-Server-5.5.28-rel29.1]$ ./configure [user@host Percona-Server-5.5.28-rel29.1]$ cd storage/sphinx/ [user@host sphinx]$ make 

Go to .so , copy it to the MySQL plugins directory (replace the path with yours):
 [root@host sphinx]# cp ha_sphinx.so /usr/lib64/mysql/plugin/ 

Now we climb into the mysql install plugin:
 [user@host sphinx]$ mysql -uroot -p mysql> INSTALL PLUGIN sphinx SONAME 'ha_sphinx.so'; mysql> SHOW ENGINES; 

We see SPHINX in the list of engines - everything seems to be fine. Create a lookup table:
 CREATE TABLE sphinx ( id BIGINT UNSIGNED NOT NULL, weight INTEGER NOT NULL, query VARCHAR(3072) NOT NULL, INDEX(query) ) ENGINE=SPHINX CONNECTION="sphinx://127.0.0.1:9312/*"; 
Note
In the documentation, instead of BIGINT and 127.0.0.1, INTEGER and localhost are indicated, respectively, but the table is not created with them and the host does not resolve.

And we fall out in segfault. The DBMS crashes on any access to this table, and even just by querying show tables .

Method 2 - Work


From Google, we will learn about the magic key -DBUILD_CONFIG = mysql_release for cmake.
 [user@host Percona-Server-5.5.28-rel29.1]$ rm -f CMakeCache.txt [user@host Percona-Server-5.5.28-rel29.1]$ cmake . -DBUILD_CONFIG=mysql_release [user@host Percona-Server-5.5.28-rel29.1]$ cd storage/sphinx/ && make 
Hidden text
In that post there are still a lot of terrible options, but they are needed only for the complete assembly of MySQL.

Instead of manually clearing the cache and running cmake, you can edit cmake / configure.pl
 -my $cmakeargs = ""; +my $cmakeargs = "-DBUILD_CONFIG=mysql_release"; 
and run configure.
')
Copy ha_sphinx.so to / usr / lib64 / mysql / plugin / and restart the perkona. Oddly enough, it works.

Source: https://habr.com/ru/post/161461/


All Articles