您现在访问的是微软AZURE全球版技术文档网站,若需要访问由世纪互联运营的MICROSOFT AZURE中国区技术文档网站,请访问 https://docs.azure.cn.

如何管理 Azure Redis 缓存How to administer Azure Redis Cache

本主题介绍如何为 Azure Redis 缓存实例执行管理任务,如重启计划更新This topic describes how to perform administration tasks such as rebooting and scheduling updates for your Azure Redis Cache instances.

重新启动Reboot

可通过“重新启动”边栏选项卡重新启动缓存的一个或多个节点。The Reboot blade allows you to reboot one or more nodes of your cache. 如果有缓存节点发生故障,此重新启动功能可用于测试应用程序的复原能力。This reboot capability enables you to test your application for resiliency if there is a failure of a cache node.

重新启动

选择要重启的节点,并单击“重启”。Select the nodes to reboot and click Reboot.

重新启动

如果高级缓存启用了群集功能,则可选择要重新启动的缓存分片。If you have a premium cache with clustering enabled, you can select which shards of the cache to reboot.

重新启动

要重新启动缓存的一个或多个节点,请选择所需节点,并单击“重新启动”。To reboot one or more nodes of your cache, select the desired nodes and click Reboot. 如果高级缓存启用了群集功能,请选择要重新启动的所需分片,并单击“重新启动”。If you have a premium cache with clustering enabled, select the desired shards to reboot and then click Reboot. 几分钟后,所选节点将重新启动,再过几分钟后,又会回到联机状态。After a few minutes, the selected nodes reboot, and are back online a few minutes later.

对客户端应用程序的影响因用户重新启动的节点而有所不同。The impact on client applications varies depending on which nodes that you reboot.

  • - 重新启动主节点时,Azure Redis 缓存将故障转移到副本节点,并将其提升为主节点。Master - When the master node is rebooted, Azure Redis Cache fails over to the replica node and promotes it to master. 在此故障转移期间,可能会有一个较短的时间间隔无法连接到缓存。During this failover, there may be a short interval in which connections may fail to the cache.
  • 从属 - 重新启动从属节点时,通常不会影响缓存客户端。Slave - When the slave node is rebooted, there is typically no impact to cache clients.
  • 主和从属 - 同时重新启动这两个缓存节点时,缓存中的所有数据将丢失,并且无法连接到缓存,直到主节点重新联机。Both master and slave - When both cache nodes are rebooted, all data is lost in the cache and connections to the cache fail until the primary node comes back online. 如果已配置 数据持久性,则在缓存重新联机时会还原最新备份,但在最新备份后发生的所有缓存写入都将丢失。If you have configured data persistence, the most recent backup is restored when the cache comes back online, but any cache writes that occurred after the most recent backup are lost.
  • 已启用群集的高级缓存的节点 - 重新启动已启用群集的高级缓存的一个或多个节点时,所选节点的行为与重新启动非群集缓存的对应节点时相同。Nodes of a premium cache with clustering enabled - When you reboot one or more nodes of a premium cache with clustering enabled, the behavior for the selected nodes is the same as when you reboot the corresponding node or nodes of a non-clustered cache.

重要

现在所有定价层都可以重新启动。Reboot is now available for all pricing tiers.

重新启动常见问题Reboot FAQ

测试我的应用程序时,应重新启动哪个节点?Which node should I reboot to test my application?

若要针对缓存的主节点故障测试应用程序的复原能力,请重新启动节点。To test the resiliency of your application against failure of the primary node of your cache, reboot the Master node. 若要针对辅助节点的故障测试应用程序的复原能力,请重新启动从属节点。To test the resiliency of your application against failure of the secondary node, reboot the Slave node. 若要针对缓存的总故障测试应用程序的复原能力,请同时重新启动这两个节点。To test the resiliency of your application against total failure of the cache, reboot Both nodes.

能否通过重新启动缓存来清除客户端连接?Can I reboot the cache to clear client connections?

能,如果重新启动缓存,将清除所有客户端连接。Yes, if you reboot the cache all client connections are cleared. 当所有客户端连接均已用完(由于客户端应用程序中的逻辑错误或 bug)时,重新启动会很有用。Rebooting can be useful in the case where all client connections are used up due to a logic error or a bug in the client application. 每个定价层对于不同大小都有不同的客户端连接数限制,达到这些限制后,不再接受客户端连接。Each pricing tier has different client connection limits for the various sizes, and once these limits are reached, no more client connections are accepted. 通过重新启动缓存可以清除所有客户端连接。Rebooting the cache provides a way to clear all client connections.

重要

