# satellite **Repository Path**: open-byte/satellite ## Basic Information - **Project Name**: satellite - **Description**: Satellite(卫星)是一款优秀的开源配置中心,提供了对客户端配置的统一管理、实时更新、全量与灰度发布、集群部署等能力,支持多配置文件聚合、丰富的文件格式、智能提示等优秀的特点。 - **Primary Language**: Java - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 4 - **Forks**: 1 - **Created**: 2024-06-06 - **Last Updated**: 2025-12-23 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Satellite Config ![项目架构图](docs/images/satellite.png "项目架构图") #### 介绍 Satellite(卫星)是一款优秀的开源配置中心,提供了对客户端配置的统一管理、实时更新、全量与灰度发布、集群部署等能力,支持多配置文件聚合、丰富的文件格式、智能提示等优秀的特点。 #### 当前版本拥有的特性 - 支持配置实时更新,定时更新 - 支持空间隔离与环境隔离 - 支持全量发布与灰度发布 - 支持历史发布版本的查询 - 支持智能提示,在编写配置时可以有更好的体验 - 支持监听实例的时候监控 - 支持数据库的读写分离 - 采用Peer2Peer的集群模式,支持集群节点故障的自动摘除与恢复,客户端集群节点的动态感知 #### 下个版本预览 - 计划新增定时发布配置的功能 - 计划新增配置对比功能 - 计划新增历史版本回滚功能 - 优化部分性能,提供更丰富的智能提示内容 #### 安装教程 1. 从gitee或github上拉取源码到本地, 2. 提供一个mysql环境版本>8,执行docs/schema下的satellite-mysql8.sql的建表脚本。 3. 从deployment文件中获取satellite-server-[version].jar,启动服务端。 4. 编译打包satellite-client,并安装到本地maven仓库或远程私有仓库。 5. 配置好客户端相关参数,启动客户端即可接入服务端,进行配置管理。 #### 服务端单机模式 修改satellite-server的application.properties配置 ~~~properties ## cluster satellite.server.cluster.enabled=false ~~~ #### 服务端集群模式 修改satellite-server的application.properties配置 ~~~properties ## cluster satellite.server.cluster.enabled=true satellite.server.cluster.load-type=FILE satellite.server.cluster.load-origin=classpath:cluster.properties ~~~ - load-type:集群节点加载类型,目前支持FILE(配置文件形式) / REMOTE(远程接口提供) - load-origin:当type=FILE时,load-origin指的时文件的路径 - cluster.properties示例: ~~~properties address=http://192.168.126.1:6677/satellite@accessKey=satellite&accessSecret=satellite,http://192.168.126.1:6688/satellite@accessKey=satellite&accessSecret=satellite ~~~ #### 客户端配置 Maven依赖 - 因为当前只发布到JitPack仓库所以,还需额外在pom.xml文件中引入仓库地址 ~~~xml jitpack.io https://www.jitpack.io ~~~ - 再引入maven坐标 ~~~xml org.openbyte satellite-client 1.0.0-Beta ~~~ 基础配置: ~~~yaml # 客户端示例配置 spring: profiles: active: dev application: name: config-demo cloud: satellite: config: namespace: 'public' group: 'DEFAULT' name: ${spring.application.name} servers: - 'http://192.168.126.1:6677/satellite' file-extension: 'yaml' # 多个配置 additional: - namespace: 'public' group: 'DEFAULT' name: 'db' fileExtension: 'properties' ~~~ #### 使用说明 ##### 1.灰度发布 输入灰度实例,灰度实例是指[ip]:[port],用英文逗号隔开,输入/可以实现智能提示,直接选择当前配置的监听客户端实例,该配置就会只针对这些实例生效。 ![功能界面](docs/images/func04.png "功能界面") 在灰度发布的列表中,可以选择将灰度配置转为全量发布。 ##### 2.空间隔离与环境隔离 - 原生支持`spring.profiles.active`属性,如果您配置的spring.profiles.active=dev,则对应的配置名称应为[您的配置名]-[spring.profiles.active].[fileExtension] - 支持对namespace的配置来实现不同配置群的隔离,比如说从 `namespace=测试` 迁移到 `namespace=生产` ##### 3.数据库读写分离 由于项目集群,单个数据库读写可能会造成较大压力,因此在集群规模较大的时候可以开启读写分离,配置如下,所有节点的写库必须是同一个。 ~~~properties # sharding jdbc sharding.jdbc.datasource.names=master ## master db sharding.jdbc.datasource.master.type=com.zaxxer.hikari.HikariDataSource sharding.jdbc.datasource.master.driver-class-name=com.mysql.cj.jdbc.Driver sharding.jdbc.datasource.master.jdbc-url=jdbc:mysql://192.168.1.36:3306/satellite?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8&allowMultiQueries=true sharding.jdbc.datasource.master.username=root sharding.jdbc.datasource.master.password=Xzb@19930617 ## slave db #sharding.jdbc.datasource.slave.type=com.zaxxer.hikari.HikariDataSource #sharding.jdbc.datasource.slave.driver-class-name=com.mysql.cj.jdbc.Driver #sharding.jdbc.datasource.slave.jdbc-url=jdbc:mysql://192.168.1.36:3306/satellite?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8&allowMultiQueries=true #sharding.jdbc.datasource.slave.username=root #sharding.jdbc.datasource.slave.password=Xzb@19930617 ## config sharding.jdbc.config.masterslave.load-balance-algorithm-type=round_robin sharding.jdbc.config.masterslave.name=db1s2 sharding.jdbc.config.masterslave.master-data-source-name=master sharding.jdbc.config.masterslave.slave-data-source-names=master ~~~ ##### 4.智能提示 这是本项目比较特别的地方,在编写配置的时候,支持常用的配置智能提示和补全功能,而且可以不断补充 ![功能界面](docs/images/func08.png "功能界面") #### 集群使用事项 1. Satellite Server节点配置了访问令牌和秘钥,则客户端也需要同样配置令牌和秘钥 - 服务端配置示例: ~~~properties ## client satellite.server.client.enable-auth=true satellite.server.client.access-key=mocha satellite.server.client.access-secret=mocha ~~~ - 客户端地址配置示例: ~~~ http://192.168.126.1:6677/satellite@accessKey=satellite&accessSecret=satellite ~~~ 2. 支持spring.profiles.active, 匹配规则:[name]-[spring.profiles.active].[fileExtension] 3. 支持多个配置文件,additional配置下可以配置多个配置文件,配置文件的优先级根据配置顺序 #### 最佳实践 - 集群模式下,建议配置三个以上节点 #### 功能界面 ![功能界面](docs/images/func01.png "功能界面") ![功能界面](docs/images/func02.png "功能界面") ![功能界面](docs/images/func03.png "功能界面") ![功能界面](docs/images/func05.png "功能界面") ![功能界面](docs/images/func06.png "功能界面") ![功能界面](docs/images/func07.png "功能界面") #### 参与贡献 1. 非常欢迎您来参与共建该项目,如果有什么建议和意见也欢迎提出。 2. 您可以 Fork 本仓库、新建 Feat_xxx 分支、提交代码、新建 Pull Request来参与本项目 3. 如果本代码对你有用,欢迎您给个star,谢谢!