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
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
2021-10-17 nomad-pack nomad的仓库特性
2021-10-17 zalando 最新关于微前端的一些实践文章
2021-10-17 opencomponents web 集成
2021-10-17 opencomponents 私服minio 模式运行
2021-10-17 opencomponents 快速部署前端组件的工具
2020-10-17 waypoint hashicorp 团队新开源的跨多平台的构建部署&&发布工具
2020-10-17 pgenv 一个不错的postgres 多版本管理工具