Minimal configuration to play with Manticore Search

If you want to start learning Manticore Search plain indexes or see how some its feature works the following simplest Manticoresearch configuration might be useful:

source min {
    type = mysql
    sql_host = localhost
    sql_user = root
    sql_pass =
    sql_db = test
    sql_query = select 1, 'cat' union select 2, 'dog'
}
index idx_min {
    path = idx
    source = min
}
searchd {
    listen = 9306:mysql41
    log = searchd.log
    pid_file = manticoresearch.pid
    binlog_path =
}

It contains almost nothing, but only the things Manticoresearch cannot work without. Those are:

  • Section “source” to fetch data from mysql. In this case we don’t even fetch real data from mysql, but just use mysql interface having the data defined right in the config (“select 1, ‘cat’ union select 2, ‘dog’”). It will create 2 documents in Manticoresearch: one containing word “cat”, another one with word “dog”, the ids are 1 and 2 respectively.
  • Section “index” to create index based on the above source, it contains only reference to the source (“source = min”) and path to the index (“path = idx”). Once you build this index files idx.* will be created in the dir you start ‘indexer’ from.
  • Section “searchd” to tell Manticoresearch what ports it should be listening (“listen = 9306:mysql41” which means that SphinxQL should be used to talk to Manticoresearch on this port), what log it should use (“log = searchd.log”) and where it should save its process id (“pid_file = manticoresearch.pid”).

Here’s an example of using this config:

Indexing:

[snikolaev@dev01 ~]$ indexer -c min.conf --all
Manticore 2.6.1 9a706b4@180119 dev
Copyright (c) 2001-2016, Andrew Aksyonoff
Copyright (c) 2008-2016, Sphinx Technologies Inc (http://sphinxsearch.com)
Copyright (c) 2017-2018, Manticore Software LTD (http://manticoresearch.com)

using config file 'min.conf'...
indexing index 'idx_min'...
WARNING: Attribute count is 0: switching to none docinfo
collected 2 docs, 0.0 MB
sorted 0.0 Mhits, 100.0% done
total 2 docs, 6 bytes
total 0.045 sec, 131 bytes/sec, 43.75 docs/sec
total 3 reads, 0.000 sec, 10.6 kb/call avg, 0.0 msec/call avg
total 9 writes, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg

Starting ‘searchd’ and fetching results using mysql client:
[snikolaev@dev01 ~]$ searchd -c min.conf
Manticore 2.6.2 df9dc57@180213 dev
Copyright (c) 2001-2016, Andrew Aksyonoff
Copyright (c) 2008-2016, Sphinx Technologies Inc (http://sphinxsearch.com)
Copyright (c) 2017-2018, Manticore Software LTD (http://manticoresearch.com)

using config file 'min.conf'...
listening on all interfaces, port=9306
precaching index 'idx_min'
precached 1 indexes in 0.001 sec

[snikolaev@dev01 ~]$ mysql -P9306 -h0
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 2.6.2 df9dc57@180213 dev

Copyright (c) 2009-2017 Percona LLC and/or its affiliates
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> select * from idx_min where match('dog');
+------+
| id |
+------+
| 2 |
+------+
1 row in set (0.00 sec)

mysql> select * from idx_min where match('cat');
+------+
| id |
+------+
| 1 |
+------+
1 row in set (0.00 sec)

When searchd is running if you want to rebuild the index you can do it without stopping the searchd if you run indexer –rotate:

[snikolaev@dev01 ~]$ indexer -c min.conf --all --rotate
Manticore 2.6.1 9a706b4@180119 dev
Copyright (c) 2001-2016, Andrew Aksyonoff
Copyright (c) 2008-2016, Sphinx Technologies Inc (http://sphinxsearch.com)
Copyright (c) 2017-2018, Manticore Software LTD (http://manticoresearch.com)</pre>
using config file 'min.conf'...
indexing index 'idx_min'...
WARNING: Attribute count is 0: switching to none docinfo
collected 2 docs, 0.0 MB
sorted 0.0 Mhits, 100.0% done
total 2 docs, 6 bytes
total 0.003 sec, 1547 bytes/sec, 515.86 docs/sec
total 3 reads, 0.000 sec, 10.6 kb/call avg, 0.0 msec/call avg
total 9 writes, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg
rotating indices: successfully sent SIGHUP to searchd (pid=27004).

As you can see in the last line the indexer sent signal to the searchd to make it rotate the index.

Enjoy playing with Manticoresearch!
“The article is based on “Minimal Sphinx configuration to play with Sphinx” written by Sergey Nikolaev https://www.ivinco.com/blog/minimal-sphinx-configuration-to-play-with-sphinx/ and updated in cooperation with the author, publication is authorized by him

2 thoughts on “Minimal configuration to play with Manticore Search

  • The ‘indexer’ command used seems to have gone missing. quite easy to deduce if know how (eg `indexer -c min.conf idx_min`), but should be there for reference. also think it would be really nice to show a second indexer call (with –rotate) after searchd is running!

Leave a Reply