From fd9b0db4d2401685fb66bd786a93650d51f45e44 Mon Sep 17 00:00:00 2001 From: bigbes <bigbes@gmail.com> Date: Wed, 18 Mar 2015 22:17:34 +0300 Subject: [PATCH] Add other site pages --- doc/sphinx/_templates/layout.html | 2 - doc/sphinx/book/administration.rst | 13 +- doc/sphinx/book/app_a_errcodes.rst | 6 +- doc/sphinx/book/app_b_proctitle.rst | 4 +- doc/sphinx/book/app_c_lua_tutorial.rst | 15 +- doc/sphinx/book/app_d_plugins.rst | 3 + doc/sphinx/{reference => book}/box/admin.rst | 7 +- doc/sphinx/{reference => book}/box/atomic.rst | 0 .../box/authentication.rst | 0 .../{reference => book}/box/box_error.rst | 0 .../{reference => book}/box/box_index.rst | 0 .../box/box_introspection.rst | 0 .../{reference => book}/box/box_schema.rst | 0 .../{reference => book}/box/box_session.rst | 0 .../{reference => book}/box/box_space.rst | 0 .../{reference => book}/box/box_tuple.rst | 0 doc/sphinx/{reference => book}/box/index.rst | 3 +- .../{reference => book}/box/limitations.rst | 0 .../{reference => book}/box/net_box.rst | 0 .../{reference => book}/box/triggers.rst | 0 doc/sphinx/book/configuration.rst | 102 +++--- doc/sphinx/book/connectors/__perl.rst | 4 + doc/sphinx/book/connectors/__php.rst | 3 + doc/sphinx/book/connectors/__python.rst | 3 + doc/sphinx/book/index.rst | 2 + doc/sphinx/book/intro.rst | 98 ++++++ doc/sphinx/book/replication.rst | 10 +- doc/sphinx/conf.py | 4 +- doc/sphinx/getting_started.rst | 320 ++++++++++++++++++ doc/sphinx/index.rst | 14 +- doc/sphinx/reference/index.rst | 1 - doc/www/content/newsite/download.yml.in | 2 +- 32 files changed, 538 insertions(+), 78 deletions(-) rename doc/sphinx/{reference => book}/box/admin.rst (92%) rename doc/sphinx/{reference => book}/box/atomic.rst (100%) rename doc/sphinx/{reference => book}/box/authentication.rst (100%) rename doc/sphinx/{reference => book}/box/box_error.rst (100%) rename doc/sphinx/{reference => book}/box/box_index.rst (100%) rename doc/sphinx/{reference => book}/box/box_introspection.rst (100%) rename doc/sphinx/{reference => book}/box/box_schema.rst (100%) rename doc/sphinx/{reference => book}/box/box_session.rst (100%) rename doc/sphinx/{reference => book}/box/box_space.rst (100%) rename doc/sphinx/{reference => book}/box/box_tuple.rst (100%) rename doc/sphinx/{reference => book}/box/index.rst (98%) rename doc/sphinx/{reference => book}/box/limitations.rst (100%) rename doc/sphinx/{reference => book}/box/net_box.rst (100%) rename doc/sphinx/{reference => book}/box/triggers.rst (100%) create mode 100644 doc/sphinx/book/intro.rst create mode 100644 doc/sphinx/getting_started.rst diff --git a/doc/sphinx/_templates/layout.html b/doc/sphinx/_templates/layout.html index 865b29ed3d..de498dff75 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 b43ba37514..08de541aa4 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 b1317e4893..e89a7c33ea 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 b9e0fdaf02..4152d2c146 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 537f10e6cb..2a3892bb96 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 fc362e02cb..588fc2e7b3 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 b95bbd3743..75e8e6c59e 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 8a2d3467c4..86053e213e 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 56f8877de7..7116359205 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 37a2d11ff0..fb5509679b 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 cd4f92b0b7..573f763e8f 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 34f80a9c23..b39d64cdd2 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 4613e14c4b..41331fb884 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 0000000000..f47029be83 --- /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 fbaa7caaba..d93fdc9869 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 12e2ad2419..714e68649f 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 0000000000..9f53e7c621 --- /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 925ad12f57..3dbc4af596 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 5b7fa52119..b9a3b9f823 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 c18c830e31..19163858de 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+ -- GitLab