Using a binary package | Tarantool
Документация на русском языке
поддерживается сообществом
Using a binary package

Using a binary package

For production purposes, we recommend official binary packages. You can choose from two Tarantool versions: 1.9 (stable) or 2.0 (alpha). An automatic build system creates, tests and publishes packages for every push into a corresponding branch (1.9 or 2.0) at Tarantool’s GitHub repository.

To download and install the package that’s appropriate for your OS, start a shell (terminal) and enter the command-line instructions provided for your OS at Tarantool’s download page.

Starting Tarantool

To start a Tarantool instance, say this:

$ # 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

Tarantool starts in the interactive mode and displays a prompt:


Now you can enter requests on the command line.


On production machines, Tarantool’s interactive mode is for system administration only. But we use it for most examples in this manual, because the interactive mode is convenient for learning.

Creating a database

Далее рассказывается, как создать простую тестовую базу данных после установки Tarantool’а.

Create a new directory (it’s just for tests, so you can delete it when the tests are over):

$ mkdir ~/tarantool_sandbox
$ cd ~/tarantool_sandbox

To start Tarantool’s database module and make the instance accept TCP requests on port 3001, say this:

tarantool> box.cfg{listen = 3301}

First, create the first space (named „tester“) and the first index (named „primary“):

tarantool> s ='tester')
tarantool> s:create_index('primary', {
         >  type = 'hash',
         >  parts = {1, 'NUM'}
         > })

Next, insert three tuples (our name for «records») into the space:

tarantool> t = s:insert({1, 'Roxette'})
tarantool> t = s:insert({2, 'Scorpions', 2015})
tarantool> t = s:insert({3, 'Ace of Base', 1993})

To select a tuple from the first space of the database, using the first defined key, say:

tarantool> s:select{3}

The terminal screen now looks like this:

tarantool> s ='tester')
2017-01-17 12:04:18.158 ... creating './00000000000000000000.xlog.inprogress'
tarantool>s:create_index('primary', {type = 'hash', parts = {1, 'NUM'}})
tarantool> t = s:insert{1, 'Roxette'}
tarantool> t = s:insert{2, 'Scorpions', 2015}
tarantool> t = s:insert{3, 'Ace of Base', 1993}
tarantool> s:select{3}
- - [3, 'Ace of Base', 1993]

To add another index on the second field, say:

tarantool> s:create_index('secondary', {
         >  type = 'hash',
         >  parts = {2, 'string'}
         > })

Далее, чтобы подготовиться к тестовому примеру в следующем разделе, введите:

tarantool> box.schema.user.grant('guest', 'read,write,execute', 'universe')

Установка удаленного соединения

In the request box.cfg{listen = 3301} that we made earlier, the listen value can be any form of a URI (uniform resource identifier). In this case, it’s just a local port: port 3301. You can send requests to the listen URI via:

  1. telnet,
  2. a connector,
  3. another instance of Tarantool (using the console module), or
  4. tarantoolctl utility.

Let’s try (4).

Switch to another terminal. On Linux, for example, this means starting another instance of a Bash shell. You can switch to any working directory in the new terminal, not necessarily to ~/tarantool_sandbox.

Start the tarantoolctl utility:

$ tarantoolctl connect '3301'

This means «use tarantoolctl connect to connect to the Tarantool instance that’s listening on localhost:3301».

Введите следующий запрос:


This means «send a request to that Tarantool instance, and display the result». The result in this case is one of the tuples that was inserted earlier. Your terminal screen should now look like this:

$ tarantoolctl connect '3301'
/usr/local/bin/tarantoolctl: connected to localhost:3301
- - [2, 'Scorpions', 2015]


You can repeat{} and{} indefinitely, on either Tarantool instance.

When the testing is over:

  • To drop the space: s:drop() (do this on the terminal where tester was created)
  • To stop tarantoolctl: Ctrl+C or Ctrl+D
  • To stop Tarantool (an alternative): the standard Lua function os.exit()
  • To stop Tarantool (from another terminal): sudo pkill -f tarantool
  • To destroy the test: rm -r ~/tarantool_sandbox
Нашли ответ на свой вопрос?
Обратная связь