All Projects → LeechanX → sona

LeechanX / sona

Licence: MIT license
简单的、高可用、高效的基于共享内存的分布式配置中心,集中式管理各类后台配置,配置修改实时推送,且业务API相当简单(两行搞定,一个init+一个get,见readme),已轻量级支持Golang/C++/Java/Python等语言API

Programming Languages

go
31211 projects - #10 most used programming language
java
68154 projects - #9 most used programming language
Smarty
1635 projects
python
139335 projects - #7 most used programming language
C++
36643 projects - #6 most used programming language
c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to sona

Ini Parser
Read/Write an INI file the easy way!
Stars: ✭ 643 (+1637.84%)
Mutual labels:  config-management
Assh
💻 make your ssh client smarter
Stars: ✭ 2,340 (+6224.32%)
Mutual labels:  config-management
standalone-configuration-management
Basic examples of how to use each of chef, puppet, salt and ansible as standalone configuration management systems.
Stars: ✭ 14 (-62.16%)
Mutual labels:  config-management
Config Rs
⚙️ Layered configuration system for Rust applications (with strong support for 12-factor applications).
Stars: ✭ 915 (+2372.97%)
Mutual labels:  config-management
Apollo.net
Apollo配置中心.Net客户端
Stars: ✭ 165 (+345.95%)
Mutual labels:  config-management
Config
📝 Go config manage(load,get,set). support JSON, YAML, TOML, INI, HCL, ENV and Flags. Multi file load, data override merge, parse ENV var. Go应用配置加载管理,支持多种格式,多文件加载,远程文件加载,支持数据合并,解析环境变量名
Stars: ✭ 225 (+508.11%)
Mutual labels:  config-management
Diablo
分布式配置管理平台(Distributed Configuration Management Platform)
Stars: ✭ 336 (+808.11%)
Mutual labels:  config-management
apollo.net
Apollo配置中心.Net客户端
Stars: ✭ 449 (+1113.51%)
Mutual labels:  config-management
Foreman
an application that automates the lifecycle of servers
Stars: ✭ 2,102 (+5581.08%)
Mutual labels:  config-management
build-a-platform-with-krm
Build a platform with the Kubernetes resource model!
Stars: ✭ 55 (+48.65%)
Mutual labels:  config-management
Ansible Role Conjur
Grants Conjur machine identity to hosts
Stars: ✭ 12 (-67.57%)
Mutual labels:  config-management
Jazigo
Jazigo is a tool written in Go for retrieving configuration for multiple devices, similar to rancid, fetchconfig, oxidized, Sweet.
Stars: ✭ 163 (+340.54%)
Mutual labels:  config-management
Mgmt
Next generation distributed, event-driven, parallel config management!
Stars: ✭ 2,708 (+7218.92%)
Mutual labels:  config-management
Apollo
Apollo is a reliable configuration management system suitable for microservice configuration management scenarios.
Stars: ✭ 26,052 (+70310.81%)
Mutual labels:  config-management
coqpit
Simple but maybe too simple config management through python data classes. We use it for machine learning.
Stars: ✭ 67 (+81.08%)
Mutual labels:  config-management
Tasmotizer
ESP... The time has come to... Tasmotize!
Stars: ✭ 631 (+1605.41%)
Mutual labels:  config-management
Bundlewrap
Config management with Python
Stars: ✭ 196 (+429.73%)
Mutual labels:  config-management
theconf
Python Package for Managing Configurations
Stars: ✭ 35 (-5.41%)
Mutual labels:  config-management
kerrigan
基于Tornado实现的一套配置中心,可基于分项目、环境管理配置,语法高亮、对比历史版本、快速回滚等,并提供Restful风格的API
Stars: ✭ 57 (+54.05%)
Mutual labels:  config-server
vyper
Python configuration with (more) fangs
Stars: ✭ 121 (+227.03%)
Mutual labels:  config-management

Sona

