| 1 |
.. -*- rst -*- |
| 2 |
|
| 3 |
Sharding |
| 4 |
======== |
| 5 |
|
| 6 |
.. versionadded:: 5.0.0 |
| 7 |
|
| 8 |
Groonga has :doc:`/limitations` against table size. You can't add |
| 9 |
268,435,455 more records in one table. |
| 10 |
|
| 11 |
Groonga supports time based sharding to resolve the limitation. |
| 12 |
|
| 13 |
It works in the same database. It doesn't work with multiple |
| 14 |
databases. It means that this sharding feature isn't for distributing |
| 15 |
large data to multiple hosts. |
| 16 |
|
| 17 |
If you want distributed sharding feature, use `Mroonga |
| 18 |
<http://mroonga.org/>`_ or `PGroonga |
| 19 |
<http://pgroonga.github.io/>`_. You can use sharding feature by MySQL |
| 20 |
or PostgreSQL. You'll be able to use `Droonga <http://droonga.org/>`_ |
| 21 |
for distributed sharding feature soon. |
| 22 |
|
| 23 |
Summary |
| 24 |
------- |
| 25 |
|
| 26 |
Sharding is implemented in ``sharding`` plugin. The plugin is written |
| 27 |
in mruby. You need to enable mruby when you build Groonga. |
| 28 |
|
| 29 |
You can confirm whether your Groonga supports mruby or not by |
| 30 |
``--version`` command line argument of |
| 31 |
:doc:`/reference/executables/groonga`:: |
| 32 |
|
| 33 |
% groonga --version |
| 34 |
groonga 5.0.5 [...,mruby,...] |
| 35 |
|
| 36 |
configure options: <...> |
| 37 |
|
| 38 |
If you find ``mruby``, your Groonga supports mruby. |
| 39 |
|
| 40 |
``sharding`` plugin provides only search commands. They have |
| 41 |
``logical_`` prefix in their command names such as |
| 42 |
:doc:`/reference/commands/logical_select` and |
| 43 |
:doc:`/reference/commands/logical_range_filter`. |
| 44 |
|
| 45 |
``sharding`` plugin doesn't provide schema define commands and data |
| 46 |
load commands yet. You need to use existing commands such as |
| 47 |
:doc:`/reference/commands/table_create`, |
| 48 |
:doc:`/reference/commands/column_create` and |
| 49 |
:doc:`/reference/commands/load`. |
| 50 |
|
| 51 |
``sharding`` plugin requires some rules against table and column. You |
| 52 |
need to follow these rules. They are described later. |
| 53 |
|
| 54 |
.. _sharding-glossary: |
| 55 |
|
| 56 |
Glossary |
| 57 |
-------- |
| 58 |
|
| 59 |
.. list-table:: |
| 60 |
:header-rows: 1 |
| 61 |
|
| 62 |
* - Name |
| 63 |
- Description |
| 64 |
* - Logical table |
| 65 |
- It's a table that consists of shards. It doesn't exist in |
| 66 |
Groonga database. It just exists in our minds. |
| 67 |
* - Logical table name |
| 68 |
- The name of logical table. It's prefix of shard names. For |
| 69 |
example, ``Logs`` is a logical table name and ``Logs_20150814`` |
| 70 |
and ``Logs_20150815`` are shard names. |
| 71 |
* - Shard |
| 72 |
- It's a table that has records in a day or month. One shard has |
| 73 |
only partial records. |
| 74 |
|
| 75 |
Shard name (= table name) must follow |
| 76 |
``${LOGICAL_TABLE_NAME}_${YYYYMMDD}`` format or |
| 77 |
``${LOGICAL_TABLE_NAME}_${YYYYMM}`` |
| 78 |
format. ``${LOGICAL_TABLE_NAME}`` is expanded to logical table |
| 79 |
name. ``${YYYYMMDD}`` is expanded to day. ``${YYYYMM}`` is |
| 80 |
expanded to month. |
| 81 |
|
| 82 |
For example, ``Logs_20150814`` is consists of ``Logs`` logical |
| 83 |
name and ``20150814`` day. |
| 84 |
|
| 85 |
|
| 86 |
.. _sharding-rules: |
| 87 |
|
| 88 |
Rules |
| 89 |
----- |
| 90 |
|
| 91 |
TODO |
| 92 |
|
| 93 |
.. _sharding-commands: |
| 94 |
|
| 95 |
Commands |
| 96 |
-------- |
| 97 |
|
| 98 |
* :doc:`commands/logical_count` |
| 99 |
* :doc:`commands/logical_parameters` |
| 100 |
* :doc:`commands/logical_range_filter` |
| 101 |
* :doc:`commands/logical_select` |
| 102 |
* :doc:`commands/logical_shard_list` |
| 103 |
* :doc:`commands/logical_table_remove` |