|
1 |
| -.. _admin-upgrades: |
| 1 | +.. _admin-upgrades: |
2 | 2 |
|
3 |
| -================================================================================ |
4 | 3 | Upgrades
|
5 |
| -================================================================================ |
| 4 | +======== |
6 | 5 |
|
7 | 6 | For information about backwards compatibility,
|
8 | 7 | see the :ref:`compatibility guarantees <compatibility_guarantees>` description.
|
9 | 8 |
|
10 |
| -.. _admin-upgrades_db: |
| 9 | +.. _admin-upgrades_instance: |
11 | 10 |
|
12 |
| --------------------------------------------------------------------------------- |
13 |
| -Upgrading a Tarantool database |
14 |
| --------------------------------------------------------------------------------- |
| 11 | +Upgrading Tarantool on a standalone instance |
| 12 | +-------------------------------------------- |
15 | 13 |
|
16 |
| -If you created a database with an older Tarantool version and have now installed |
17 |
| -a newer version, make the request ``box.schema.upgrade()``. This updates |
18 |
| -Tarantool system spaces to match the currently installed version of Tarantool. |
19 |
| - |
20 |
| -For example, here is what happens when you run ``box.schema.upgrade()`` with a |
21 |
| -database created with Tarantool version 1.6.4 to version 1.7.2 (only a small |
22 |
| -part of the output is shown): |
23 |
| - |
24 |
| -.. code-block:: tarantoolsession |
25 |
| -
|
26 |
| - tarantool> box.schema.upgrade() |
27 |
| - alter index primary on _space set options to {"unique":true}, parts to [[0,"unsigned"]] |
28 |
| - alter space _schema set options to {} |
29 |
| - create view _vindex... |
30 |
| - grant read access to 'public' role for _vindex view |
31 |
| - set schema version to 1.7.0 |
32 |
| - --- |
33 |
| - ... |
34 |
| -
|
35 |
| -.. _admin-upgrades_instance: |
36 |
| - |
37 |
| --------------------------------------------------------------------------------- |
38 |
| -Upgrading a Tarantool instance |
39 |
| --------------------------------------------------------------------------------- |
40 |
| - |
41 |
| -Tarantool is backward compatible between two adjacent versions. For example, you |
42 |
| -should have no or little trouble when upgrading from Tarantool 1.6 to 1.7, or |
43 |
| -from Tarantool 1.7 to 2.x. Meanwhile Tarantool 2.x may have incompatible changes |
44 |
| -when migrating from Tarantool 1.6. to 2.x directly. |
45 |
| - |
46 |
| -.. _admin-upgrades_instance_17_to_20: |
47 |
| - |
48 |
| -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
49 |
| -How to upgrade from Tarantool 1.7 to 2.x |
50 |
| -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
51 |
| - |
52 |
| -1. Stop the Tarantool server. |
53 |
| - |
54 |
| -2. Make a copy of all data (see an appropriate hot backup procedure in |
55 |
| - :ref:`Backups <admin-backups>`) and the package from which the current (old) |
56 |
| - version was installed (for rollback purposes). |
57 |
| - |
58 |
| -3. Update the Tarantool server. See installation instructions at Tarantool |
59 |
| - `download page <http://tarantool.org/download.html>`_. |
| 14 | +This procedure is for upgrading a standalone Tarantool instance in production. |
| 15 | +Notice that this will **always imply a downtime**. |
| 16 | +To upgrade **without downtime**, you need several Tarantool servers running in a |
| 17 | +replication cluster (see :ref:`below <admin-upgrades_replication_cluster>`). |
60 | 18 |
|
61 |
| -4. Launch the updated Tarantool server using ``tarantoolctl`` or ``systemctl``. |
| 19 | +#. Stop the Tarantool server. |
62 | 20 |
|
63 |
| -.. _admin-upgrades_instance_16_to_20: |
| 21 | +#. Make a copy of all data (see an appropriate hot backup procedure in |
| 22 | + :ref:`Backups <admin-backups>`) and the package from which the current (old) |
| 23 | + version was installed (for rollback purposes). |
64 | 24 |
|
65 |
| -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
66 |
| -How to upgrade from Tarantool 1.6 to 2.x |
67 |
| -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 25 | +#. Update the Tarantool server. See installation instructions at Tarantool |
| 26 | + `download page <http://tarantool.org/download.html>`_. |
68 | 27 |
|
69 |
| -The procedure is fully analogous to |
70 |
| -:ref:`upgrading from 1.7 to 2.x <admin-upgrades_instance_17_to_20>`. |
| 28 | +#. Run :ref:`box.schema.upgrade() <box_schema-upgrade>` on the new master. |
| 29 | + This will update the Tarantool system spaces to match the currently installed version of Tarantool. |
| 30 | + There is no need to run ``box.schema.upgrade()`` on every node: |
| 31 | + changes are propagated to other nodes via the regular replication mechanism. |
71 | 32 |
|
72 |
| -.. _admin-upgrades_instance_16_to_17: |
| 33 | +#. Update your application files, if needed. |
73 | 34 |
|
74 |
| -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
75 |
| -How to upgrade from Tarantool 1.6 to 1.7 |
76 |
| -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 35 | +#. Launch the updated Tarantool server using ``tarantoolctl``, ``tt``, or ``systemctl``. |
77 | 36 |
|
78 |
| -This procedure is for upgrading a standalone Tarantool instance in production |
79 |
| -from 1.6.x to 1.7.x. Notice that this will **always imply a downtime**. |
80 |
| -To upgrade **without downtime**, you need several Tarantool servers running in a |
81 |
| -replication cluster (see :ref:`below <admin-upgrades_replication_cluster>`). |
| 37 | +.. _admin-upgrades_replication_cluster: |
82 | 38 |
|
83 |
| -Tarantool 1.7 has an incompatible :ref:`.snap <internals-snapshot>` and |
84 |
| -:ref:`.xlog <internals-wal>` file format: 1.6 files are |
85 |
| -supported during upgrade, but you won’t be able to return to 1.6 after running |
86 |
| -under 1.7 for a while. It also renames a few configuration parameters, but old |
87 |
| -parameters are supported. The full list of breaking changes is available in |
88 |
| -`release notes for Tarantool 1.7 <https://github.com/tarantool/tarantool/releases>`_. |
| 39 | +Upgrading Tarantool in a replica set with no downtime |
| 40 | +----------------------------------------------------- |
89 | 41 |
|
90 |
| -1. Check with application developers whether application files need to be |
91 |
| - updated due to incompatible changes (see |
92 |
| - `1.7 release notes <https://github.com/tarantool/tarantool/releases>`_). |
93 |
| - If yes, back up the old application files. |
| 42 | +Below are the general instructions for upgrading Tarantool in a replica set. |
| 43 | +Upgrading from some versions can involve certain specifics. You can find |
| 44 | +instructions for individual versions :ref:`in the list below <admin-upgrades_version_specifics>`. |
94 | 45 |
|
95 |
| -2. Stop the Tarantool server. |
| 46 | +.. important:: |
96 | 47 |
|
97 |
| -3. Make a copy of all data (see an appropriate hot backup procedure in |
98 |
| - :ref:`Backups <admin-backups>`) and the package from which the current (old) |
99 |
| - version was installed (for rollback purposes). |
| 48 | + The only way to upgrade Tarantool from version 1.6, 1.7, or 1.9 to 2.x **without downtime** is |
| 49 | + taking an intermediate step by upgrading to 1.10 and then to 2.x. |
100 | 50 |
|
101 |
| -4. Update the Tarantool server. See installation instructions at Tarantool |
102 |
| - `download page <http://tarantool.org/download.html>`_. |
| 51 | + Before upgrading Tarantool from 1.6 to 2.x, please read about the associated |
| 52 | + :ref:`caveats <admin-upgrades-1.6-1.10>`. |
103 | 53 |
|
104 |
| -5. Update the Tarantool database. Put the request ``box.schema.upgrade()`` |
105 |
| - inside a :doc:`box.once() </reference/reference_lua/box_once>` function in your Tarantool |
106 |
| - :ref:`initialization file <index-init_label>`. |
107 |
| - On startup, this will create new system spaces, update data type names (e.g. |
108 |
| - num -> unsigned, str -> string) and options in Tarantool system spaces. |
| 54 | +Preparations |
| 55 | +~~~~~~~~~~~~ |
109 | 56 |
|
110 |
| -6. Update application files, if needed. |
| 57 | +#. Check the replica set health by running the following code on every instance: |
111 | 58 |
|
112 |
| -7. Launch the updated Tarantool server using ``tarantoolctl`` or ``systemctl``. |
| 59 | + .. code-block:: tarantoolsession |
113 | 60 |
|
114 |
| -.. _admin-upgrades_replication_cluster: |
| 61 | + box.info.ro -- "false" at least on one instance |
| 62 | + box.info.status -- should be "running" |
| 63 | + |
| 64 | + If all instances have ``box.info.ro = true``, this means there are no writable nodes. |
| 65 | + If you're running Tarantool :doc:`v. 2.10.0 </release/2.10.0>` or later, |
| 66 | + you can find out the reason by running ``box.info.ro_reason``. |
| 67 | + If it has the value ``orphan``, the instance doesn't see the rest of the replica set. |
| 68 | + Similarly, if ``box.info.status`` has the value ``orphan``, the instance doesn't see the rest of the replica set. |
| 69 | + First resolve the replication issues and only then continue. |
115 | 70 |
|
116 |
| --------------------------------------------------------------------------------- |
117 |
| -Upgrading Tarantool in a replication cluster |
118 |
| --------------------------------------------------------------------------------- |
| 71 | + If you're running Cartridge, you can also check node health in the UI. |
119 | 72 |
|
120 |
| -Tarantool 1.7 can work as a :ref:`replica <replication-architecture>` |
121 |
| -for Tarantool 1.6 and vice versa. Replicas |
122 |
| -perform capability negotiation on handshake, and new 1.7 replication features |
123 |
| -are not used with 1.6 replicas. This allows upgrading clustered configurations. |
| 73 | +#. Make sure each replica is connected to the rest of the replica set. |
| 74 | + To do this, run ``box.info.replication`` in the instance's console |
| 75 | + and check the output table for values like ``upstream``, ``downstream``, and ``lag``. |
124 | 76 |
|
125 |
| -This procedure allows for a rolling upgrade **without downtime** and works for |
126 |
| -any cluster configuration: master-master or master-replica. |
| 77 | + For each instance ``id``, there are ``upstream`` and ``downstream`` values. |
| 78 | + Both of them should have the value ``follow``, except on the instance where you run this code. |
| 79 | + This means that the replicas are connected and there are no errors in the data flow. |
127 | 80 |
|
128 |
| -1. Upgrade Tarantool at all replicas (or at any master in a master-master |
129 |
| - cluster). See details in |
130 |
| - :ref:`Upgrading a Tarantool instance <admin-upgrades_instance>`. |
| 81 | + The value of the ``lag`` field can be less or equal than ``box.cfg.replication_timeout``, |
| 82 | + but it can also be moderately larger. |
| 83 | + For example, if ``box.cfg.replication_timeout`` is 1 second and the write load on the master is high, |
| 84 | + it's generally OK to have a lag of about 10 seconds on the master. |
| 85 | + It is up to the user to decide what lag values are fine. |
| 86 | + |
| 87 | +If the replica set is healthy, proceed to the upgrade. |
131 | 88 |
|
132 |
| -2. Verify installation on the replicas: |
| 89 | +Upgrade procedure |
| 90 | +~~~~~~~~~~~~~~~~~ |
133 | 91 |
|
134 |
| - a. Start Tarantool. |
| 92 | +.. include:: ./_includes/upgrade_procedure.rst |
135 | 93 |
|
136 |
| - b. Attach to the master and start working as before. |
| 94 | +7. Run :ref:`box.schema.upgrade() <box_schema-upgrade>` on the new master. |
| 95 | + This will update the Tarantool system spaces to match the currently installed version of Tarantool. |
| 96 | + There is no need to run ``box.schema.upgrade()`` on every node: |
| 97 | + changes are propagated to other nodes via the regular replication mechanism. |
137 | 98 |
|
138 |
| - The master runs the old Tarantool version, which is always compatible with |
139 |
| - the next major version. |
| 99 | +8. Run ``box.snapshot()`` on every node in the replica set |
| 100 | + to make sure that the replicas immediately see the upgraded database state in case of restart. |
140 | 101 |
|
141 |
| -3. Upgrade the master. The procedure is similar to upgrading a replica. |
142 | 102 |
|
143 |
| -4. Verify master installation: |
| 103 | +.. _admin-upgrades_version_specifics: |
144 | 104 |
|
145 |
| - a. Start Tarantool with replica configuration to catch up. |
| 105 | +Version specifics |
| 106 | +----------------- |
146 | 107 |
|
147 |
| - b. Switch to master mode. |
| 108 | +.. toctree:: |
| 109 | + :maxdepth: 1 |
148 | 110 |
|
149 |
| -5. Upgrade the database on any master node in the cluster. Make the request |
150 |
| - ``box.schema.upgrade()``. This updates Tarantool system spaces to match the |
151 |
| - currently installed version of Tarantool. Changes are propagated to other |
152 |
| - nodes via the regular replication mechanism. |
| 111 | + upgrades/1.6-1.10 |
| 112 | + upgrades/1.6-2.0-downtime |
| 113 | + upgrades/2.10.1 |
0 commit comments