Sona是一个go语言实现的高效、实时、高可用的linux分布式配置中心,轻量级支持(Golang/C++/Java/Python)主流编程语言接口

    ___  ___  _ __   __ _ 
   / __|/ _ \| '_ \ / _` |
   \__ \ (_) | | | | (_| |   
   |___/\___/|_| |_|\__,_|   

特点

sona配置中心采用了经典一中心(broker)多agent的分布式架构,基于共享内存下发、存储各节点所需配置,为业务提供KV方式访问(最新)配置

  • 高度可用:agent即使挂掉也不影响已有业务读配置,而broker以keepalived组件保证其高可用
  • 一致性:broker采用主备模式,仅主对外服务,正常情况下保证数据完全一致; 仅在主备切换时可能有短时间最新数据的延迟。总体而言实现了数据的最终一致性
  • 实时更新:正常情况下,数据实时更新到各节点;仅在主备切换时刻,可能有短时间的数据延迟
  • API简单:无配置文件概念,故业务无需关心配置文件解析; 数据实时更新对业务完全透明,业务无需编写配置更新的回调函数

USAGE

提供C/C++/Java/Python/Golang多语言支持,基于protobuf-2.6.1

go语言:

import "sona/api"

configApi, err := api.GetApi("nba.player.info") //获取nba.player.info服务的配置
if err == nil {
    defer configApi.Close()

    value := configApi.Get("lebron-james","number") //获取lebron-james.number值 (string)

    list := configApi.GetList("lebron-james","friends") //获取lebron-james.friends值列表 ([]string)
}

C++: 见目录api/cpp

#include "sona_api.h"

sona_api* api = init_api("nba.player.info"); //获取nba.player.info服务的配置
if api != NULL {
    string value = api->get("lebron-james", "number"); //获取lebron-james.number值 (string)
    vector<string> list = api->get_list("lebron-james","friends"); //获取lebron-james.friends值列表 (vector<string>)
}

Java: jar包在api/java/sona_api/lib/sona_api.jar,源码见api/java/sona_api/src

import org.sona.api.SonaApi;

SonaApi api = null;
try {
    api = new SonaApi("lebron.james.info"); //获取lebron.james.info服务的配置
} catch (Exception e) {
}

if (api != null) {
    String value = api.Get("player", "number"); //获取player.number值 (string)
    System.out.println(value);
    ArrayList<String> list = api.GetList("friends", "list"); //获取friends.list值列表 (ArrayList<string>)
    for (String item: list) {
        System.out.println(item);
    }
}

Python: python2.7、python3.6兼容的代码(如果要使用python3,请重新编译protocol/base_protocol.proto并将产生的base_protocol_pb2.py替换到api/python/sona目录下)

from sona import api

try:
    api = api.SonaApi("lebron.james.info")
except Exception as e:
    api = None
    print(e)
    
if api:
    print(api.get("player", "team")) #获取player.number值 (string)
    print(api.get_list("friends", "list")) #获取friends.list值列表 (List<string>)

原理介绍

arch

  • broker做数据中心管控,管理配置数据的增、改、订阅、下发,使用keepalived做高可用
  • agent做各节点配置代理,管理下发到各个节点的配置、业务订阅配置等
  • 共享内存是sona核心结构,agent实际在这里管理配置,业务实际也从这里读取最新配置

数据介绍 data readme

共享内存模型与agent、api mem readme

broker介绍 broker readme

安装

依赖:

1、mongoDB(可单点,但建议主备)

2、keepalived(可不安装,如果不在意broker单点的话)

安装流程:

1、将本项目git clone到您的$GOPATH

2、进入$GOPATH/sona目录下

3、执行make进行编译,所有可执行文件sona_agent、sona_broker将产生在bin目录下

4、编辑broker配置文件(示例在broker/conf/目录下),后执行bin/sona_broker -c 配置文件路径启动broker

5、编辑agent配置文件(示例在agent/conf/目录下),后执行bin/sona_agent -c 配置文件路径启动agent

6、编辑web server配置文件(admin/conf/app.conf),在admin目录下执行./sona_web_server,运行配置的web管理端

本人不擅长web编程,所以页面有点丑......

访问127.0.0.1:8080端口,结果为service配置查询入口 index

新增service key的界面 add

编辑某service配置的界面 edit

7、所有语言的api位于api目录下,自行使用即可

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].