问题描述
由于Azure Redis的性能在不同级别表现不同,当需要升级/缩放Redis的时候,从使用者的角度:
- 需要知道有那些步骤?
- 注意事项?
- 潜在影响?
- 停机事件窗口?
- 升级预估时间?
解决方案
从使用的步骤出发,升级的步骤为:
1)Azure门户页面操作
- 选择缩放(Scale)目录
- 选择需要的级别(C1 ~ C6, P1 ~P5)
- 点击Select按钮确认
2)使用Powershell命令
使用 Set-AzRedisCache 来缩放 Azure Redis 缓存实例,修改 Size、Sku 或 ShardCount 属性
Set-AzRedisCache [-ResourceGroupName <String>] -Name <String> [-Size <String>] [-Sku <String>] [-RedisConfiguration <Hashtable>] [-EnableNonSslPort <Boolean>] [-TenantSettings <Hashtable>] [-ShardCount <Int32>] [-MinimumTlsVersion <String>] [-Tag <Hashtable>] [-DefaultProfile <IAzureContextContainer>] [-WhatIf] [-Confirm] [<CommonParameters>]
=====================================================
缩放 Azure Redis 缓存: https://docs.azure.cn/zh-cn/azure-cache-for-redis/cache-how-to-manage-redis-cache-powershell#to-scale-an-azure-cache-for-redis
Set-AzRedisCache:https://docs.microsoft.com/zh-cn/powershell/module/az.rediscache/set-azrediscache?view=azps-5.1.0
注意事项:
1、在缩放操作期间缓存名称和密钥不变,所以客户端应用程序连接字符串不需要改变的。
2、标准和高级缓存在缩放操作期间保持可用,但是可能会出现连接故障,这些连接故障预期为很小的故障,redis 客户端应能立即重新建立连接,所以确保应用程序有重连机制。
3、如果高级版redis使用了虚拟网络,那么客户端应用也需要在该虚拟网络内才可以访问redis。
4、如果您为高级redis开启了群集功能的话,那么客户端也需要对应改动,详细请参考:https://docs.azure.cn/zh-cn/azure-cache-for-redis/cache-how-to-premium-clustering#do-i-need-to-make-any-changes-to-my-client-application-to-use-clustering
升级时间:
缩放时间取决于缓存中的数据量,数据量越大,完成缩放所需的时间就越长。 缩放大约需要 20 分钟。
潜在影响:
标准和高级缓存在缩放操作期间保持可用,但是可能会出现连接故障,这些连接故障预期为很小的故障,redis 客户端应能立即重新建立连接。
性能变化:
每个级别的性能数据(连接数,RPS, 内存,CPU)变化如下:
参考资料:
缩放redis:https://docs.azure.cn/zh-cn/azure-cache-for-redis/cache-configure#scale
缩放redis的注意事项:https://docs.azure.cn/zh-cn/azure-cache-for-redis/cache-how-to-scale#scaling-faq
排查客户端问题:https://docs.azure.cn/zh-cn/azure-cache-for-redis/cache-troubleshoot-client#client-side-bandwidth-limitation
配置虚拟网络的redis:https://docs.azure.cn/zh-cn/azure-cache-for-redis/cache-how-to-premium-vnet