2.8. Обновление кластера #

В этом разделе описан процесс обновления базы данных Shardman до более новой версии. Перед обновлением рекомендуется посмотреть Замечания к выпуску и найти те изменения, которые могут вызвать проблемы с вашим приложением. Если нет потенциальных проблем, можно перейти к обновлению.

Процесс обновления Shardman состоит из нескольких шагов, которые необходимо выполнять последовательно:

  1. Обновить пакеты Shardman.

  2. Перезапустить все службы Shardman и экземпляры базы данных.

  3. Обновить расширение базы данных shardman.

2.8.1. Обновление пакетов #

2.8.1.1. Системы с пакетным менеджером APT #

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

$ apt update && apt --only-upgrade install shardman-tools shardman-services postgrespro-sdm-14-contrib postgrespro-sdm-14-server

или обновить все пакеты в системе:

$ apt update && apt upgrade

Проверьте, что на каждом узле обновлены все пакеты:

$ dpkg -l | grep -E '(postgres pro|shardman)'

2.8.1.2. RPM-системы #

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

$ yum update shardman-tools shardman-services postgrespro-sdm-14-contrib postgrespro-sdm-14-server

или обновить все пакеты в системе:

$ yum update

Проверьте, что на каждом узле обновлены все пакеты:

$ yum list --installed | grep -E  '(postgrespro|shardman)'

2.8.2. Перезапуск служб Shardman и экземпляров баз данных #

После обновления пакетов необходимо перезапустить все службы кластера. Это можно сделать одной командой shardmanctl restart:

$ shardmanctl --cluster-name cluster0 --store-endpoints http://etcd1:2379,http://etcd2:2379,http://etcd3:2379 restart

Можно пропустить параметры --cluster-name и --store-endpoints, установив переменные среды SDM_CLUSTER_NAME и SDM_STORE_ENDPOINTS, как в примере ниже:

                    export SDM_STORE_ENDPOINTS=http://etcd1:2379,http://etcd2:2379,http://etcd3:2379
                    export SDM_CLUSTER_NAME=cluster0
                

2.8.3. Обновление расширения #

После перезапуска служб кластера следует обновить расширения сервера, выполнив следующую команду:

$ shardmanctl --cluster-name cluster0 --store-endpoints http://etcd1 :2379,http://etcd2:2379,http://etcd3:2379 upgrade

Если версия расширения shardman и версия библиотеки на сервере различаются, распределённые запросы и Shardman DDL не будут работать.

Расширения Shardman стараются предотвратить взаимодействие с несовместимым программным обеспечением. Несовместимости могут возникать по нескольким причинам: версия общей библиотеки shardman не соответствует версии расширения или версия удалённого сервера не соответствует версии локального сервера. В случае несовпадения версий расширения и библиотеки, Shardman не сможет изменить свои метаданные и не будет выполнять операции над глобальными объектами, пока расширение не будет обновлено. Если версия удалённого сервера не совпадает с версией локального сервера или они принадлежат разным кластерам, Shardman не будет взаимодействовать с сервером.

2.8. Upgrading a Cluster #

This section discusses how to upgrade your database from one Shardman release to a newer one. It is best to review the Release Notes before an upgrade and look for any changes that may cause issues for your application. You can proceed to upgrade if there are no potential issues.

The process of updating a Shardman consists of several steps that must be performed sequentially:

  1. Upgrade Shardman packages.

  2. Restart all Shardman services and database instances.

  3. Upgrade database shardman extension.

2.8.1. Upgrade Packages #

2.8.1.1. APT-based Systems #

To upgrade packages, typically run the following command:

$ apt update && apt --only-upgrade install shardman-tools shardman-services postgrespro-sdm-14-contrib postgrespro-sdm-14-server

or upgrade all packages:

$ apt update && apt upgrade

Check that all packages have been updated on each node:

$ dpkg -l | grep -E  '(postgrespro|shardman)'

2.8.1.2. RPM-based systems #

To upgrade packages, typically run the following command:

$ yum update shardman-tools shardman-services postgrespro-sdm-14-contrib postgrespro-sdm-14-server

or upgrade all packages:

$ yum update

Check that all packages have been updated on each node:

$ yum list --installed | grep -E  '(postgrespro|shardman)'

2.8.2. Restart Shardman Services and Database Instances #

After updating the packages, you need to restart all cluster services. It can be done with a single shardmanctl restart command:

$ shardmanctl --cluster-name cluster0 --store-endpoints http://etcd1:2379,http://etcd2:2379,http://etcd3:2379 restart

You can skip the --cluster-name and --store-endpoints options by setting the SDM_CLUSTER_NAME and SDM_STORE_ENDPOINTS environment variables as in the example below:

                    export SDM_STORE_ENDPOINTS=http://etcd1:2379,http://etcd2:2379,http://etcd3:2379
                    export SDM_CLUSTER_NAME=cluster0
                

2.8.3. Upgrade the Extension #

After restarting services of the cluster, you should update the server extensions by running the following command:

$ shardmanctl --cluster-name cluster0 --store-endpoints http://etcd1:2379,http://etcd2:2379,http://etcd3:2379 upgrade

In the case when the shardman extension version and server library version are different, distributed queries and Shardman DDL will not work.

Shardman extensions try to ensure that they do not communicate with incompatible software. Incompatibilities can arise for several reasons: the shardman shared library version does not match the extension version or the remote server version does not match the local server version. In case when the extension and library versions mismatch, Shardman cannot modify its metadata and will refuse to perform operations on global objects until the extension is updated. In case when the remote server version does not match the local server version or when they belong to different clusters, Shardman will refuse to communicate with the server.

FAQ