为什么在Azure IoT中心中使用主键和辅助键? [英] Why Primary key and Secondary key in Azure IoT hub?

查看:97
本文介绍了为什么在Azure IoT中心中使用主键和辅助键?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在创建共享访问策略或在Azure IoT中心中注册设备时,将生成一个主键和辅助键对.而且我注意到我可以使用主键或辅助键将设备连接到IoT中心.

When creating a shared access policy or registering a device in Azure IoT hub, there will be a Primary key and Secondary key pair generated. And I noticed I can connect a device to IoT hub using either Primary key or Secondary key.

那么,拥有主键/副键的目的是什么?我应该如何设计两个键的使用?

So, what's the purpose of having Primary/Secondary keys? How should I design the use of both keys?

推荐答案

主键和辅助键的目标是双重的. 首先,当您要更换钥匙时,它将允许您继续使用服务.假设您使用主数据库连接所有服务,然后要刷新它.您可以在服务中临时使用辅助服务器,然后在不停机的情况下更改主服务器.进行更改后,您可以将服务配置为使用新的主键.

The goal of primary and secondary key is two-fold. First of all it would allow you to keep using your service when you want to replace your key. Say you connect all your services using the primary and you want to refresh it. You could use the secondary temporarily in your services and then change your primary without having downtime. After you do the change you can configure your services to use the new Primary key.

第二种可能性是,如果您的合作伙伴中的一个会滥用该密钥,而您在没有自己的服务停机的情况下可以替换它,则您可以给合作伙伴提供第二密钥,并且您可以使用主密钥.

The second possibility would be that you give partners your secondary key and you use your primary if one of your partners would abuse the key you could replace it without having downtime in your own services.

这篇关于为什么在Azure IoT中心中使用主键和辅助键?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