如果重新启动缓存以清除客户端连接,StackExchange.Redis 会在 Redis 节点重新联机后自动重新连接。If you reboot your cache to clear client connections, StackExchange.Redis automatically reconnects once the Redis node is back online. 如果未解决这一基本问题,客户端连接可能将继续用完。If the underlying issue is not resolved, the client connections may continue to be used up.

如果我执行重新启动,是否会丢失缓存中的数据?Will I lose data from my cache if I do a reboot?

如果同时重新启动节点和从属节点,则缓存中或该分片中(如果用户使用的是已启用群集的高级缓存)的所有数据都会丢失。If you reboot both the Master and Slave nodes, all data in the cache (or in that shard if you are using a premium cache with clustering enabled) is lost. 如果已配置 数据持久性,则在缓存重新联机时会还原最新备份,但在进行该备份后发生的所有缓存写入都将丢失。If you have configured data persistence, the most recent backup will be restored when the cache comes back online, but any cache writes that have occurred after the backup was made are lost.

如果只重新启动其中一个节点,数据通常不会丢失,但仍可能会丢失。If you reboot just one of the nodes, data is not typically lost, but it still may be. 例如,如果重新启动主节点时正在进行缓存写入,则缓存写入的数据将丢失。For example if the master node is rebooted and a cache write is in progress, the data from the cache write is lost. 发生数据丢失的另一种情况是,重新启动一个节点时,另一个节点恰巧因故障而关闭。Another scenario for data loss would be if you reboot one node and the other node happens to go down due to a failure at the same time. 有关数据丢失的可能原因的详细信息,请参阅 What happened to my data in Redis?(Redis 中的数据发生了什么情况?)For more information about possible causes for data loss, see What happened to my data in Redis?

能否使用 PowerShell、CLI 或其他管理工具重新启动缓存?Can I reboot my cache using PowerShell, CLI, or other management tools?

能,有关 PowerShell 说明,请参阅重新启动 Redis 缓存Yes, for PowerShell instructions see To reboot a Redis cache.

哪些定价层可以使用重新启动功能?What pricing tiers can use the reboot functionality?

所有定价层都可以重新启动。Reboot is available for all pricing tiers.

计划更新Schedule updates

使用“计划更新”边栏选项卡可为高级层缓存指定维护时段。The Schedule updates blade allows you to designate a maintenance window for your Premium tier cache. 指定维护时段后,会在此时段内进行任何 Redis 服务器更新。When the maintenance window is specified, any Redis server updates are made during this window.

备注

维护时段仅适用于 Redis 服务器更新,不适用于任何 Azure 更新或托管缓存的 VM 的操作系统更新。The maintenance window applies only to Redis server updates, and not to any Azure updates or updates to the operating system of the VMs that host the cache.

计划更新

要指定维护时段,请勾选合适的日期,并指定每天的维护时段开始时间,最后再单击“确定”。To specify a maintenance window, check the desired days and specify the maintenance window start hour for each day, and click OK. 请注意,维护时段使用 UTC 时间。Note that the maintenance window time is in UTC.

更新的默认最小维护时段为 5 小时。The default, and minimum, maintenance window for updates is five hours. 此值不可以在 Azure 门户中配置,但可以在 PowerShell 中使用 New-AzureRmRedisCacheScheduleEntry cmdlet 的 MaintenanceWindow 参数进行配置。This value is not configurable from the Azure portal, but you can configure it in PowerShell using the MaintenanceWindow parameter of the New-AzureRmRedisCacheScheduleEntry cmdlet. 有关详细信息,请参阅能否使用 PowerShell、CLI 或其他管理工具管理计划的更新?For more information, see Can I manage scheduled updates using PowerShell, CLI, or other management tools?

计划更新常见问题Schedule updates FAQ

如果我不使用计划更新功能,何时进行更新?When do updates occur if I don't use the schedule updates feature?

如果未指定维护时段,可以随时进行更新。If you don't specify a maintenance window, updates can be made at any time.

在计划的维护时段进行哪种类型的更新?What type of updates are made during the scheduled maintenance window?

仅在计划的维护时段进行 Redis 服务器更新。Only Redis server updates are made during the scheduled maintenance window. 维护时段不适用于 Azure 更新或 VM 操作系统更新。The maintenance window does not apply to Azure updates or updates to the VM operating system.

有关详细信息,请参阅能否使用 PowerShell、CLI 或其他管理工具管理计划的更新?Can I managed scheduled updates using PowerShell, CLI, or other management tools?

可以使用以下 PowerShell cmdlet 管理计划的更新:Yes, you can manage your scheduled updates using the following PowerShell cmdlets:

哪些定价层可以使用计划更新功能?What pricing tiers can use the schedule updates functionality?

计划更新功能仅在高级定价层中可用。The Schedule updates feature is only available in the premium pricing tier.

后续步骤Next steps