blog-post

Manticore खोज में विशेषता: RT बनाम Plain मोड की व्याख्या

क्या आप कभी Manticore खोज में विभिन्न मोड के बारे में उलझन में पाते हैं? आप अकेले नहीं हैं। कई डेवलपर्स Manticore खोज का उपयोग करना शुरू करते समय वास्तविक समय (RT) मोड और Plain मोड के बीच के अंतर को समझने में संघर्ष करते हैं। लेकिन चिंता न करें - यह वास्तव में बहुत सरल है जब आप मूल अवधारणाओं को समझ जाते हैं।

इस गाइड में, हम इन दो परिचालन मोड को स्पष्ट करेंगे और आपको दिखाएंगे कि प्रत्येक का उपयोग कब और कैसे करें।

Manticore खोज मोड को समझना

Manticore खोज में दो मुख्य परिचालन मोड हैं:

  • वास्तविक समय (RT) मोड - डिफ़ॉल्ट मोड जो आपको फ्लाई पर तालिकाएँ बनाने और छोड़ने की अनुमति देता है
  • Plain मोड - स्थिर स्कीमाओं और बाहरी संग्रह स्रोतों से बनाई गई सरल तालिकाओं के साथ काम करता है

आइए प्रत्येक मोड की क्षमताओं और सीमाओं को समझने के लिए गहराई से देखें।

वास्तविक समय (RT) मोड: गतिशील और लचीला

RT मोड Manticore खोज में डिफ़ॉल्ट और सबसे आम उपयोग का मोड है। इसे गतिशील वातावरण के लिए डिज़ाइन किया गया है जहाँ आपको सेवा को पुनः प्रारंभ किए बिना तालिकाएँ बनाने, संशोधित करने या छोड़ने की आवश्यकता होती है।

RT मोड की पहचान कैसे करें

RT मोड का प्रमुख संकेत आपके कॉन्फ़िगरेशन फ़ाइल में data_dir निर्देश की उपस्थिति है। आइए एक सामान्य कॉन्फ़िगरेशन पर नज़र डालते हैं:

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
}

कॉन्फ़िगरेशन में data_dir निर्देश पर ध्यान दें। यह एकल पंक्ति RT मोड को सक्षम बनाती है।

तालिकाएँ फ्लाई पर बनाना

RT मोड के सबसे बड़े लाभों में से एक तालिकाएँ गतिशील रूप से बनाने की क्षमता है:

mysql -P9306 -h0 -v
MySQL मॉनिटर में आपका स्वागत है।  आदेश ; या \g पर समाप्त होते हैं।
आपका MySQL कनेक्शन आईडी 759523 है
सर्वर संस्करण: 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 और/या इसके सहयोगी।

Oracle एक पंजीकृत ट्रेडमार्क है Oracle Corporation और/या इसके
सहयोगियों का। अन्य नाम उनके संबंधित
स्वामियों के ट्रेडमार्क हो सकते हैं।

इतिहास फ़ाइल पढ़ना /Users/sn/.mysql_history
'help;' या '\h' टाइप करें मदद के लिए। वर्तमान इनपुट स्टेटमेंट को स्पष्ट करने के लिए '\c' टाइप करें।

तालिका बनाना इतना सरल है:

mysql> create table t;
Query OK, 0 rows affected (0.00 sec)

और इसे छोड़ना उतना ही आसान है:

mysql> drop table t;
Query OK, 0 rows affected (0.01 sec)

प्रतिकृति समर्थन

RT मोड के लिए एक और शक्तिशाली विशेषता है प्रतिकृति। आप क्लस्टर बना सकते हैं और उनके लिए तालिकाएँ जोड़ सकते हैं:

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 मोड: स्थिर और संरचित

Plain मोड उन वातावरणों के लिए डिज़ाइन किया गया है जहाँ आपकी स्कीमा अपेक्षाकृत स्थिर और पहले से परिभाषित होती है। यह बाहरी डेटा स्रोतों के साथ काम करते समय विशेष रूप से उपयोगी है।

Plain मोड की पहचान कैसे करें

आपकी कॉन्फ़िगरेशन फ़ाइल में data_dir निर्देश की अनुपस्थिति Plain मोड को इंगित करती है। आइए एक Plain मोड कॉन्फ़िगरेशन पर नज़र डालते हैं:

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
}

ध्यान दें कि data_dir निर्देश नहीं है, लेकिन कॉन्फ़िगरेशन फ़ाइल में सीधे तालिका परिभाषाएँ हैं।

Plain मोड उदाहरण को प्रारंभ करना

आइए Plain मोड में Manticore खोज को प्रारंभ करें:

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] उपयोग कर रहा है कॉन्फ़िगरेशन फ़ाइल '/Users/sn/manticore/plain.conf' (344 अक्षर)...
डेमन संस्करण '7.0.0 92c650401@25013002 (columnar 4.0.0 5aa8e43@25012409) (secondary 4.0.0 5aa8e43@25012409) (knn 4.0.0 5aa8e43@25012409)' प्रारंभ हो रहा है...
mysql के लिए सभी इंटरफेस पर सुनना, पोर्ट=9315
'idx' तालिका को प्री-कैश करना
सूचकांक हेडर प्रारूप json नहीं है, इसे बाइनरी के रूप में आज़माएँगे...
चेतावनी: हेडर लोड करने में असमर्थ... त्रुटि idx.sph खोलने में विफल: कोई ऐसा फ़ाइल या निर्देशिका नहीं है
चेतावनी: तालिका 'idx': प्रीअलोकेट: idx.sph खोलने में विफल: कोई ऐसा फ़ाइल या निर्देशिका नहीं है - सेवा नहीं दी जा रही है
'rt' तालिका को प्री-कैश करना
0.004 सेकंड में 1 तालिकाएँ प्री-कैश की गईं

Plain मोड में तालिकाओं के साथ काम करना

जब हम उपलब्ध तालिकाएँ जांचते हैं, तो हम देख सकते हैं कि प्रारंभ में केवल RT तालिका उपलब्ध है:

mysql -P9315 -h0 -e "show tables"
+-------+------+
| तालिका | प्रकार |
+-------+------+
| rt    | rt   |
+-------+------+

सादा तालिका को उपलब्ध कराने के लिए, हमें इसे इंडेक्सर उपकरण का उपयोग करके बनाना होगा:

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.

मैंटीकोर सर्च इंस्टॉल करें

मैंटीकोर सर्च इंस्टॉल करें