简体   繁体   English

MariaDB/Galera:将 MariaDB 10.4 节点连接到 MariaDB 10.1 集群是否安全?

[英]MariaDB/Galera: Is it safe to connect MariaDB 10.4 nodes to a MariaDB 10.1 cluster?

I've got a running MariaDB/Galera cluster with three MariaDB 10.1 nodes and some InnoDB databases.我有一个正在运行的 MariaDB/Galera 集群,其中包含三个 MariaDB 10.1 节点和一些 InnoDB 数据库。 I like to replace the whole cluster by three new nodes.我喜欢用三个新节点替换整个集群。 I've already installed MariaDB on the new machines, but using the newer 10.4 version.我已经在新机器上安装了 MariaDB,但使用的是较新的 10.4 版本。

Is it safe to just connect the new nodes to the existing cluster to initiate a state transfer and shutdown the old machines afterwards or is this going to fail because of issues between the different versions?将新节点连接到现有集群以启动 state 传输并随后关闭旧机器是否安全,或者这是否会因为不同版本之间的问题而失败?

I didn't find anything useful about running clusters with different MariaDB/Galera versions in the docs.我在文档中没有发现任何关于运行具有不同 MariaDB/Galera 版本的集群的有用信息。

Unfortunately you need to upgrade through each major version of the servers and run mysql_upgrade for each (which is not replicated in the cluster, so that's fine).不幸的是,您需要升级服务器的每个主要版本并为每个服务器运行 mysql_upgrade (没有在集群中复制,所以没关系)。 The risk you run when in a cluster with mixed versions is that a node fails and gets an SST from a higher version, or that something not-backward compatible is done on the higher-versioned node, breaking the lower-versioned node and causing it to request a state-transfer, so you can see that might not end well.在具有混合版本的集群中运行的风险是节点发生故障并从更高版本获取 SST,或者在更高版本的节点上执行了一些不向后兼容的操作,从而破坏了更低版本的节点并导致它请求状态转移,因此您可以看到这可能不会很好地结束。

What's more, there are changes in the structure of permission tables between 10.3 and 10.4, band in the Galera protocol, so even if you do not run into the problems mentioned above, replication is likely to fail.更何况Galera协议10.3和10.4之间的权限表结构有变化,所以即使没有遇到上面提到的问题,复制也很可能会失败。

If you can afford it, the safest and easiest way to do a multi-version upgrade is to be sure to configure the node with xtrabackup SSTs for 10.1 and mariabackup SSTs for 10.2 onward, then take the cluster down to a single node, and upgrade that node through 10.2 and 10.3 to 10.4 (running mysql_upgrade each time).如果您负担得起,进行多版本升级的最安全和最简单的方法是确保为节点配置 10.1 的 xtrabackup SST 和 10.2 及更高版本的 mariabackup SST,然后将集群降级为单个节点,然后升级该节点通过 10.2 和 10.3 到 10.4(每次运行 mysql_upgrade)。 Once the node is all the way up to 10.4, then adding more 10.4 nodes is trivial.一旦节点一直到 10.4,那么添加更多 10.4 节点是微不足道的。

This way you only go through the 10.2/mysql_upgrade/10.3/mysql_upgrade_10.4/mysql_upgrade drill on a single node, and you can just directly install 10.4 on the remaining nodes and let them get an SST as they join the cluster.这样你只需在单个节点上通过 10.2/mysql_upgrade/10.3/mysql_upgrade_10.4/mysql_upgrade 演练 go,你可以直接在其余节点上安装 10.4 并让他们在加入集群时获得 SST。

To make the upgrades easier, here's what you need to do (example for CentOS/RHEL - you can use the same repository script for Debian: the location of config files will be different, package names will be all lowercase, and cleaning up repos will also be a bit different, but that's about it)为了使升级更容易,您需要执行以下操作(例如,对于 CentOS/RHEL - 您可以为 Debian 使用相同的存储库脚本:配置文件的位置将不同,package 名称将全部小写,并且清理存储库将也有点不同,但仅此而已)

1) figure out your current version: 1)找出你当前的版本:

mysqld --version

2) configure the repositories for your current version: 2)为当前版本配置存储库:

curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash -s -- --mariadb-server-version=mariadb-10.1.30

3) save your configuration files (these will get overwritten with defaults during the install) 3)保存您的配置文件(这些将在安装过程中被默认覆盖)

cp /etc/my.cnf.d/server.cnf ~/

4) stop the server 4)停止服务器

systemctl stop mariadb

5) uninstall the old version 5)卸载旧版本

yum remove MariaDB-server MariaDB-client 
# on 10.1 you might also have to remove percona-xtrabackup or percona-xtrabackup-24
# on later versions, this should be replaced with MariaDB-backup
# the rest of the relevant packages are removed as dependencies

6) update the repository definitions 6)更新存储库定义

rm -fr /etc/yum.repos.d/mariadb.repo*
rm -fr /var/cache/yum
yum clean metadata
curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash -s -- --mariadb-server-version=mariadb-10.2

7) install the new server 7) 安装新服务器

yum -y install MariaDB-server MariaDB-backup

8) replace the configuration files 8) 替换配置文件

cp -pr ~/server.cnf /etc/my.cnf.d/
#you should change the sst method to mariabackup when going from 10.1 to 10.2

9) start the server 9) 启动服务器

galera_new_cluster

10) run mysql_upgrade 10) 运行 mysql_upgrade

mysql_upgrade

11) GOTO step 4) and repeat the process for 10.3 and then 10.4 (remembering that now you're removing/adding MariaDB-backup instead of percona-xtrabackup) 11) 转到步骤 4) 并重复 10.3 和 10.4 的过程(请记住,现在您正在删除/添加 MariaDB-backup 而不是 percona-xtrabackup)

It would probably be easiest to use one of the new nodes to do this by first installing 10.1 on it and letting it join the old cluster, then decommissioning the old cluster and running the upgrade on the new node.使用其中一个新节点执行此操作可能是最简单的方法,首先在其上安装 10.1 并让它加入旧集群,然后停用旧集群并在新节点上运行升级。

If you can't bring the cluster down to a single node, then you need to upgrade the entire cluster through each major release by doing a rolling upgrade to 10.2, then a rolling upgrade to 10.3, and finally a rolling upgrade to 10.4.如果您无法将集群降到单个节点,那么您需要通过每个主要版本升级整个集群,方法是滚动升级到 10.2,然后滚动升级到 10.3,最后滚动升级到 10.4。 Although there is still a risk, it is much more manageable this way.尽管仍然存在风险,但这种方式更易于管理。 Large 24/7 shops would basically do the rolling upgrade, except they would also reconfigure the list of state transfer donors for each node to only accept transfers from nodes on the same version.大型 24/7 商店基本上会进行滚动升级,除了他们还会重新配置每个节点的 state 转移捐助者列表,以仅接受来自相同版本节点的转移。

Here's some documentation on using the repository update script: https://mariadb.com/kb/en/mariadb-package-repository-setup-and-usage/以下是有关使用存储库更新脚本的一些文档: https://mariadb.com/kb/en/mariadb-package-repository-setup-and-usage/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM