dremio 的服务管理

dremio 因为服务组件比较多,所以一些比较核心的可以做为服务的都会包装为一个service, 可以大大简化服务的管理,以及服务状态的统计

service

  • 接口定义
public interface Service extends AutoCloseable {
  void start() throws Exception;
}
  • 一些实现
    特别多,而且庞杂,可以看出dremio 组件的复杂

集群service 管理

主要是对于dremio 集群组件服务的定义以及管理

  • 接口定义
    ClusterServiceSetManager
 
public interface ClusterServiceSetManager extends Service {
  /**
   * Get a provider which returns the up-to-date list of endpoints for a given role.
   *
   * @param role the role to look up for
   * @return a provider for a collection of endpoints
   * @throws NullPointerException if role is {@code null}
   */
  ServiceSet getServiceSet(ClusterCoordinator.Role role);
 
  /**
   * Get or create a {@link ServiceSet} for the given service name
   * @param serviceName
   * @return
   */
  ServiceSet getOrCreateServiceSet(String serviceName);
 
  /**
   * Get the set of service names registered in the ClusterCoordinator ServiceSet.
   * NOTE: There is no guarantee of return object consistency depending on how Dremio is tracking the registered serivces.
   *
   * @return An Iterable of service names.
   */
  Iterable<String> getServiceNames() throws Exception;
}

实现子类

 

 

服务管理

包含了不少的服务,就需要统一管理了,目前支持了ServiceRegistry,进行服务的注册,替换,启动以及停止GuiceServiceModule 也是一个可以管理service 的类
属于一个标准的guice 模块,同时dremio 也包装了一个SingletonRegistry可以查找服务

说明

graylog 在服务管理上就使用了guava 的ServiceManager 也是一个不错的选择,如果我们基于guava 的service 进行dremio 的service 管理也是一个不错的选择,而且代码上也会比较清晰容易维护,

参考资料

https://github.com/dremio/dremio-oss/blob/d41cb52143b6b0289fc8ed4d970bfcf410a669e8/services/coordinator/src/main/java/com/dremio/service/coordinator/ClusterServiceSetManager.java
https://github.com/dremio/dremio-oss/blob/d41cb52143b6b0289fc8ed4d970bfcf410a669e8/common/src/main/java/com/dremio/service/Service.java
https://github.com/dremio/dremio-oss/blob/d41cb52143b6b0289fc8ed4d970bfcf410a669e8/common/src/main/java/com/dremio/service/ServiceRegistry.java
https://github.com/dremio/dremio-oss/blob/d41cb52143b6b0289fc8ed4d970bfcf410a669e8/dac/backend/src/main/java/com/dremio/dac/daemon/DACDaemonModule.java
https://github.com/dremio/dremio-oss/blob/d41cb52143b6b0289fc8ed4d970bfcf410a669e8/common/src/main/java/com/dremio/service/SingletonRegistry.java

posted on 2022-10-17 21:08  荣锋亮  阅读(26)  评论(0编辑  收藏  举报

导航