Skip to content

Commit 40a7080

Browse files
committed
Update files after the review
1 parent 26bc190 commit 40a7080

File tree

3 files changed

+51
-58
lines changed

3 files changed

+51
-58
lines changed

doc/code_snippets/snippets/config/instances.enabled/mysql/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
app:
2-
file: 'example.lua'
2+
file: 'myapp.lua'
33

44
groups:
55
group001:

doc/code_snippets/snippets/config/instances.enabled/mysql/example.lua renamed to doc/code_snippets/snippets/config/instances.enabled/mysql/myapp.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
-- example.lua --
1+
-- myapp.lua --
22

33
box.schema.user.grant('guest', 'read,write,execute', 'universe')
44

doc/how-to/sql/improving_mysql.rst

Lines changed: 49 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ The tutorial requires that ``systemd`` and MySQL are installed.
2424
Setting up MySQL
2525
----------------
2626

27+
In this section, you configure MySQL and create a database.
28+
2729
#. First, install the necessary packages in CentOS:
2830

2931
.. code-block:: console
@@ -72,7 +74,7 @@ Setting up MySQL
7274
$ cp replicatord /usr/local/sbin/replicatord
7375
$ cp replicatord.service /etc/systemd/system
7476
75-
#. After that, enter the MySQL console and create a sample database (depending on
77+
#. Enter MySQL console and create a sample database (depending on
7678
your existing installation, you may be a user other than root):
7779

7880
.. code-block:: sql
@@ -95,12 +97,12 @@ Setting up MySQL
9597
mysql menagerie -u root -p < ins_puff_rec.sql
9698
mysql menagerie -u root -p < cr_event_tbl.sql
9799
98-
#. Enter the MySQL console and massage the data for use with the
100+
#. Enter MySQL console and massage the data for use with the
99101
Tarantool replicator. On this step, you:
100102

101-
* add an ID,
103+
* add an ID
102104
* change a field name to avoid conflict
103-
* cut down the number of fields.
105+
* cut down the number of fields
104106

105107
With real data, this is the step that involves the most tweaking.
106108

@@ -113,7 +115,7 @@ Setting up MySQL
113115
ALTER TABLE pet DROP sex, DROP birth, DROP death;
114116
QUIT
115117
116-
#. The sample data is set up. Edit MySQL’s
118+
#. The sample data is set up. Edit MySQL
117119
configuration file to use it with the replicator:
118120

119121
.. code-block:: console
@@ -139,7 +141,7 @@ Setting up MySQL
139141
[client]
140142
socket = /var/lib/mysql/mysql.sock
141143
142-
#. After exiting nano, restart mysqld:
144+
#. After exiting ``nano``, restart ``mysqld``:
143145

144146
.. code-block:: console
145147
@@ -150,67 +152,57 @@ Setting up MySQL
150152
Installing and configuring Tarantool
151153
------------------------------------
152154

153-
Let’s install Tarantool and set up spaces for replication.
155+
In this section, you install Tarantool and set up spaces for replication.
154156

155157
#. Go to the `Download page <https://www.tarantool.io/en/download/os-installation/rhel-centos/>`_ and
156158
follow the installation instructions.
157159

158160
#. Install the :ref:`tt CLI <tt-installation>` utility.
159161

160-
#. Create a tt environment in the current directory using the :ref:`tt init <tt-init>` command.
161-
162-
#. Edit the Lua example, which comes with Tarantool:
162+
#. Create a new tt environment in the current directory using the :ref:`tt init <tt-init>` command.
163163

164-
.. code-block:: console
165-
166-
$ cd
167-
$ nano /etc/tarantool/instances.available/example.lua
164+
#. In the ``/etc/tarantool/instances.available/mysql`` directory, create the ``tt`` instance configuration files:
168165

169-
#. Replace the entire contents of the file with the following:
166+
* ``config.yaml`` -- specifies the following configuration
170167

171-
.. literalinclude:: /code_snippets/snippets/config/instances.enabled/mysql/example.lua
172-
:language: lua
173-
:lines: 3-17
174-
:dedent:
168+
.. literalinclude:: /code_snippets/snippets/config/instances.enabled/mysql/config.yaml
169+
:language: yaml
170+
:dedent:
175171

176-
To understand more of what’s happening here, have a look at the earlier
177-
`articles <https://dzone.com/articles/tarantool-101-10-steps-for-absolute-beginners-the>`_
178-
in the Tarantool 101 series or see the :ref:`getting-started <getting_started_db>` guide.
172+
* ``instances.yml`` -- specifies instances to run in the current environment
179173

180-
#. In ``/etc/tarantool``, create a symlink from ``instances.available`` to a directory named
181-
``instances.enabled`` (similar to NGINX):
174+
.. literalinclude:: /code_snippets/snippets/config/instances.enabled/mysql/instances.yml
175+
:language: yaml
176+
:dedent:
182177

