Have you ever found yourself confused about the different modes in Manticore Search? You’re not alone. Many developers struggle to understand the difference between Real-time (RT) mode and Plain mode when they first start using Manticore Search. But don’t worry – it’s actually quite simple once you understand the core concepts.
In this guide, we’ll demystify these two operational modes and show you exactly when and how to use each one.
Understanding Manticore Search Modes
Manticore Search offers two primary operational modes:
- Real-time (RT) mode - The default mode that allows you to create and drop tables on the fly
- Plain mode - Works with static schemas and plain tables built from external storage sources
Let’s dive deeper into each mode to understand their capabilities and limitations.
Real-time (RT) Mode: Dynamic and Flexible
RT mode is the default and most commonly used mode in Manticore Search. It’s designed for dynamic environments where you need to create, modify, or drop tables without restarting the service.
How to Identify RT Mode
The key indicator of RT mode is the presence of the data_dir
directive in your configuration file. Let’s look at a typical configuration:
cat /opt/homebrew/etc/manticoresearch/manticore.conf
searchd {
listen = 127.0.0.1:9312
listen = 127.0.0.1:9306:mysql
listen = 127.0.0.1:9308:http
log = /opt/homebrew/var/log/manticore/searchd.log
query_log = /opt/homebrew/var/log/manticore/query.log
pid_file = /opt/homebrew/var/run/manticore/searchd.pid
data_dir = /opt/homebrew/var/manticore
}
Notice the data_dir
directive in the configuration. This single line is what enables RT mode.
Creating Tables on the Fly
One of the biggest advantages of RT mode is the ability to create tables dynamically:
mysql -P9306 -h0 -v
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 759523
Server version: 7.0.1 763f4a0b9@25013111 dev (columnar 4.0.1 9f6686d@25012409) (secondary 4.0.1 9f6686d@25012409) (knn 4.0.1 9f6686d@25012409) git branch master...origin/master
Copyright (c) 2000, 2024, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Reading history-file /Users/sn/.mysql_history
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
Creating a table is as simple as:
mysql> create table t;
Query OK, 0 rows affected (0.00 sec)
And dropping it is just as easy:
mysql> drop table t;
Query OK, 0 rows affected (0.01 sec)
Replication Support
Another powerful feature exclusive to RT mode is replication. You can create clusters and add tables to them:
mysql> create table t;
Query OK, 0 rows affected (0.00 sec)
mysql> create cluster c;
Query OK, 0 rows affected (0.44 sec)
mysql> alter cluster c add t;
Query OK, 0 rows affected (0.00 sec)
Plain Mode: Stable and Structured
Plain mode is designed for environments where your schema is relatively stable and defined in advance. It’s particularly useful when working with external data sources.
How to Identify Plain Mode
The absence of the data_dir
directive in your configuration file indicates Plain mode. Let’s look at a Plain mode configuration:
cat ~/manticore/plain.conf
searchd {
listen = 9315:mysql41
log = searchd.log
pid_file = searchd.pid
binlog_path =
}
source src {
type = csvpipe
csvpipe_command = echo "1,abcdef,123"
csvpipe_field = f
csvpipe_attr_uint = a
}
table idx {
type = plain
source = src
path = idx
}
table rt {
type = rt
path = rt
rt_field = f
rt_attr_uint = a
}
Notice there’s no data_dir
directive, but there are table definitions directly in the configuration file.
Starting a Plain Mode Instance
Let’s start Manticore Search in Plain mode:
searchd -c plain.conf
Manticore 7.0.0 92c650401@25013002 (columnar 4.0.0 5aa8e43@25012409) (secondary 4.0.0 5aa8e43@25012409) (knn 4.0.0 5aa8e43@25012409)
Copyright (c) 2001-2016, Andrew Aksyonoff
Copyright (c) 2008-2016, Sphinx Technologies Inc (http://sphinxsearch.com)
Copyright (c) 2017-2024, Manticore Software LTD (https://manticoresearch.com)
[26:49.002] [20433033] using config file '/Users/sn/manticore/plain.conf' (344 chars)...
starting daemon version '7.0.0 92c650401@25013002 (columnar 4.0.0 5aa8e43@25012409) (secondary 4.0.0 5aa8e43@25012409) (knn 4.0.0 5aa8e43@25012409)' ...
listening on all interfaces for mysql, port=9315
precaching table 'idx'
Index header format is not json, will try it as binary...
WARNING: Unable to load header... Error failed to open idx.sph: No such file or directory
WARNING: table 'idx': prealloc: failed to open idx.sph: No such file or directory - NOT SERVING
precaching table 'rt'
precached 1 tables in 0.004 sec
Working with Tables in Plain Mode
When we check available tables, we can see that only the RT table is available initially:
mysql -P9315 -h0 -e "show tables"
+-------+------+
| Table | Type |
+-------+------+
| rt | rt |
+-------+------+
To make the plain table available, we need to build it using the indexer tool:
indexer -c plain.conf --all --rotate
Manticore 7.0.0 92c650401@25013002 (columnar 4.0.0 5aa8e43@25012409) (secondary 4.0.0 5aa8e43@25012409) (knn 4.0.0 5aa8e43@25012409)
Copyright (c) 2001-2016, Andrew Aksyonoff
Copyright (c) 2008-2016, Sphinx Technologies Inc (http://sphinxsearch.com)
Copyright (c) 2017-2024, Manticore Software LTD (https://manticoresearch.com)
using config file '/Users/sn/manticore/plain.conf'...
indexing table 'idx'...
collected 1 docs, 0.0 MB
creating secondary index
creating lookup: 0.0 Kdocs, 100.0% done
sorted 0.0 Mhits, 100.0% done
total 1 docs, 6 bytes
total 0.029 sec, 203 bytes/sec, 33.96 docs/sec
WARNING: skipping non-plain table 'rt'...
total 3 reads, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg
total 15 writes, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg
rotating tables: successfully sent SIGHUP to searchd (pid=89954).
After reloading the tables:
mysql -P9315 -h0 -e "reload tables"
Now both tables are available:
mysql -P9315 -h0 -e "show tables"
+-------+-------+
| Table | Type |
+-------+-------+
| idx | local |
| rt | rt |
+-------+-------+
Limitations of Plain Mode
In Plain mode, you cannot create tables dynamically:
mysql -P9315 -h0 -e "create table t"
ERROR 1064 (42000) at line 1: CREATE TABLE requires data_dir to be set in the config file
Replication is also not available:
mysql -P9315 -h0 -e "create cluster c"
ERROR 1064 (42000) at line 1: can not create cluster 'c': no 'listen' is found, cannot set incoming addresses, replication is disabled
When to Use Each Mode
Use RT Mode when:
- You need to create or modify tables frequently
- You want to use replication features
- You prefer a more dynamic, flexible environment
- You’re building applications that need to adapt to changing requirements
Use Plain Mode when:
- Your schema is stable and well-defined
- You’re primarily working with external data sources
- You want to ensure schema consistency across deployments
- You need a more controlled, configuration-driven approach
Conclusion
Understanding the difference between RT and Plain modes in Manticore Search is essential for optimizing your search implementation. RT mode offers flexibility and dynamic table management, while Plain mode provides stability and structure.
For most modern applications, RT mode is the recommended choice due to its flexibility and feature set. However, Plain mode still has its place, especially in environments where schema stability and configuration portability are priorities.
Prefer watching over reading? Check out our video on this topic:
Remember, the key to identifying which mode you’re using is simple: if there’s a data_dir
directive in your configuration, you’re in RT mode; if not, you’re in Plain mode.