金庆的专栏

  C++博客 :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  423 随笔 :: 0 文章 :: 454 评论 :: 0 Trackbacks

Clustering provider in Orleans

(Jin Qing's Column, Nov. 3, 2021)

When deployed to a cluster of nodes, Orleans internally implements a protocol to manage it's silos, including discovery, failure and reconfigure, which is called cluster membership management.

Orleans has clustering membership providers for: Azure, SQL server, Zookeeper.

Clustering provider is one of key aspects of silo configuration.

Orleans.Clustering.Kubernetes

OrleansContrib/Orleans.Clustering.Kubernetes is a clustering provider for running Orleans cluster on Kubernetes.

Tell silo to use Kubernetes as the Cluster Membership Provider:

var silo = new SiloBuilder()
        ...
        .UseKubeMembership()
        ...
        .Build();

Interface

UseKubeMembership() instantiates a KubeMembershipTable which implements IMembershipTable.

    public interface IMembershipTable
    {
        Task InitializeMembershipTable(bool tryInitTableVersion);
        Task DeleteMembershipTableEntries(string clusterId);
        Task CleanupDefunctSiloEntries(DateTimeOffset beforeDate);
        Task<MembershipTableData> ReadRow(SiloAddress key);
        Task<MembershipTableData> ReadAll();
        Task<bool> InsertRow(MembershipEntry entry, TableVersion tableVersion);
        Task<bool> UpdateRow(MembershipEntry entry, string etag, TableVersion tableVersion);
        Task UpdateIAmAlive(MembershipEntry entry);
    }

Implement

KubeMembershipTable access Kubernetes API server to read and write silo entry CRD.

  • InitializeMembershipTable()

    • TryInitClusterVersion()

      • _kubeClient.GetNamespacedCustomObjectAsync
      • _kubeClient.CreateNamespacedCustomObjectAsync
  • DeleteMembershipTableEntries(string clusterId)

    • _kubeClient.DeleteNamespacedCustomObjectAsync
  • InsertRow(...)

    • _kubeClient.GetNamespacedCustomObjectAsync
    • _kubeClient.ReplaceNamespacedCustomObjectAsync
    • _kubeClient.CreateNamespacedCustomObjectAsync
  • ReadAll()

    • GetClusterVersion()

      • _kubeClient.ListNamespacedCustomObjectAsync
    • GetSilos()

      • _kubeClient.ListNamespacedCustomObjectAsync
  • ReadRow(SiloAddress key)

    • _kubeClient.GetNamespacedCustomObjectAsync
  • UpdateIAmAlive(MembershipEntry entry)

    • _kubeClient.GetNamespacedCustomObjectAsync
    • _kubeClient.ReplaceNamespacedCustomObjectAsync
  • UpdateRow(...)

    • _kubeClient.ReplaceNamespacedCustomObjectAsync
  • CleanupDefunctSiloEntries(DateTimeOffset beforeDate)

    • _kubeClient.DeleteNamespacedCustomObjectAsync

The operators to NamespacedCustomObject are:

  • Delete
  • Get
  • Create
  • Replace
  • List

CRD

Two CRDs, ClusterVersion and Silo are defined in files:

  • ClusterVersionCRD.yaml
  • SiloEntryCRD.yaml

Custom resource objects are stored in etcd of Kubernetes.

posted on 2021-11-03 13:36 金庆 阅读(257) 评论(0)  编辑 收藏 引用 所属分类: 9. 其它

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   博问   Chat2DB   管理