Giter Club home page Giter Club logo

activedrouter's Introduction

ActiveRouter简介  

当前版本: Beta 0.1 by usher.yue

Email: [email protected]

正在努力开发中........


简单介绍

一、通过ActivedRouter可以实现什么功能?

1、可以集群服务器的监控,通过提供的web Dashboard可以时刻监控每一台服务器的负载、内存、网络、
磁盘等信息。
      
2、反向代理服务器功能,例如Nginx的功能,可以针对不同的域名对不同的业务服务器集群进行反向代理。
    
3、Server & Client 模式组合下,可以用作服务器监控使用,Server端可以监控Dashboard,用于直观的web界面监控。
    
4、反向代理支持 Random 和 Alived 模式,默认Random模式,Alived模式需要在客户端运行Client模式的服务进行数据上报。
    
5、快速配置反向代理服务,省去配置nginx反向代理的麻烦步骤,一般流量下的负载足以应付。 

二、快速入门


2.1、编译安装

Windows平台依赖:  
 
go get github.com/go-ole/go-ole  

go get github.com/go-ole/go-ole/oleutil  

go get github.com/StackExchange/wmi 
 	  
go get github.com/shirou/w32  
 
go build main.go

2.2、实现功能

三、工作模式和配置文件

3.1、http反向代理模式(Reserve Proxy),等同nginx的反向代理

运行命令: ActivedRouter --runmode=client	     运行client 模式
运行命令: ActivedRouter --runmode=server	     运行server 模式
运行命令: ActivedRouter --runmode=reserveproxy 运行反向代理模式(支持reserveproxy&server)		

配置文件:

{	
	"http_switch":"on",           //http开关 on off
	"proxy_addr":"127.0.0.1:80",  //http监听端口
	"proxy_method":"random",      //proxy方法 random 混合模式下可支持alived方法
	"https_switch":"off",        //是否开启https  on开启https 支持
	"https_crt":"a.crt",         //https证书
	"https_key":"a.key",         //https key
	"https_proxy_addr":"127.0.0.1:443",//https监听地址
	"reserve_proxy":[
		{
			"domain":"1.12xue.com",
			"clients":[
			    {
				   "host":"12xuetest.com",
				   "port":"80"	
		        }
			]
		},
		{
			"domain":"2.12xue.com",
			"clients":[
			    {
				   "host":"12xuedev.com",
				   "port":"80"	
		        }
			]
		},
		{
				"domain":"proxy.12xue.com",
				"clients":[
			 	   {
					   "host":"goapi.com",
					   "port":"80"	
	  		  	    }
				]
		}
	
	]
}

3.2、server和client模式可以配合完全服务器监控,提供web仪表盘。

客户端运行: ActivedRouter --runmode=client

相关配置文件client.json

	{
		"domain":"wwww.xxx.com",  //客户端服务器的域名可空
		"cluster":"UIA集群",		  //服务器集群的标志 可自定义
		"router_list":[          //要连接的远程路由服务器列表
		"127.0.0.1:8888",
		"172.16.200.202:9999"
		]
   }    

服务器运行: ActivedRouter --runmode=server  

相关配置文件server.json

{
	"host":"127.0.0.1",
	"port":"8888",
	"srvmode":"router",
	"httphost":"127.0.0.1",
	"httpport":"8080"
}

4.3、服务器监控模式触发脚本(完善中)

当监控服务器下,路由服务器开启srvmode=moniter之后才会触发

{   
		"script":[
	{
			"host":"127.0.0.1",
			"hookscript":[
				{
					"eventtarget":"disk",
					"attr":"used",
					"gt":"15",
					"callback":"ls"
				},
				{
					"eventtarget":"load",
					"attr":"load",
					"gt":"1.5",
					"callback":"ls"
				},
				{
					"eventtarget":"mem",
					"attr":"used",
					"gt":"75",
					"callback":"netstat -ant"
				}
			]
		}
	]
}

运行模式

服务器模式和客户端模式

运行模式 介绍
Client 在客服端模式下通告服务器当前服务状态
1、 启动挂在到路由服务器 可以挂在到一个至个服务器上。
2、 实时通告路由服务器当前服务器信息,用作路由分析。
Server 在服务器模式下监听客户端的状态
1、 监听客户端模式下的服务器的服务状态
ReserveProxy 内网集群配置反向代理功能,并提供简单的监控服务
## 后期提供api服务器监控功能可以实时返回各服务器状态
监控功能 介绍
虚拟内存 时刻监控服务器的虚拟内存
load average 时刻监控服务器的负载状态
网络连接 时刻监控服务器的网络连接状态
CPU使用率 时刻监控CPU的使用率
磁盘状态 时刻监控服务器的磁盘存储容量

activedrouter's People

Contributors

usheryue avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.