183-
.. code-block:: console
178+
* ``myapp.lua`` -- contains a Lua script with an application to load
184179

185-
$ mkdir instances.enabled
186-
$ ln -s /instances.available/example.lua instances.enabled
180+
.. literalinclude:: /code_snippets/snippets/config/instances.enabled/mysql/myapp.lua
181+
:language: lua
182+
:lines: 3-17
183+
:dedent:
187184

188-
#. After that, specify the following configuration in the ``config.yaml`` file and place the file into
189-
the ``instances.enabled`` directory:
185+
For details, see the :ref:`Configuration <configuration>` section.
190186

191-
.. literalinclude:: /code_snippets/snippets/config/instances.enabled/mysql/config.yaml
192-
:language: yaml
193-
:dedent:
187+
#. Inside the ``instances.enabled`` directory of the created tt environment, create a symlink (``mysql``)
188+
to the directory from the previous step:
194189

195-
#. Specify instances to run in the current environment in the ``instances.yml`` file and place the file into
196-
the same directory:
190+
.. code-block:: console
197191
198-
.. literalinclude:: /code_snippets/snippets/config/instances.enabled/mysql/instances.yml
199-
:language: yaml
200-
:dedent:
192+
$ ln -s /etc/tarantool/instances.available/mysql mysql
201193
202194
#. Next, start up the Lua program with ``tt``, the Tarantool command-line
203195
utility:
204196

205197
.. code-block:: console
206198
207-
$ tt start example
199+
$ tt start mysql
208200
209-
#. Enter Tarantool instance:
201+
#. Enter the Tarantool instance:
210202

211203
.. code-block:: console
212204
213-
$ tt connect example
205+
$ tt connect mysql:instance001
214206
215207
#. Check that the target spaces were successfully created:
216208

@@ -276,34 +268,35 @@ MySQL and Tarantool are now set up. You can proceed to configure the replicator.
276268
277269
#. Enter the Tarantool instance:
278270

279-
.. code-block:: bash
271+
.. code-block:: console
280272
281-
$ tt connect example
273+
$ tt connect mysql:instance001
282274
283275
#. Do a select on the ``mysqldata`` space. The replicated content from MySQL looks the following way:
284276

285277
.. code-block:: tarantoolsession
286278
287-
tarantool> box.space.mysqldata:select()
279+
mysql> box.space.mysqldata:select()
288280
---
289281
- - [1, 'Fluffy', 'Harold', 'cat']
290-
- [2, 'Claws', 'Gwen', 'cat']
291-
- [3, 'Buffy', 'Harold', 'dog']
292-
- [4, 'Fang', 'Benny', 'dog']
293-
- [5, 'Bowser', 'Diane', 'dog']
294-
- [6, 'Chirpy', 'Gwen', 'bird']
295-
- [7, 'Whistler', 'Gwen', 'bird']
296-
- [8, 'Slim', 'Benny', 'snake']
297-
- [9, 'Puffball', 'Diane', 'hamster']
282+
- [2, 'Claws', 'Gwen', 'cat']
283+
- [3, 'Buffy', 'Harold', 'dog']
284+
- [4, 'Fang', 'Benny', 'dog']
285+
- [5, 'Bowser', 'Diane', 'dog']
286+
- [6, 'Chirpy', 'Gwen', 'bird']
287+
- [7, 'Whistler', 'Gwen', 'bird']
288+
- [8, 'Slim', 'Benny', 'snake']
289+
- [9, 'Puffball', 'Diane', 'hamster']
298290
299291
.. _improving_mysql-replicator:
300292

301293
Testing the replication
302294
-----------------------
303295

304-
Finally, let’s enter a record into MySQL and then go back to Tarantool to make sure it’s replicated.
296+
In this section, you enter a record into MySQL and check that the record is replicated to Tarantool.
297+
To do this:
305298

306-
#. Exit the Tarantool instance with ``CTRL-C``.
299+
#. Exit the Tarantool instance with ``CTRL-D``.
307300

308301
#. Insert a record into MySQL:
309302

@@ -318,10 +311,10 @@ Finally, let’s enter a record into MySQL and then go back to Tarantool to make
318311

319312
.. code-block:: bash
320313
321-
$ tt connect example
314+
$ tt connect mysql
322315
323-
# To see the replicated data in Tarantool, run the following command:
316+
#. To see the replicated data in Tarantool, run the following command:
324317

325318
.. code-block:: tarantoolsession
326319
327-
tarantool> box.space.mysqldata:select()
320+
mysql> box.space.mysqldata:select()

0 commit comments

Comments
 (0)