Skip to content

zhxia/go-disconf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

go-disconf

  • 基于golang 与 redis开发
  • 通过redis的pubsub特性

具体工作流程

  • server 与 agent分别通过redis的订阅消息机制进行通讯
  • server端下发配置,经过redis广播到所有的agent
  • agent端连接redis,接收redis的广播消息,并解析命令,执行响应的操作。
  • agent在命令执行完毕时,会上报的机器ip信息与本次下发操作进行关联,并每隔一段时间发送心跳信息

构建

  • 通过gb 进行编译: gb build

运行

  • 启动redis Server

    redis-server -h 192.168.33.200 -p 6379

  • 启动server端:

    ./server -r 192.168.33.200:6379 -h 192.168.33.100:8487

  • 启动agent端:

    ./agent -r 192.168.33.200:6379 -d /data/config

  • 下发配置:

    curl -X post --data '{"sid":"8113197b-c4cc-4cf8-830e-8257bbc8b59d","dest":"/data/config/service-mm2.conf","data":"{"servers":[{"host":"127.0.0.1","port":10010,"weigth":20,"status":"online"},{"host":"127.0.0.2","port":10010,"weigth":20,"status":"online"}]}"}' http://192.168.33.100:8487/sendMessage

About

go-disconf based on golang and redis

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages