@@ -69,18 +69,25 @@ Command options
69
69
URI
70
70
--------------------------------------------------------------------------------
71
71
72
- Some configuration parameters and some functions depend on a URI, or
73
- "Universal Resource Identifier". The URI string format is similar to the
72
+ Some configuration parameters and some functions depend on a URI (Universal Resource Identifier).
73
+ The URI string format is similar to the
74
74
`generic syntax for a URI schema <https://en.wikipedia.org/wiki/List_of_URI_schemes >`_.
75
- So it may contain (in order) a user name
76
- for login, a password, a host name or host IP address, and a port number. Only
77
- the port number is always mandatory. The password is mandatory if the user
78
- name is specified, unless the user name is 'guest'. So, formally, the URI
75
+ It may contain (in order):
76
+
77
+ * user name for login
78
+ * password
79
+ * host name or host IP address
80
+ * port number.
81
+
82
+ Only a port number is always mandatory. A password is mandatory if a user
83
+ name is specified, unless the user name is 'guest'.
84
+
85
+ Formally, the URI
79
86
syntax is ``[host:]port `` or ``[username:password@]host:port ``.
80
- If host is omitted, then ' 0.0.0.0' or ' [::]' is assumed,
81
- meaning respectively any IPv4 address or any IPv6 address,
87
+ If host is omitted, then " 0.0.0.0" or " [::]" is assumed
88
+ meaning respectively any IPv4 address or any IPv6 address
82
89
on the local machine.
83
- If username:password is omitted, then ' guest' is assumed. Some examples:
90
+ If `` username:password `` is omitted, then the " guest" user is assumed. Some examples:
84
91
85
92
.. container :: table
86
93
@@ -97,12 +104,122 @@ If username:password is omitted, then 'guest' is assumed. Some examples:
97
104
| username:password@host:port
| notguest:
[email protected] :3301
|
98
105
+-----------------------------+------------------------------+
99
106
100
- In certain circumstances a Unix domain socket may be used
101
- where a URI is expected, for example "unix/:/tmp/unix_domain_socket.sock" or
107
+ In code, the URI value can be passed as a number (if only a port is specified) or a string:
108
+
109
+ .. code-block :: lua
110
+
111
+ box.cfg { listen = 3301 }
112
+
113
+ box.cfg { listen = "127.0.0.1:3301" }
114
+
115
+ In certain circumstances, a Unix domain socket may be used
116
+ where a URI is expected, for example, "unix/:/tmp/unix_domain_socket.sock" or
102
117
simply "/tmp/unix_domain_socket.sock".
103
118
104
119
A method for parsing URIs is illustrated in :ref: `Module uri <uri-parse >`.
105
120
121
+ .. _index-uri-several :
122
+
123
+ Specifying several URIs
124
+ ~~~~~~~~~~~~~~~~~~~~~~~
125
+
126
+ Starting from version 2.10.0, a user can open several listening iproto sockets on a Tarantool instance
127
+ and, consequently, can specify several URIs in the configuration parameters
128
+ such as :ref: `box.cfg.listen <cfg_basic-listen >` and :ref: `box.cfg.replication <cfg_replication-replication >`.
129
+
130
+ URI values can be set in a number of ways:
131
+
132
+ * As a string with URI values separated by commas.
133
+
134
+ .. code-block :: lua
135
+
136
+ box.cfg { listen = "127.0.0.1:3301, /unix.sock, 3302" }
137
+
138
+ * As a table that contains URIs in the string format.
139
+
140
+ .. code-block :: lua
141
+
142
+ box.cfg { listen = {"127.0.0.1:3301", "/unix.sock", "3302"} }
143
+
144
+ * As an array of tables with the ``uri `` field.
145
+
146
+ .. code-block :: lua
147
+
148
+ box.cfg { listen = {
149
+ {uri = "127.0.0.1:3301"},
150
+ {uri = "/unix.sock"},
151
+ {uri = 3302}
152
+ }
153
+ }
154
+
155
+ * In a combined way---an array that contains URIs in both the string and the table formats.
156
+
157
+ .. code-block :: lua
158
+
159
+ box.cfg { listen = {
160
+ "127.0.0.1:3301",
161
+ { uri = "/unix.sock" },
162
+ { uri = 3302 }
163
+ }
164
+ }
165
+
166
+ Also, starting from version 2.10.0, it is possible to specify additional parameters for URIs.
167
+ You can do this in different ways:
168
+
169
+ * Using the ``? `` delimiter when URIs are specified in a string format.
170
+
171
+ .. code-block :: lua
172
+
173
+ box.cfg { listen = "127.0.0.1:3301?p1=value1&p2=value2, /unix.sock?p3=value3" }
174
+
175
+ * Using the ``params `` table: a URI is passed in a table with additional parameters in the "params" table.
176
+ Parameters in the "params" table overwrite the ones from a URI string ("value2" overwries "value1" for ``p1 `` in the example below).
177
+
178
+ .. code-block :: lua
179
+
180
+ box.cfg { listen = {
181
+ "127.0.0.1:3301?p1=value1",
182
+ params = {p1 = "value2", p2 = "value3"}
183
+ }
184
+ }
185
+
186
+ * Using the ``default_params `` table for specifying default parameter values.
187
+
188
+ In the example below, two URIs are passed in a table.
189
+ The default value for the ``p3 `` parameter is defined in the ``default_params `` table
190
+ and used if this parameter is not specified in URIs.
191
+ Parameters in the ``default_params `` table are applicable to all the URIs passed in a table.
192
+
193
+ .. code-block :: lua
194
+
195
+ box.cfg { listen = {
196
+ "127.0.0.1:3301?p1=value1",
197
+ { uri = "/unix.sock", params = { p2 = "value2" } },
198
+ default_params = { p3 = "value3" }
199
+ }
200
+ }
201
+
202
+ The recommended way for specifying URI with additional parameters is the following:
203
+
204
+ .. code-block :: lua
205
+
206
+ box.cfg { listen = {
207
+ {uri = "127.0.0.1:3301", params = {p1 = "value1"}},
208
+ {uri = "/unix.sock", params = {p2 = "value2"}},
209
+ {uri = 3302, params = {p3 = "value3"}}
210
+ }
211
+ }
212
+
213
+ In case of a single URI, the following syntax also works:
214
+
215
+ .. code-block :: lua
216
+
217
+ box.cfg { listen = {
218
+ uri = "127.0.0.1:3301",
219
+ params = { p1 = "value1", p2 = "value2" }
220
+ }
221
+ }
222
+
106
223
.. _index-init_label :
107
224
108
225
--------------------------------------------------------------------------------
0 commit comments