首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往
您找到你想要的搜索结果了吗?
是的
没有找到

Zookeeper leader的选举机制

所有节点创建具有相同路径 /app/leader_election/guid_ 的顺序、临时节点。 ZooKeeper集合将附加10位序列号到路径,创建的znode将是 /app/leader_election/guid_0000000001,/app/leader_election/guid_0000000002等。 对于给定的实例,在znode中创建最小数字的节点成为leader,而所有其他节点是follower。 每个follower节点监视下一个具有最小数字的znode。例如,创建znode/app/leader_election/guid_0000000008的节点将监视znode/app/leader_election/guid_0000000007,创建znode/app/leader_election/guid_0000000007的节点将监视znode/app/leader_election/guid_0000000006。 如果leader关闭,则其相应的znode/app/leader_electionN会被删除。 下一个在线follower节点将通过监视器获得关于leader移除的通知。 下一个在线follower节点将检查是否存在其他具有最小数字的znode。如果没有,那么它将承担leader的角色。否则,它找到的创建具有最小数字的znode的节点将作为leader。 类似地,所有其他follower节点选举创建具有最小数字的znode的节点作为leader。

01

Mathf数学函数总结

**Mathf.Abs 绝对值** C# => static float Abs(float f); Description: Returns the absolute value of f. 返回f的绝对值。 Example: Debug.log(Mathf.Abs(-10)); --> 10 **Mathf.Acos 反余弦** C# => static float Acos(float f); Description: Returns the arc-cosine of f - the angle in radians whose cosine is f. **Mathf.Approximately 近似值** C# => static bool approximately (float a, float b) Description: Compares two floating point values if they are similar. 比较两个浮点数值,看它们是否非常接近。 Example: Debug.Log(Mathf.Approximately(1.0f, 10.0f / 10.0f)); --> true **Mathf.Asin 反正弦** C# => static float Asin(float f); Description: Returns the arc-sine of f - the angle in radians whose sine is f. **Mathf.Atan 反正切** C# => static float Atan(float f); Description: Returns the arc-tangent of f - the angle in radians whose tangent is f. **Mathf.Ceil 向上进位取整** C# => static float Ceil (float f) Description: Returns the smallest integer greater to or equal to f. 返回大于或等于f的最小整数。 Example: Debug.Log(Mathf.Ceil(10.2f)); --> 11 **Mathf.CeilToInt 向上进位取整** C# => static int CeilToInt(float f); **Mathf.Clamp 钳制** C# => static float Clamp(float value, float min, float max ) Description: Clamps a value between a minimum float and maximum float value. 限制value的值在min和max之间, 如果value小于min,返回min。如果value大于max,返回max,否则返回value Example: Debug.log(Mathf.Clamp(10, 1, 3)); -->3 **Mathf.Clamp01 钳制01** C# => static float Clamp01(float value); Description: Clamps value between 0 and 1 and returns value. 限制value在0,1之间并返回value。如果value小于0,返回0。如果value大于1,返回1,否则返回value 。 **Mathf.ClosestPowerOfTwo 最接近二次方** C# => static int CloestPowerOfTwo(int value) Description: Return the closet power of two value. 返回距离value最近的2的次方数。 Example: Debug.Log(Mathf.ClosestPowerOfTwo(7)); -->8 **Mathf.Cos 余弦** C# => static float Cos(float f); Description: Returns the cosine of angle f in radians. 返回由参数 f 指定的角的余弦值(介于 -1.0 与 1.0 之间的值)。 **Mathf.D

02
领券