Esta seção descreve o procedimento para realizar a atualização entre clusters do PolarDB for MySQL.
Verificações pré-atualização
**Verificar se a função vinculada ao serviço do PolarDB existe**
Antes de iniciar a atualização, verifique se a função vinculada ao serviço do PolarDB existe e se o DTS recebeu permissões para acessar recursos na nuvem.
**Excluir contas de sistema extras do cluster PolarDB for MySQL de origem**
Para evitar a sobrescrita de contas de sistema no cluster PolarDB for MySQL de destino após a migração, o cluster PolarDB for MySQL de origem não deve conter simultaneamente as contas root e aliyun_root. Antes da atualização, exclua quaisquer contas de sistema extras do cluster PolarDB for MySQL de origem.
Os nomes corretos das contas de sistema para cada versão do PolarDB for MySQL são:
|
**Versão do mecanismo de banco de dados ** |
Nome correto da conta de sistema |
|
MySQL 5,6 |
root |
|
MySQL 5,7 |
aliyun_root |
|
MySQL 8,0 |
root |
Para cada versão listada acima, exclua todas as contas de sistema, exceto a correta. Por exemplo, a conta de sistema correta para um cluster PolarDB MySQL 5,7 é aliyun_root. Se você criou manualmente uma conta root no console, exclua-a. Antes de excluir, certifique-se de que suas aplicações não utilizam a conta root.
Contas de sistema podem ter sido criadas manualmente ou automaticamente pelo sistema e permanecido após uma atualização de versão. Em alguns casos, essas contas podem não aparecer no console.
Exemplo
O exemplo a seguir mostra como limpar contas de sistema extras de um cluster PolarDB MySQL 5,6:
Use uma conta privilegiada para conectar-se ao banco de dados.
-
Localize todas as contas de sistema root e aliyun_root.
SELECT * FROM mysql.user WHERE `user` IN ('root', 'aliyun_root'); -
Exclua as contas de sistema extras. A conta de sistema correta para um cluster PolarDB MySQL 5,6 é root, portanto, exclua a conta aliyun_root.
DELETE FROM mysql.user WHERE `user` = 'aliyun_root' LIMIT n;
(Opcional) Teste de estresse inteligente
Antes de realizar uma atualização importante da versão do mecanismo, utilize o teste de estresse inteligente para simular o tráfego do seu serviço executando no cluster PolarDB de destino. Isso ajuda você a:
Verificar se as especificações do seu cluster precisam de scale-out para lidar com o pico de tráfego do serviço.
Analisar diferenças de desempenho na execução de modelos SQL entre os clusters PolarDB original e de destino.
Para obter as etapas detalhadas, consulte Reprodução de tráfego e teste de estresse.
**Etapa 1: Atualizar e migrar do PolarDB**
Nesta etapa, você criará um cluster com os mesmos dados do cluster PolarDB for MySQL de origem, e os dados incrementais do cluster PolarDB for MySQL de origem serão sincronizados com este novo cluster em tempo real.
Durante a migração via DTS, a sincronização inicial completa dos dados consome recursos de leitura e gravação nos bancos de dados de origem e de destino, o que pode aumentar a carga do banco de dados. Conforme necessário, ajuste a taxa de migração.
Faça login no console PolarDB.
Na página de lista de clusters, clique em Create Cluster para acessar a página de compra de clusters.
-
Escolha um método de faturamento: Subscription , Pay-as-you-go ou Serverless .
Subscription: Pague antecipadamente pelos nós de computação ao criar o cluster. O espaço de armazenamento é faturado por hora com base no uso real e deduzido da sua conta a cada hora.
Pay-as-you-go: Sem pagamento antecipado. Tanto os nós de computação quanto o espaço de armazenamento (com base no uso real) são faturados por hora e deduzidos da sua conta a cada hora.
Serverless: Sem pagamento antecipado. Nós de computação, espaço de armazenamento, proxy de banco de dados e outros recursos dimensionam dinamicamente com base na demanda real durante o uso do cluster, e o faturamento ocorre conforme o uso efetivo.
-
Defina os parâmetros a seguir de acordo com o seu cenário.
NotaPara parâmetros não descritos na tabela abaixo, consulte Comprar um cluster.
Parâmetro
Descrição
Creation Method
Selecione Upgrade and Migrate from PolarDB.
Region
Selecione a região onde reside o cluster PolarDB for MySQL de origem.
Source PolarDB Version
A versão do cluster PolarDB for MySQL de origem. É possível selecionar 5,6, 5,7 ou 8,0.
Source PolarDB Cluster
Selecione o cluster PolarDB for MySQL de origem.
Database Engine
A versão do mecanismo de banco de dados para o cluster de destino.
-
Ao atualizar entre versões, selecione a mesma versão do cluster de origem ou uma versão diferente.
-
Ao atualizar entre arquiteturas, selecione obrigatoriamente MySQL 8.0.
NotaDatabase Edition
Corresponde à edição do cluster de origem. Nenhuma seleção necessária.
Edition
A série para o cluster de destino.
Nota-
Ao atualizar entre versões, selecione Cluster Edition [Recommended].
-
Ao atualizar entre arquiteturas, selecione Multi-master Cluster (Limitless).
CPU Architecture
Corresponde à arquitetura de CPU do cluster de origem. Nenhuma seleção necessária.
Nodes
Corresponde ao número de workers do cluster de origem. Nenhuma seleção necessária.
Selected Specifications
As especificações de nó para o cluster de destino.
Database Proxy Type
Corresponde às especificações do proxy de banco de dados do cluster de origem. Nenhuma seleção necessária.
-
No canto superior direito, revise a configuração do cluster. Defina Subscription Duration (para clusters Subscription ), Quantity e se deseja ativar a Auto-renewal.
Leia e aceite o Contrato de Serviço. Clique em Buy Now.
-
Na página Payment , confirme os detalhes do pedido pendente e o método de pagamento, depois clique em Place Order .
NotaApós o pagamento bem-sucedido, a criação do cluster leva de 10 a 15 minutos. Em seguida, o novo cluster estará visível na Cluster List .
Se os nós do cluster exibirem Creating , o cluster ainda não está pronto. Somente quando o status do cluster for Running ele poderá ser utilizado.
Certifique-se de ter selecionado a região correta. Caso contrário, o cluster não será exibido.
Após a criação do cluster, clique no ID do cluster para acessar a página Basic Information .
-
Na página Basic Information, na seção PolarDB Upgrade, confirme se a Replication Latency do cluster PolarDB de destino é inferior a 60 segundos antes de prosseguir.
NotaClusters com sincronização bidirecional DTS existente não podem ser atualizados com um clique e podem apresentar inconsistência de dados.
Após a criação do cluster, o DTS inicia a sincronização de dados do cluster PolarDB de origem. É necessário concluir a atualização dentro de 30 dias. Após esse período, o recurso de atualização é desativado automaticamente.
Nesta seção, clique em Cancel Upgrade para cancelar. Para saber os impactos do cancelamento de uma atualização, consulte FAQ.
-
Se o status mostrar Precheck Failed , resolva o problema com base na Error Message .
Por exemplo, se houver triggers criados no cluster PolarDB de origem, a pré-verificação falhará e retornará o erro “PolarDB cluster contains triggers”. Exclua os triggers no PolarDB primeiro e clique em Continue Upgrade , ou clique em Abandon Upgrade e crie manualmente uma tarefa de migração no console DTS. Para mais informações, consulte Como configurar uma tarefa de sincronização ou migração quando existem triggers no banco de dados de origem.
Para atualizações de arquitetura, o endpoint de gravação padrão do cluster de destino é o nó RW com MasterID=1. Para garantir a sincronização normal de dados via DTS, sempre grave neste nó RW até que a atualização seja concluída.
Etapa 2: Alinhamento de endereços (opcional)
PolarDB major engine version upgrade supports address-preserving switching. You can retain the original database endpoint and switch to the new PolarDB without your application modifying any connection configuration. Note that mutual switching is supported only for endpoints that exist on both the source PolarDB and the target PolarDB cluster. By default, the target creates only a private primary endpoint and a private cluster endpoint. If the source contains more than two endpoints, you must create the corresponding endpoints on the target before switching; otherwise, the switch will not occur. For information about how to create endpoints for a PolarDB cluster, see Manage connection addresses.
You can align addresses only after the destination cluster becomes Running. You can also configure address properties, cluster parameters, and add read-only nodes as needed.
Before switching private endpoints with address switching, ensure the source PolarDB and destination PolarDB clusters are in the same VPC. Otherwise, existing services won't connect after switching.
Etapa 3: Troca de atualização
Perform the upgrade switch when the destination PolarDB cluster's replication delay is less than 60 seconds.
Log on to the PolarDB console.
Find the destination cluster and click its cluster ID.
-
On the Basic Information page, in the PolarDB Upgrade section, click Upgrade Switchover.
NotaUpgrades typically complete within 5 minutes.
This operation swaps the read/write status of the source PolarDB cluster and the target PolarDB cluster by changing the source PolarDB cluster to read-only and the target PolarDB cluster to read/write. Meanwhile, DTS reverses the data replication direction by synchronizing new data from the target PolarDB cluster to the source PolarDB cluster.
-
In the Upgrade Switchover dialog box, choose either Switch with Address (No Application Configuration Changes) or ** Switch without Address (Update Application Connection Configuration to New PolarDB Endpoint) . The dialog shows the mapping between Source PolarDB Endpoints and Destination Endpoints**.
-
If you choose Switch with Address (No Application Configuration Changes) , follow these steps:
-
Select Switch with address swap (no application connection configuration changes required) . The system will automatically swap the connection endpoints on the source PolarDB and the target PolarDB, so you don't need to modify any configuration in your application to automatically connect to the target PolarDB cluster.
ImportanteBefore selecting Switch with Address (No Application Configuration Changes) , read Address switching considerations.
If the PolarDB cluster being upgraded is already a source or destination in an existing Data Transmission Service (DTS) task, update the DTS task after the upgrade to use the upgraded PolarDB cluster as the source or destination. This applies to data sync tasks, data migration tasks, and change tracking tasks. For details, see Modify DTS task objects.
Click OK .
-
-
If you choose ** Switch without Address (Update Application Connection Configuration to New PolarDB Endpoint) **, follow these steps:
Select ** Switch without Address (Update Application Connection Configuration to New PolarDB Endpoint) **.
Click OK .
Refresh the page. Once the destination PolarDB cluster's Read/Write Status shows Read/Write , update your application's database endpoint immediately.
-
If you encounter data anomalies after the upgrade switch, you can roll back to restore the pre-upgrade state. For details, see Upgrade rollback.
After completing an architecture upgrade and switch, do not change the write endpoint of the destination Multi-master Cluster (Limitless) to avoid DTS sync issues.
Etapa 4: Troca de tarefa DTS da instância de origem (opcional)
If the source instance has associated DTS links (excluding the one-click migration DTS link), use this feature to modify (replace) the source or destination instance in DTS sync or migration tasks for smooth business transition. For implementation details and considerations, see Modify the source or destination instance in a DTS task.
Go to the PolarDB console.
Find the destination cluster and click its cluster ID.
On the Basic Information page, in the Apsara PolarDB Migration Feature section, click Source Instance DTS Task Switchover.
-
In the Switch Business DTS Database dialog box, select either Source Instance DTS Task (Forward Switchover) or Destination Instance DTS Task (Switchover Rollback).
ImportanteBefore switching, check the DTS sync status for both source and destination instances. For details on checking DTS status, see Check DTS status.
Tarefa DTS da instância de origem (troca direta)
If you select Source Instance DTS Task (Forward Switchover), follow these steps. The DTS task list appears, showing columns such as DTS Task Name, Sync Status, Source Instance, and Destination Instance.
Select the DTS task whose database instance you want to switch.
Click Commit Forward Switchover.
Tarefa DTS da instância de destino (troca de rollback)
If you select Destination Instance DTS Task (Switchover Rollback), follow these steps.
The interface resembles the Source Instance DTS Task (Forward Switch) tab, showing the list of DTS tasks to roll back.
Select the DTS task whose database instance you want to switch.
Click Commit Switchover Rollback.
Source instance DTS task (forward switch) applies after migration switch to redirect the source instance's DTS tasks to the destination instance, completing pre-migration DTS operations.
Destination instance DTS task (rollback switch) applies after rollback switch to redirect the destination instance's DTS tasks back to the source instance, completing operations before canceling migration.
Etapa 5: Concluir atualização
After completing Step 1: Upgrade from PolarDB, you must complete the upgrade within 30 days.
Before clicking Complete Upgrade , ensure data migration is complete and you no longer need data sync.
Because this operation will break the data synchronization task between the source PolarDB cluster and the target PolarDB cluster, and the upgrade rollback feature will no longer be available, we recommend that you use the target PolarDB cluster for a period of time and confirm that it is operating normally before completing the upgrade.
Log on to the PolarDB console.
Find the destination cluster and click its cluster ID.
On the Basic Information page, in the PolarDB Upgrade section, click Complete Upgrade.
-
In the Complete Upgrade dialog box, choose whether to disable binary logging for the PolarDB cluster, then click OK .
NotaAfter clicking OK , the system breaks the sync relationship within 2 minutes, and the upgrade status changes to Sync Disabled .
If you choose to disable binary logging, the PolarDB cluster restarts automatically to apply the new configuration.
If you no longer need the source PolarDB cluster, you can choose to release the source PolarDB cluster. For more information about releasing a cluster, see Releasing a cluster.
If you performed an architecture upgrade, clicking OK in the Complete Upgrade dialog restores the write endpoint to its initial state, where the database randomly assigns an RW node as the write endpoint.
Visualizar detalhes da tarefa de sincronização de dados (opcional)
If errors or anomalies occur during version upgrade, go to the corresponding DTS data sync task details page to view detailed information.
Log on to the PolarDB console.
Find the destination cluster and click its cluster ID.
On the Basic Information page, in the PolarDB Upgrade section, click the task name under DTS Data Synchronization Task to go to the DTS console's data sync task list.
In the data sync task list, find the relevant task to view sync details and task logs.
If requirements change during upgrade (for example, if new databases are added to the source PolarDB cluster and need to be included in sync), click Modify Sync Objects to reconfigure.
Rollback de atualização (opcional)
Before completing the upgrade, if you find issues such as data abnormalities, you can perform a rollback operation to quickly restore the cluster to its pre-upgrade state (the source PolarDB cluster is read-write, the target PolarDB cluster is read-only, and data from the source PolarDB cluster will be synchronized to the target PolarDB cluster). After the rollback is complete, to continue with the major engine version upgrade, you can start directly from the Step 3: Switch over operation.
Log on to the PolarDB console.
Find the destination cluster and click its cluster ID.
On the Basic Information page, in the PolarDB Upgrade section, click Upgrade Rollback.
-
In the failback dialog box, choose either Failback with Address (No Application Configuration Changes) or Failback without Address (Update Application Connection Configuration to Source Instance Endpoint) .
-
If you choose Failback with Address (No Application Configuration Changes) , follow these steps:
Select Switchback with Address Swapping (No Application Connection Configuration Changes Required) , and the system automatically swaps the connection addresses between the source PolarDB cluster and the target PolarDB cluster, enabling you to automatically switch back to the source PolarDB cluster without modifying any configurations on the application side.
-
Click OK .
At this point, the source PolarDB cluster is readable and writable, the target PolarDB cluster is read-only, and data from the source PolarDB cluster will be synchronized to the target PolarDB cluster.
NotaFor architecture upgrade rollback, you can choose which addresses to roll back.
-
If you choose Failback without Address (Update Application Connection Configuration to Source Cluster Endpoint) , follow these steps:
Select Failback without Address (Update Application Connection Configuration to Source Cluster Endpoint) . After failback, update your application's database connection pool endpoint immediately.
Click OK . The source PolarDB cluster becomes read/write, the target PolarDB cluster becomes read-only, and data from the source PolarDB cluster is synchronized to the target PolarDB cluster.
Refresh the page, and when the status of the source PolarDB cluster changes to read/write, promptly update the database endpoint in your application to that of the source PolarDB cluster.
Log on to the PolarDB console.
Find the destination cluster and click its cluster ID.
On the Basic Information page, in the PolarDB Upgrade section, click Cancel Upgrade.
In the Cancel Upgrade dialog box, click OK. The dialog explains that canceling the upgrade breaks data sync between source and destination clusters. Optionally, select Disable Binary Logging for Destination Instance.
Cancelar atualização (opcional)
FAQ
-