diff --git a/doc/sphinx/_templates/layout.html b/doc/sphinx/_templates/layout.html index 865b29ed3d14633c3315f32e9fcb6d6a17eaf56d..de498dff756ead256a5491ab37b8d27054b3d400 100644 --- a/doc/sphinx/_templates/layout.html +++ b/doc/sphinx/_templates/layout.html @@ -14,8 +14,6 @@ {% set render_sidebar = true %} {% endif %} -{% set render_sidebar = false %} - {% block content %} {% if render_sidebar %} <section class="b-lightgray_block b-documentation_top b-clearbox p-documentation_in"> diff --git a/doc/sphinx/book/administration.rst b/doc/sphinx/book/administration.rst index b43ba375144fc825774b8501444093df0b4e60f3..08de541aa47ec9faf3382c3239871520f2b22b22 100644 --- a/doc/sphinx/book/administration.rst +++ b/doc/sphinx/book/administration.rst @@ -33,7 +33,7 @@ used this way, ``tarantool`` is a client program as well as a server program. This section shows all legal syntax for the tarantool program, with short notes and examples. Other client programs may have similar options and request syntaxes. Some of the information in this section is duplicated in the -`Configuration Reference`_ chapter. +:doc:`/book/configuration` chapter. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Conventions used in this section @@ -101,6 +101,8 @@ single quotes. Double quotes are legal but single quotes are preferred. Enclosing in double square brackets is good for multi-line strings as described in `Lua documentation`_. +.. _Lua documentation: http://www.lua.org/pil/2.4.html + Example: .. code-block:: lua @@ -116,6 +118,8 @@ Single-byte tokens are: * or , or ( or ). Examples: * , ( ). Tokens must be separated from each other by one or more spaces, except that spaces are not necessary around single-byte tokens or string literals. +.. _setting delimiter: + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Requests ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -141,10 +145,13 @@ To go back to normal mode: ``console.delimiter('')string-literal``. Example: console.delimiter('')! For a condensed Backus-Naur Form [BNF] description of the suggested form of -client requests, see `doc/box-protocol.html`_ and `doc/sql.txt`_. +client requests, see `doc/dev_guide/box-protocol.html`_. + +.. _doc/dev_guide/box-protocol.html: http://tarantool.org/doc/dev_guide/box-protocol.html In *interactive* mode, one types requests and gets results. Typically the -requests are typed in by the user following prompts. Here is an example of an interactive-mode tarantool client session: +requests are typed in by the user following prompts. Here is an example of +an interactive-mode tarantool client session: .. code-block:: bash diff --git a/doc/sphinx/book/app_a_errcodes.rst b/doc/sphinx/book/app_a_errcodes.rst index b1317e4893e4904df509cf6aadfb4cea8a076cd8..e89a7c33ea6171344e1a4bd689bfb93ae6d84596 100644 --- a/doc/sphinx/book/app_a_errcodes.rst +++ b/doc/sphinx/book/app_a_errcodes.rst @@ -12,6 +12,10 @@ All such messages, however, are logged in the error log. Below follow only gener descriptions of some popular codes. A complete list of errors can be found in file `errcode.h`_ in the source tree. +.. _errcode.h: https://github.com/tarantool/tarantool/blob/master/src/box/errcode.h + +.. _ER_MEMORY_ISSUE: + =========================================================== List of error codes =========================================================== @@ -23,7 +27,7 @@ ER_ILLEGAL_PARAMS Illegal parameters. Malformed protocol message. ER_MEMORY_ISSUE - Out of memory: `slab_alloc_arena`_ limit is reached. + Out of memory: :ref:`slab_alloc_arena` limit is reached. ER_WAL_IO Failed to write to disk. May mean: failed to record a change in the diff --git a/doc/sphinx/book/app_b_proctitle.rst b/doc/sphinx/book/app_b_proctitle.rst index b9e0fdaf0221431319dfb4f97549f0f3a7450363..4152d2c146e7cae3c8df85e6e9c3efcfc7568a79 100644 --- a/doc/sphinx/book/app_b_proctitle.rst +++ b/doc/sphinx/book/app_b_proctitle.rst @@ -18,10 +18,10 @@ A Tarantool server process title follows the following naming scheme: * **running** -- ordinary node "ready to accept requests", * **loading** -- ordinary node recovering from old snap and wal files, * **orphan** -- not in a cluster, -* **hot_standby** -- see section `local_hot_standby`_, +* **hot_standby** -- see section :ref:`local_hot_standby`, * **dumper + process-id** -- saving files before exiting, * **spawner** -- controls other processes, -* **replica + URI/status** -- replication node accepting connections on `replication_port`_, +* **replica + URI/status** -- replication node accepting connections on :ref:`replication_port`, * **relay + sockaddr** -- serves a single replication connection, For example: diff --git a/doc/sphinx/book/app_c_lua_tutorial.rst b/doc/sphinx/book/app_c_lua_tutorial.rst index 537f10e6cbfb49aaef2fc8168ca2ddce568c36cc..2a3892bb96e557d4da38eb3bee5ed12892acf617 100644 --- a/doc/sphinx/book/app_c_lua_tutorial.rst +++ b/doc/sphinx/book/app_c_lua_tutorial.rst @@ -27,9 +27,9 @@ learning, type the statements in with the tarantool client while reading along. Configure ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -We are going to use the "tarantool_sandbox" that was created in section `Starting -Tarantool and making your first database`_. So there is a single space, and a -numeric primary key, and a running tarantool server which also serves as a client. +We are going to use the "tarantool_sandbox" that was created in section +:ref:`first database`. So there is a single space, and a numeric primary key, +and a running tarantool server which also serves as a client. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Delimiter @@ -46,6 +46,8 @@ not send to the server until you see an exclamation mark.†From now on it will be possible to use multiple-line statements, but it will be necessary to end all statements with exclamation marks. +.. _declare a delimiter: :ref:`setting delimiter` + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Create a function that returns string ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -335,7 +337,7 @@ a SELECT request. box.space.tester:select{1}! For more about Tarantool insert and replace calls, see Tarantool manual section -`Package `box.space``_. +:mod:`box.space` The screen now looks like this: @@ -528,6 +530,9 @@ string, and the parameter is t[2] which is a reference to a JSON string. There's a bit of hard coding here, we're assuming that the second field in the tuple is where the JSON string was inserted. For example, we're assuming a tuple looks like +.. _index.iterator: :func:`box.space.space-name.index[.index-name]:pairs` +.. _protected call: http://www.lua.org/pil/8.4.html + .. code-block:: json field[1]: 444 @@ -557,7 +562,7 @@ the database is in perfect shape can skip this kind of thing. And the function is complete. Time to test it. Starting with an empty database, defined the same way as the sandbox database that was introduced in -“ `Starting Tarantool and making your first database`_ â€, +“ :ref:`first database` â€, .. code-block:: lua diff --git a/doc/sphinx/book/app_d_plugins.rst b/doc/sphinx/book/app_d_plugins.rst index fc362e02cb56829625a2abebcbc773a5b37a19d5..588fc2e7b37709b8f3cd649e3a55dfc99723aeed 100644 --- a/doc/sphinx/book/app_d_plugins.rst +++ b/doc/sphinx/book/app_d_plugins.rst @@ -23,6 +23,9 @@ DBMS, and Tarantool. It will be necessary to build Tarantool from source, as described in “ `Building from source`_ †+.. _Tarantool Plugin API wiki page: https://github.com/tarantool/tarantool/wiki/Plugin-API +.. _Building from source: :doc:`/dev_guide/building_from_source` + The Tarantool plugins allow for connecting to an SQL server and executing SQL statements the same way that a MySQL or PostgreSQL client does. The SQL statements are visible as Lua methods. Thus Tarantool can serve as a "MySQL Lua diff --git a/doc/sphinx/reference/box/admin.rst b/doc/sphinx/book/box/admin.rst similarity index 92% rename from doc/sphinx/reference/box/admin.rst rename to doc/sphinx/book/box/admin.rst index b95bbd374309a53542c2f85a58700677c70d8fce..75e8e6c59e334e70b4927aeb93066eead5a7f0db 100644 --- a/doc/sphinx/reference/box/admin.rst +++ b/doc/sphinx/book/box/admin.rst @@ -10,7 +10,7 @@ A reference description also follows below: .. function:: box.snapshot() - Take a snapshot of all data and store it in _`snap_dir`/<latest-lsn>.snap. + Take a snapshot of all data and store it in `snap_dir`_/<latest-lsn>.snap. To take a snapshot, Tarantool first enters the delayed garbage collection mode for all data. In this mode, tuples which were allocated before the snapshot has started are not freed until the snapshot has finished. To @@ -23,7 +23,7 @@ A reference description also follows below: saved in a matter of minutes. Note, that as long as there are any changes to the parent index memory through concurrent updates, there are going to be page splits, and therefore one needs to have some extra free memory to run - this command. 10% of _`slab_alloc_arena` is, on average, sufficient. This + this command. 10% of `slab_alloc_arena`_ is, on average, sufficient. This statement waits until a snapshot is taken and returns operation result. .. code-block:: lua @@ -61,3 +61,6 @@ A reference description also follows below: .. function:: require('fiber').info() Show all running fibers, with their stack. Mainly useful for debugging. + +.. _snap_dir: :ref:`snap_dir` +.. _slab_alloc_arena: :ref:`slab_alloc_arena` diff --git a/doc/sphinx/reference/box/atomic.rst b/doc/sphinx/book/box/atomic.rst similarity index 100% rename from doc/sphinx/reference/box/atomic.rst rename to doc/sphinx/book/box/atomic.rst diff --git a/doc/sphinx/reference/box/authentication.rst b/doc/sphinx/book/box/authentication.rst similarity index 100% rename from doc/sphinx/reference/box/authentication.rst rename to doc/sphinx/book/box/authentication.rst diff --git a/doc/sphinx/reference/box/box_error.rst b/doc/sphinx/book/box/box_error.rst similarity index 100% rename from doc/sphinx/reference/box/box_error.rst rename to doc/sphinx/book/box/box_error.rst diff --git a/doc/sphinx/reference/box/box_index.rst b/doc/sphinx/book/box/box_index.rst similarity index 100% rename from doc/sphinx/reference/box/box_index.rst rename to doc/sphinx/book/box/box_index.rst diff --git a/doc/sphinx/reference/box/box_introspection.rst b/doc/sphinx/book/box/box_introspection.rst similarity index 100% rename from doc/sphinx/reference/box/box_introspection.rst rename to doc/sphinx/book/box/box_introspection.rst diff --git a/doc/sphinx/reference/box/box_schema.rst b/doc/sphinx/book/box/box_schema.rst similarity index 100% rename from doc/sphinx/reference/box/box_schema.rst rename to doc/sphinx/book/box/box_schema.rst diff --git a/doc/sphinx/reference/box/box_session.rst b/doc/sphinx/book/box/box_session.rst similarity index 100% rename from doc/sphinx/reference/box/box_session.rst rename to doc/sphinx/book/box/box_session.rst diff --git a/doc/sphinx/reference/box/box_space.rst b/doc/sphinx/book/box/box_space.rst similarity index 100% rename from doc/sphinx/reference/box/box_space.rst rename to doc/sphinx/book/box/box_space.rst diff --git a/doc/sphinx/reference/box/box_tuple.rst b/doc/sphinx/book/box/box_tuple.rst similarity index 100% rename from doc/sphinx/reference/box/box_tuple.rst rename to doc/sphinx/book/box/box_tuple.rst diff --git a/doc/sphinx/reference/box/index.rst b/doc/sphinx/book/box/index.rst similarity index 98% rename from doc/sphinx/reference/box/index.rst rename to doc/sphinx/book/box/index.rst index 8a2d3467c41c219826dcbb699e375793a7d45cf5..86053e213e9d9963fb4e776d51b447e7a212da3c 100644 --- a/doc/sphinx/reference/box/index.rst +++ b/doc/sphinx/book/box/index.rst @@ -1,5 +1,5 @@ ------------------------------------------------------------------------------- - The `box` library + Database ------------------------------------------------------------------------------- As well as executing Lua chunks or defining their own functions, users can exploit @@ -21,7 +21,6 @@ no arguments. The packages inside the box library are: box_index box_session box_error - box_tuple box_introspection net_box admin diff --git a/doc/sphinx/reference/box/limitations.rst b/doc/sphinx/book/box/limitations.rst similarity index 100% rename from doc/sphinx/reference/box/limitations.rst rename to doc/sphinx/book/box/limitations.rst diff --git a/doc/sphinx/reference/box/net_box.rst b/doc/sphinx/book/box/net_box.rst similarity index 100% rename from doc/sphinx/reference/box/net_box.rst rename to doc/sphinx/book/box/net_box.rst diff --git a/doc/sphinx/reference/box/triggers.rst b/doc/sphinx/book/box/triggers.rst similarity index 100% rename from doc/sphinx/reference/box/triggers.rst rename to doc/sphinx/book/box/triggers.rst diff --git a/doc/sphinx/book/configuration.rst b/doc/sphinx/book/configuration.rst index 56f8877de7a9bf093cae2ef2a91f94a0787c956d..711635920557688d6b8c7163530c3eb0f67d7aa2 100644 --- a/doc/sphinx/book/configuration.rst +++ b/doc/sphinx/book/configuration.rst @@ -5,7 +5,8 @@ Configuration reference ------------------------------------------------------------------------------- -This chapter provides a reference of options which can be set on the command line or in an initialization file. +This chapter provides a reference of options which can be set on the command +line or in an initialization file. Tarantool is started by entering the command: @@ -59,6 +60,11 @@ Tarantool is started by entering the command: can be used at any time to check out the corresponding source from our `git repository`_. +.. _git describe: http://www.kernel.org/pub/software/scm/git/docs/git-describe.html +.. _git repository: git://github.com/tarantool/tarantool.git + + + ===================================================================== URI ===================================================================== @@ -74,6 +80,8 @@ syntax is ``[host:]port`` or ``[username:password@]host:port`` or if then 'localhost' is assumed. If username:password is omitted, then 'guest' is assumed. Some examples: +.. _generic syntax for a URI schema: http://en.wikipedia.org/wiki/URI_scheme#Generic_syntax + .. container:: table +-----------------------------+------------------------------+ @@ -131,6 +139,14 @@ Then the screen might look like this: Starting ARG ... main C> entering the event loop +.. _local_hot_standby: +.. _replication_port: +.. _slab_alloc_arena: +.. _replication_source: +.. _snap_dir: +.. _wal_dir: +.. _snapshot daemon: + ===================================================================== Configuration parameters ===================================================================== @@ -167,7 +183,7 @@ for binary logging and snapshots, for replication, for networking, and for loggi | | | | | current directory. If not specified, defaults | | | | | | to the current directory. | +-------------------+-----------+----------+----------+-------------------------------------------------+ - | wal_dir | string | "." | no | A directory where write-ahead log (.xlog) files | + | wal_dir | string | "." | no | A directory where write-ahead log (.xlog) files | | | | | | are stored. Can be relative to work_dir. Most | | | | | | commonly used so that snapshot files and | | | | | | write-ahead log files can be stored on separate | @@ -176,7 +192,7 @@ for binary logging and snapshots, for replication, for networking, and for loggi | snap_dir | string | "." | no | A directory where snapshot (.snap) files will | | | | | | be stored. Can be relative to work_dir. If not | | | | | | specified, defaults to work_dir. See also | - | | | | | `wal_dir`_. | + | | | | | :ref:`wal_dir`. | +-------------------+-----------+----------+----------+-------------------------------------------------+ | sophia_dir | string | "sophia" | no | A directory where sophia files will be stored. | | | | | | Can be relative to work_dir. If not specified, | @@ -201,7 +217,7 @@ for binary logging and snapshots, for replication, for networking, and for loggi | | | | | "tarantool.pid". | +-------------------+-----------+----------+----------+-------------------------------------------------+ | custom_proc_title | string | "null" | no | Inject the given string into | - | | | | | `server process title`_ (what's shown in the | + | | | | | :doc:`app_b_proctitle` (what's shown in the | | | | | | COMMAND column for ps and top commands). | +-------------------+-----------+----------+----------+-------------------------------------------------+ | background | boolean | false | no | Run the server as a background task. The logger | @@ -235,44 +251,44 @@ for binary logging and snapshots, for replication, for networking, and for loggi **Configuring the storage** - +--------------------+-----------+----------+----------+-------------------------------------------------+ - | Name | Type | Default | Dynamic? | Description | - +====================+===========+==========+==========+=================================================+ - | slab_alloc_arena | float | null | no | How much memory Tarantool allocates to actually | - | | | | | store tuples, in gigabytes. When the limit is | - | | | | | reached, INSERT or UPDATE requests begin | - | | | | | failing with error `ER_MEMORY_ISSUE`_. While | - | | | | | the server does not go beyond the defined limit | - | | | | | to allocate tuples, there is additional memory | - | | | | | used to store indexes and connection | - | | | | | information. Depending on actual configuration | - | | | | | and workload, Tarantool can consume up to 20% | - | | | | | more than the limit set here. | - +--------------------+-----------+----------+----------+-------------------------------------------------+ - | slab_alloc_minimal | integer | null | no | Size of the smallest allocation unit. It can be | - | | | | | tuned down if most of the tuples are very small | - +--------------------+-----------+----------+----------+-------------------------------------------------+ - | slab_alloc_factor | float | 2.0 | no | Use slab_alloc_factor as the multiplier for | - | | | | | computing the sizes of memory chunks that | - | | | | | tuples are stored in. A lower value may result | - | | | | | in less wasted memory depending on the total | - | | | | | amount of memory available and the distribution | - | | | | | of item sizes. | - +--------------------+-----------+----------+----------+-------------------------------------------------+ - | sophia | table | (see the | no | The default sophia configuration can be changed | - | | | note) | | with | - | | | | | | - | | | | | .. code-block:: lua | - | | | | | | - | | | | | sophia = { | - | | | | | page_size = number, | - | | | | | threads = number, | - | | | | | node_size = number, | - | | | | | memory_limit = number | - | | | | | } | - | | | | | | - | | | | | This method may change in the future. | - +--------------------+-----------+----------+----------+-------------------------------------------------+ + +--------------------------+-----------+----------+----------+-------------------------------------------------+ + | Name | Type | Default | Dynamic? | Description | + +==========================+===========+==========+==========+=================================================+ + | slab_alloc_arena | float | null | no | How much memory Tarantool allocates to actually | + | | | | | store tuples, in gigabytes. When the limit is | + | | | | | reached, INSERT or UPDATE requests begin | + | | | | | failing with error :ref:`ER_MEMORY_ISSUE`. While| + | | | | | the server does not go beyond the defined limit | + | | | | | to allocate tuples, there is additional memory | + | | | | | used to store indexes and connection | + | | | | | information. Depending on actual configuration | + | | | | | and workload, Tarantool can consume up to 20% | + | | | | | more than the limit set here. | + +--------------------------+-----------+----------+----------+-------------------------------------------------+ + | slab_alloc_minimal | integer | null | no | Size of the smallest allocation unit. It can be | + | | | | | tuned down if most of the tuples are very small | + +--------------------------+-----------+----------+----------+-------------------------------------------------+ + | slab_alloc_factor | float | 2.0 | no | Use slab_alloc_factor as the multiplier for | + | | | | | computing the sizes of memory chunks that | + | | | | | tuples are stored in. A lower value may result | + | | | | | in less wasted memory depending on the total | + | | | | | amount of memory available and the distribution | + | | | | | of item sizes. | + +--------------------------+-----------+----------+----------+-------------------------------------------------+ + | sophia | table | (see the | no | The default sophia configuration can be changed | + | | | note) | | with | + | | | | | | + | | | | | .. code-block:: lua | + | | | | | | + | | | | | sophia = { | + | | | | | page_size = number, | + | | | | | threads = number, | + | | | | | node_size = number, | + | | | | | memory_limit = number | + | | | | | } | + | | | | | | + | | | | | This method may change in the future. | + +--------------------------+-----------+----------+----------+-------------------------------------------------+ **Snapshot daemon** @@ -325,7 +341,7 @@ for binary logging and snapshots, for replication, for networking, and for loggi | | | | | performance by setting a limit on how many | | | | | | megabytes per second it can write to disk. The same | | | | | | can be achieved by splitting `wal_dir`_ and | - | | | | | `snap_dir`_ locations and moving snapshots to a | + | | | | | :ref:`snap_dir` locations and moving snapshots to a | | | | | | separate disk. | +----------------------+-----------+----------+----------+-----------------------------------------------------+ | wal_mode | string | "write" | **yes** | Specify fiber-WAL-disk synchronization mode as: | diff --git a/doc/sphinx/book/connectors/__perl.rst b/doc/sphinx/book/connectors/__perl.rst index 37a2d11ff0284a2f4f6ba7405ac0ac3f4744ccdb..fb5509679b700d9fdb6006ffe6336049e2e11f29 100644 --- a/doc/sphinx/book/connectors/__perl.rst +++ b/doc/sphinx/book/connectors/__perl.rst @@ -55,3 +55,7 @@ will print “Connection refusedâ€. The example program only shows one command and does not show all that's necessary for good practice. For that, please see `DR::Tarantool`_ CPAN repository. + +.. _DR::Tarantool: http://search.cpan.org/~unera/DR-Tarantool/ +.. _CPAN, the Comprehensive Perl Archive Network: https://en.wikipedia.org/wiki/Cpan +.. _described earlier: https://en.wikipedia.org/wiki/Cpan diff --git a/doc/sphinx/book/connectors/__php.rst b/doc/sphinx/book/connectors/__php.rst index cd4f92b0b7ad5858252a20fadeb5d8c6ed2e2342..573f763e8f5f1e8ae8c7927e766fc8a5642a03a3 100644 --- a/doc/sphinx/book/connectors/__php.rst +++ b/doc/sphinx/book/connectors/__php.rst @@ -58,3 +58,6 @@ applications. The example program only shows one command and does not show all that's necessary for good practice. For that, please see `tarantool-php`_ project at GitHub. + +.. _described earlier: https://en.wikipedia.org/wiki/Cpan +.. _tarantool-php: https://github.com/tarantool/tarantool-php diff --git a/doc/sphinx/book/connectors/__python.rst b/doc/sphinx/book/connectors/__python.rst index 34f80a9c23914a439e017aab116d78d3a61e79ba..b39d64cdd2344b9205542592c7721ce01d35799f 100644 --- a/doc/sphinx/book/connectors/__python.rst +++ b/doc/sphinx/book/connectors/__python.rst @@ -28,3 +28,6 @@ The example program only shows one request and does not show all that's necessary for good practice. For that, see http://github.com/tarantool/tarantool-python. For an example of a Python API for `Queue managers on Tarantool`_, see https://github.com/tarantool/tarantool-queue-python. + +.. _described earlier: https://en.wikipedia.org/wiki/Cpan +.. _Queue managers on Tarantool: https://github.com/tarantool/queue diff --git a/doc/sphinx/book/index.rst b/doc/sphinx/book/index.rst index 4613e14c4bcc26c4641486bf95a565a2fb3d0745..41331fb884094a68aab7720fd167e9400964ac37 100644 --- a/doc/sphinx/book/index.rst +++ b/doc/sphinx/book/index.rst @@ -4,9 +4,11 @@ .. toctree:: + intro replication configuration administration + box/index connectors/index app_a_errcodes app_b_proctitle diff --git a/doc/sphinx/book/intro.rst b/doc/sphinx/book/intro.rst new file mode 100644 index 0000000000000000000000000000000000000000..f47029be837e99618ec9f9e40f754f49aed88c35 --- /dev/null +++ b/doc/sphinx/book/intro.rst @@ -0,0 +1,98 @@ +------------------------------------------------------------------------------- + Intro +------------------------------------------------------------------------------- + +=============================================================================== + Tarantool: an overview +=============================================================================== + +Tarantool is a Lua application server integrated with a database management system. +It has a "fiber" model which means that many applications can run simultaneously on +a single thread, while the Tarantool server can run multiple threads for input-output +and background maintenance. It integrates the LuaJIT -- "Just In Time" -- Lua compiler, +Lua libraries for most common applications, and the Tarantool Database Server which +is an established NoSQL DBMS. Thus it serves all the purposes that have made node.js +and Twisted popular in other environments, with the additional twist that it has a +data persistence level. + +The code is free. The open-source license is *`BSD license`_*. The supported platforms +are GNU/Linux, Mac OS and FreeBSD. + +Tarantool's creator and biggest user is `Mail.Ru`_, the largest internet company in +Russia, with 30 million users, 25 million emails per day, and a web site whose +Alexa global rank is in the `top 40`_ worldwide. Tarantool services Mail.Ru's +hottest data, such as the session data of online users, the properties of online +applications, the caches of the underlying data, the distribution and sharding +algorithms, and much more. Outside Mail.Ru the software is used by a growing +number of projects in online gaming, digital marketing, and social media +industries. While product development is sponsored by Mail.Ru, the roadmap, +the bugs database and the development process are fully open. The software +incorporates patches from dozens of community contributors. The Tarantool +community writes and maintains most of the drivers for programming languages. +The greater Lua community has hundreds of useful packages which can become +Tarantool extensions. + +Users can create, modify and drop **Lua functions at runtime**. Or they can +define **Lua programs** that are loaded during startup for triggers, background +tasks, and interacting with networked peers. Unlike popular application +development frameworks based on a "reactor" pattern, networking in server-side +Lua is sequential, yet very efficient, as it is built on top of the +**cooperative multitasking** environment that Tarantool itself uses. A key +feature is that the functions can access and modify databases atomically. +Thus some developers look at it as a DBMS with a popular stored procedure +language, while others look at it as a replacement for multiple components +of multi-tier Web application architectures. Performance is a few thousand +transactions per second on a laptop, scalable upwards or outwards to server +farms. + +**Tarantool is lock-free**. Instead of the operating system's concurrency +primitives, such as mutexes, Tarantool uses cooperative multitasking to handle +thousands of connections simultaneously. There is a fixed number of independent +execution threads. The threads do not share state. Instead they exchange data +using low-overhead message queues. While this approach limits the number of cores +that the server will use, it removes competition for the memory bus and ensures peak +scalability of memory access and network throughput. CPU utilization of a typical +highly-loaded Tarantool server is under 10%. + +Although Tarantool can run without it, the database management component is a strong +distinguishing feature. So here is a closer look at "The Box", or DBMS server. + +Ordinarily the server **keeps all the data in random-access memory**, and therefore +has very low read latency. The server **keeps persistent copies of the data in non-volatile storage**, +such as disk, when users request "snapshots". The server **maintains a write-ahead log +(WAL)** to ensure consistency and crash safety of the persistent copies. The server +**performs inserts and updates atomically** - changes are not considered complete +until the WAL is written. The logging subsystem supports group commit. + +When the rate of data changes is high, the write-ahead log file (or files) can grow +quickly. This uses up disk space, and increases the time necessary to restart the +server (because the server must start with the last snapshot, and then replay the +transactions that are in the log). The solution is to make snapshots frequently. +Therefore the server ensures that **snapshots are quick, resource-savvy, and non-blocking**. +To accomplish this, the server uses delayed garbage collection for data pages and +uses a copy-on-write technique for index pages. This ensures that the snapshot +process has a consistent read view. + +Unlike most NoSQL DBMSs, Tarantool supports **secondary index keys** as well as +primary keys, and **multi-part index keys**. The possible index types are HASH, +TREE, BITSET, and RTREE. + +Tarantool supports **asynchronous replication**, locally or to remote hosts. In +this latest version the replication architecture can be **master-master**, that +is, many nodes may both handle the loads and receive what others have handled, +for the same data sets. + +=============================================================================== + Reporting bugs +=============================================================================== + +Please report bugs in Tarantool at http://github.com/tarantool/tarantool/issues. +You can contact developers directly on the `#tarantool`_ IRC channel on freenode, +or via a mailing list, `Tarantool Google group`_. + +.. _#tarantool: irc://irc.freenode.net#tarantool +.. _Tarantool Google group: https://googlegroups.com/group/tarantool + +.. _BSD license: http://www.gnu.org/licenses/license-list.html#ModifiedBSD +.. _Mail.Ru: http://api.mail.ru +.. _top 40: http://www.alexa.com/siteinfo/mail.ru diff --git a/doc/sphinx/book/replication.rst b/doc/sphinx/book/replication.rst index fbaa7caaba881b9d35240316ecccc56e23241ef5..d93fdc9869f5abec9fff90d1c4c96f70ed687ef3 100644 --- a/doc/sphinx/book/replication.rst +++ b/doc/sphinx/book/replication.rst @@ -2,7 +2,7 @@ .. highlight:: lua ------------------------------------------------------------------------------- - Server administration + Replication ------------------------------------------------------------------------------- Replication allows multiple Tarantool servers to work on copies of the same @@ -381,7 +381,7 @@ On Terminal #1 execute these commands: ~/tarantool/src/tarantool box.cfg{listen=3301} box.space.tester:select({0},{iterator='GE'}) - + Now the screen looks like this (ignoring the repeated messages on terminal #2 saying "failed to connect"): @@ -429,3 +429,9 @@ on either terminal say: cd ~ rm -R ~/tarantool_test_node_1 rm -R ~/tarantool_test_node_2 + +.. _replication_source: :ref:`replication_source` +.. _snap_dir: :ref:`snap_dir` +.. _wal_dir: :ref:`wal_dir` +.. _snapshot daemon: :ref:`snapshot daemon` +.. _uri: :ref:`URI` diff --git a/doc/sphinx/conf.py b/doc/sphinx/conf.py index 12e2ad24194e52cfa573ef6d26df03c6a516b095..714e68649fb3d5be3675b1360b396d45eaf0f68c 100644 --- a/doc/sphinx/conf.py +++ b/doc/sphinx/conf.py @@ -76,7 +76,9 @@ version = '.'.join(release.split('.')[0:2]) # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = ['_build', 'directives.rst', 'book/connectors/__*'] - +exclude_patterns += [ + 'book/replication' +] # The reST default role (used for this markup: `text`) to use for all # documents. #default_role = None diff --git a/doc/sphinx/getting_started.rst b/doc/sphinx/getting_started.rst new file mode 100644 index 0000000000000000000000000000000000000000..9f53e7c621f9cf6d15d007f66d07a0f32d9bf4c8 --- /dev/null +++ b/doc/sphinx/getting_started.rst @@ -0,0 +1,320 @@ +------------------------------------------------------------------------------- + Getting started +------------------------------------------------------------------------------- + + +This chapter shows how to download, how to install, and how to start Tarantool +for the first time. + +For production, if possible, you should download a binary (executable) package. +This will ensure that you have the same build of the same version that the +developers have. That makes analysis easier if later you need to report a problem, +and avoids subtle problems that might happen if you used different tools or +different parameters when building from source. The section about binaries is +“`Downloading and installing a binary package`_â€. + +For development, you will want to download a source package and make the binary +by yourself using a C/C++ compiler and common tools. Although this is a bit harder, +it gives more control. And the source packages include additional files, for example +the Tarantool test suite. The section about source is “`Building from source`_†+ +If the installation has already been done, then you should try it out. So we've +provided some instructions that you can use to make a temporary “sandboxâ€. In a +few minutes you can start the server and type in some database-manipulation +statements. The section about sandbox is “`Starting Tarantool and making your first database`_â€. + +===================================================================== + Downloading and installing a binary package +===================================================================== + +The repositories for the “stable†release are at tarantool.org/dist/stable. +The repositories for the “master†release are at tarantool.org/dist/master. +Since this is the manual for the “master†release, all instructions use +tarantool.org/dist/master. + +An automatic build system creates, tests and publishes packages for every +push into the master branch. Therefore if you looked at +tarantool.org/dist/master you would see that there are source files and +subdirectories for the packages that will be described in this section. + +To download and install the package that's appropriate for your environment, +start a shell (terminal) and enter one of the following sets of command-line +instructions. + +More advice for binary downloads is at http://tarantool.org/download.html. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Debian GNU/Linux +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +There is always an up-to-date Debian repository at +http://tarantool.org/dist/master/debian The repository contains builds for +Debian unstable "Sid", stable "Wheezy", forthcoming "Jessie". Add the +tarantool.org repository to your apt sources list. $release is an environment +variable which will contain the Debian version code e.g. "Wheezy": + +.. code-block:: bash + + wget http://tarantool.org/dist/public.key + sudo apt-key add ./public.key + release=`lsb_release -c -s` + # append two lines to a list of source repositories + echo "deb http://tarantool.org/dist/master/debian/ $release main" | \ + sudo tee -a /etc/apt/sources.list.d/tarantool.list + echo "deb-src http://tarantool.org/dist/master/debian/ $release main" | \ + sudo tee -a /etc/apt/sources.list.d/tarantool.list + # install + sudo apt-get update + sudo apt-get install tarantool + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Ubuntu +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +There is always an up-to-date Ubuntu repository at +http://tarantool.org/dist/master/ubuntu The repository contains builds for +Ubuntu 12.04 "precise", 13.10 "saucy", and 14.04 "trusty". Add the tarantool.org +repository to your apt sources list $release is an environment variable which +will contain the Ubuntu version code e.g. "precise". If you want the version +that comes with Ubuntu, start with the lines that follow the '# install' comment: + +.. code-block:: lua + + cd ~ + wget http://tarantool.org/dist/public.key + sudo apt-key add ./public.key + release=`lsb_release -c -s` + # append two lines to a list of source repositories + echo "deb http://tarantool.org/dist/master/ubuntu/ $release main" | \ + sudo tee -a /etc/apt/sources.list.d/tarantool.list + echo "deb-src http://tarantool.org/dist/master/ubuntu/ $release main" | \ + sudo tee -a /etc/apt/sources.list.d/tarantool.list + # install + sudo apt-get update + sudo apt-get install tarantool + + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CentOS +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +These instructions are applicable for CentOS version 6 or 7, and RHEL version +6 or 7. Pick the CentOS repository which fits your CentOS/RHEL version and +your x86 platform: + +* http://tarantool.org/dist/master/centos/6/os/i386 for version 6, x86-32 +* http://tarantool.org/dist/master/centos/6/os/x86_64 for version 6, x86-64 +* http://tarantool.org/dist/master/centos/7/os/x86_64 for version 7, x86-64 + +Add the following section to your yum repository list +(``/etc/yum.repos.d/tarantool.repo``) (in the following instructions, ``$releasever`` +i.e. CentOS release version must be either 6 or 7 and ``$basearch`` i.e. base +architecture must be either i386 or x86_64): + +.. code-block:: ini + + # [tarantool] + name=CentOS-$releasever - Tarantool + baseurl=http://tarantool.org/dist/master/centos/$releasever/os/$basearch/ + enabled=1 + gpgcheck=0 + +For example, if you have CentOS version 6 and x86-64, you can add the new section thus: + +.. code-block:: bash + + echo "[tarantool]" | \ + sudo tee /etc/yum.repos.d/tarantool.repo + echo "name=CentOS-6 - Tarantool"| sudo tee -a /etc/yum.repos.d/tarantool.repo + echo "baseurl=http://tarantool.org/dist/master/centos/6/os/x86_64/" | \ + sudo tee -a /etc/yum.repos.d/tarantool.repo + echo "enabled=1" | sudo tee -a /etc/yum.repos.d/tarantool.repo + echo "gpgcheck=0" | sudo tee -a /etc/yum.repos.d/tarantool.repo + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Fedora +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +These instructions are applicable for Fedora 19, 20 or rawhide. Pick the Fedora +repository, for example http://tarantool.org/dist/master/fedora/20/x86_64 for +version 20, x86-64. Add the following section to your yum repository list +(``/etc/yum.repos.d/tarantool.repo``) (in the following instructions, +``$releasever`` i.e. Fedora release version must be 19, 20 or rawhide and +``$basearch`` i.e. base architecture must be x86_64): + +.. code-block:: ini + + [tarantool] + name=Fedora-$releasever - Tarantool + baseurl=http://tarantool.org/dist/master/fedora/$releasever$basearch/ + enabled=1 + gpgcheck=0 + +For example, if you have Fedora version 20, you can add the new section thus: + +.. code-block:: bash + + echo "[tarantool]" | \ + sudo tee /etc/yum.repos.d/tarantool.repo + echo "name=Fedora-20 - Tarantool"| sudo tee -a /etc/yum.repos.d/tarantool.repo + echo "baseurl=http://tarantool.org/dist/master/fedora/20/x86_64/" | \ + sudo tee -a /etc/yum.repos.d/tarantool.repo + echo "enabled=1" | sudo tee -a /etc/yum.repos.d/tarantool.repo + echo "gpgcheck=0" | sudo tee -a /etc/yum.repos.d/tarantool.repo + Then install with sudo yum install tarantool. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Gentoo +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +available from tarantool portage overlay. Use layman to add the overlay to your system: + +.. code-block:: bash + + layman -S + layman -a tarantool + emerge dev-db/tarantool -av + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + FreeBSD +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +With your browser go to the FreeBSD ports page +http://www.freebsd.org/ports/index.html. Enter the search term: tarantool. +Choose the package you want. + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Mac OS X +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +This is actually a “homebrew†recipe so it's not a true binary download, +some source code is involved. First upgrade Clang (the C compiler) to version 3.2 +or later using Command Line Tools for Xcode disk image version 4.6+ from Apple +Developer web-site. Then download the recipe file from +build.tarantool.org/tarantool.rb. Make the file executable, execute it, +and the script in the file should handle the necessary steps with cmake, make, +and make install. + +.. _first database: + +===================================================================== + Starting Tarantool and making your first database +===================================================================== + +Here is how to create a simple test database after installing. + +1. Create a new directory. It's just for tests, you can delete it when + the tests are over. + + .. code-block:: bash + + mkdir ~/tarantool_sandbox + cd ~/tarantool_sandbox + +2. Start the server. The server name is tarantool. + + .. code-block:: bash + + #if you downloaded a binary with apt-get or yum, say this: + /usr/bin/tarantool + #if you downloaded and untarred a binary tarball to ~/tarantool, say this: + ~/tarantool/bin/tarantool + #if you built from a source download, say this: + ~/tarantool/src/tarantool + + The server starts in interactive mode and outputs a command prompt. + To turn on the database, `configure`_ it: + + .. code-block:: lua + + tarantool> box.cfg{listen=3301} + + (this minimal example is sufficient). + + If all goes well, you will see the server displaying progress as it + initializes, something like this: + + .. code-block:: bash + + tarantool> box.cfg{listen=3301} + 2014-08-07 09:41:41.077 ... version 1.6.3-439-g7e1011b + 2014-08-07 09:41:41.077 ... log level 5 + 2014-08-07 09:41:41.078 ... mapping 1073741824 bytes for a shared arena... + 2014-08-07 09:41:41.079 ... initialized + 2014-08-07 09:41:41.081 ... initializing an empty data directory + 2014-08-07 09:41:41.095 ... creating './00000000000000000000.snap.inprogress' + 2014-08-07 09:41:41.095 ... saving snapshot './00000000000000000000.snap.inprogress' + 2014-08-07 09:41:41.127 ... done + 2014-08-07 09:41:41.128 ... primary: bound to 0.0.0.0:3301 + 2014-08-07 09:41:41.128 ... ready to accept requests + + Now that the server is up, you could start up a different shell + and connect to its primary port with + + .. code-block:: bash + + telnet 0 3301 + + but for example purposes it is simpler to just leave the server + running in "interactive mode". On production machines the + interactive mode is just for administrators, but because it's + convenient for learning it will be used for most examples in + this manual. Tarantool is waiting for the user to type instructions. + + To create the first space and the first index_, try this: + + .. code-block:: lua + + tarantool> s = box.schema.space.create('tester') + tarantool> i = s:create_index('primary', {type = 'hash', parts = {1, 'NUM'}}) + + To insert three “tuples†(our name for “recordsâ€) into the first “space†of the database try this: + + .. code-block:: lua + + tarantool> t = s:insert({1}) + tarantool> t = s:insert({2, 'Music'}) + tarantool> t = s:insert({3, 'Length', 93}) + + To select a tuple from the first space of the database, using the first defined key, try this: + + .. code-block:: lua + + tarantool> s:select{3} + + Your terminal screen should now look like this: + + .. code-block:: lua + + tarantool> s = box.schema.space.create('tester') + 2014-06-10 12:04:18.158 ... creating './00000000000000000002.xlog.inprogress' + --- + ... + tarantool> s:create_index('primary', {type = 'hash', parts = {1, 'NUM'}}) + --- + ... + tarantool> t = s:insert{1} + --- + ... + tarantool> t = s:insert{2, 'Music'} + --- + ... + tarantool> t = s:insert{3, 'Length', 93} + --- + ... + tarantool> s:select{3} + --- + - - [3, 'Length', 93] + ... + + tarantool> + + Now, to prepare for the example in the next section, try this: + + .. code-block:: lua + + tarantool> box.schema.user.grant('guest','read,write,execute','universe') + +.. _Building from source: :dev:`/dev_guide/building_from_source` +.. _configure: :mod:`box.cfg` +.. _index: :mod:`box.index` diff --git a/doc/sphinx/index.rst b/doc/sphinx/index.rst index 925ad12f5758d85e54b150fc30f1df345ec76648..3dbc4af596728777031324e8cfa25678a4c7666b 100644 --- a/doc/sphinx/index.rst +++ b/doc/sphinx/index.rst @@ -2,24 +2,12 @@ Documentation ------------------------------------------------------------------------------- - .. toctree:: :maxdepth: 1 intro.rst faq.rst - -.. raw:: html - - <div class="toctree-wrapper compound"> - <ul> - <li class="toctree-l1"><a href="/doc/user_guide/">User Guide</a></li> - </ul> - </div> - -.. toctree:: - :maxdepth: 1 - + getting_started reference/index.rst book/index.rst dev_guide/index.rst diff --git a/doc/sphinx/reference/index.rst b/doc/sphinx/reference/index.rst index 5b7fa521194b04e96a39e4a392e89737b57c8519..b9a3b9f823dd46aab4b18ec4f4b8048eaae12bd4 100644 --- a/doc/sphinx/reference/index.rst +++ b/doc/sphinx/reference/index.rst @@ -27,4 +27,3 @@ Lua functions can run in the background and perform administrative tasks. pickle other expirationd - box/index diff --git a/doc/www/content/newsite/download.yml.in b/doc/www/content/newsite/download.yml.in index c18c830e31f1e40639905553015ca6b320df59f2..19163858de2f79a6339d778c0495c970a534efec 100644 --- a/doc/www/content/newsite/download.yml.in +++ b/doc/www/content/newsite/download.yml.in @@ -69,7 +69,7 @@ blocks : .. code-block:: bash - $ brew install https://raw.githubusercontent.com/tarantool/tarantool/master/extra/tarantool.rb --devel + $ brew install http://build.tarantool.org/tarantool.rb --devel Please upgrade ``clang`` to version 3.2 or later using ``Command Line Tools for Xcode`` disk image version 4.6+