diff --git a/doc/sphinx/book/configuration/index.rst b/doc/sphinx/book/configuration/index.rst index 6853b42fb066e4174fb7eba26dfbb697f1786dae..6c0e359cafdc583db8d62375d14ce307d682ed54 100644 --- a/doc/sphinx/book/configuration/index.rst +++ b/doc/sphinx/book/configuration/index.rst @@ -88,7 +88,10 @@ If username:password is omitted, then 'guest' is assumed. Some examples: | username:password@host:port | notguest:sesame@mail.ru:3301 | +-----------------------------+------------------------------+ -In certain circumstances a Unix socket may be used where a URI is required. +In certain circumstances a Unix domain socket may be used +where a URI is expected, for example "unix/:/tmp/unix_domain_socket.sock" or +simply "/tmp/unix_domain_socket.sock". + ===================================================================== Initialization file diff --git a/doc/sphinx/reference/console.rst b/doc/sphinx/reference/console.rst index 8949f15bddcd7446f3153bcce04ae47c5e04c693..ba1344ca5f0546b3e1d7bdc9878782fe94f4b727 100644 --- a/doc/sphinx/reference/console.rst +++ b/doc/sphinx/reference/console.rst @@ -10,64 +10,82 @@ host/port. .. module:: console -.. function:: connect(uri [, options]) +.. function:: connect(uri) - Connect to the server at :ref:`URI`, change the prompt from 'tarantool' to - 'host:port', and act henceforth as a client until the user ends the - session or types ``control-D``. + Connect to the server at :ref:`URI`, change the prompt from ':samp:`tarantool>`' to + ':samp:`{uri}>`', and act henceforth as a client until the user ends the + session or types :code:`control-D`. The console.connect function allows one Tarantool server, in interactive - mode, to access another Tarantool server over a TCP connection. Subsequent + mode, to access another Tarantool server. Subsequent requests will appear to be handled locally, but in reality the requests are being sent to the remote server and the local server is acting as a client. Once connection is successful, the prompt will change and subsequent requests are sent to, and executed on, the remote server. Results are displayed on the local server. To return to local mode, - enter ``control-D``. + enter :code:`control-D`. + + If the Tarantool server at :samp:`uri` requires authentication, the + connection might look something like: + :code:`console.connect('admin:secretpassword@distanthost.com:3301')`. There are no restrictions on the types of requests that can be entered, except those which are due to privilege restrictions -- by default the login to the remote server is done with user name = 'guest'. The remote server could allow for this by granting at least one privilege: - ``box.schema.user.grant('guest','execute','universe')``. + :code:`box.schema.user.grant('guest','execute','universe')`. - :param string uri: - :param table options: The options may be necessary if the Tarantool - server at host:port requires authentication. - In such a case the connection might look - something like: - ``console.connect('netbox:123@127.0.0.1'})`` + :param string uri: the URI of the remote server :return: nil :except: the connection will fail if the target Tarantool server - was not initiated with ``box.cfg{listen=...}``. - - .. code-block:: lua + was not initiated with :code:`box.cfg{listen=...}`. - tarantool> console = require('console') - --- - ... - tarantool> console.connect('198.18.44.44:3301') - --- - ... - 198.18.44.44:3301> -- prompt is telling us that server is remote + | EXAMPLE + | :codenormal:`tarantool>` :codebold:`console = require('console')` + | :codenormal:`---` + | :codenormal:`...` + | :codenormal:`tarantool>` :codebold:`console.connect('198.18.44.44:3301')` + | :codenormal:`---` + | :codenormal:`...` + | :codenormal:`198.18.44.44:3301> -- prompt is telling us that server is remote` -.. function:: listen(URI) +.. function:: listen(uri) - Listen on URI. The primary way of listening for incoming requests - is via the connection-information string, or :ref:`URI`, specified in ``box.cfg{listen=...}``. + Listen on :ref:`URI`. The primary way of listening for incoming requests + is via the connection-information string, or URI, specified in :code:`box.cfg{listen=...}`. The alternative way of listening is via the URI - specified in ``console.listen(...)``. This alternative way is called + specified in :code:`console.listen(...)`. This alternative way is called "administrative" or simply "admin port". The listening is usually over a local host with a Unix socket, specified with host = 'unix/', port = 'path/to/something.sock'. - :param string uri: + :param string uri: the URI of the local server - The "admin" address is the :ref:`URI` to listen on for administrative + The "admin" address is the URI to listen on for administrative connections. It has no default value, so it must be specified if - connections will occur via telnet. It is not used unless assigned a - value. The parameters are expressed with :ref:`URI` = Universal Resource - Identifier format, for example "unix://unix_domain_socket", or as a + connections will occur via telnet. + The parameter is expressed with URI = Universal Resource + Identifier format, for example "/tmpdir/unix_domain_socket.sock", or as a numeric TCP port. Connections are often made with telnet. A typical port value is 3313. + + | EXAMPLE + | :codenormal:`tarantool>` :codebold:`console = require('console')` + | :codenormal:`---` + | :codenormal:`...` + | + | :codenormal:`tarantool>` :codebold:`console.listen('unix/:/tmp/X.sock')` + | :codenormal:`... main/103/console/unix/:/tmp/X I> started` + | :codenormal:`---` + | :codenormal:`- fd: 9` + | |nbsp| |nbsp| :codenormal:`name:` + | |nbsp| |nbsp| |nbsp| |nbsp| :codenormal:`host: unix/` + | |nbsp| |nbsp| |nbsp| |nbsp| :codenormal:`family: AF_UNIX` + | |nbsp| |nbsp| |nbsp| |nbsp| :codenormal:`type: SOCK_STREAM` + | |nbsp| |nbsp| |nbsp| |nbsp| :codenormal:`protocol: 0` + | |nbsp| |nbsp| |nbsp| |nbsp| :codenormal:`port: /tmp/X.sock` + | :codenormal:`...` + + +