Skip to content

Commit

Permalink
doc: add hot reload cfg close #36
Browse files Browse the repository at this point in the history
  • Loading branch information
Ehco1996 committed Sep 5, 2021
1 parent c1822ca commit 967886a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
23 changes: 21 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ go get -u "github.com/Ehco1996/ehco/cmd/ehco"
* 从远程启动
* benchmark
* grafana 监控报警
* 热重载配置

## 使用说明

Expand Down Expand Up @@ -99,11 +100,30 @@ go get -u "github.com/Ehco1996/ehco/cmd/ehco"
}
```

### 热重载配置

> 大于 1.1.0 版本的 ehco 支持热重载配置
```sh
# 使用配置文件启动 ehco
ehco -c config.json

# 更新配置文件后可以使用 kill -HUP pid 命令来重新加载配置
kill -HUP pid

# 重载成功可以看到如下信息
[cfg-reload] Got A HUP Signal! Now Reloading Conf ...
[cfg] Load Config From file:config.json
[cfg-reload] starr new relay name=[At=127.0.0.1:12342 Over=raw TCP-To=[0.0.0.0:5201] UDP-To=[0.0.0.0:5201] Through=raw]
[relay] Close relay [At=127.0.0.1:1234 Over=raw TCP-To=[0.0.0.0:5201] UDP-To=[0.0.0.0:5201] Through=raw]
[relay] Start UDP relay [At=127.0.0.1:12342 Over=raw TCP-To=[0.0.0.0:5201] UDP-To=[0.0.0.0:5201] Through=raw]
[relay] Start TCP relay [At=127.0.0.1:12342 Over=raw TCP-To=[0.0.0.0:5201] UDP-To=[0.0.0.0:5201] Through=raw]
```

## 监控报警

* dashboard 和 prometheus 规则可以从`monitor`文件夹下找到,可以自行导入


* 类似 Smokeing Ping 的延迟监控

![](monitor/ping.png)
Expand All @@ -112,7 +132,6 @@ go get -u "github.com/Ehco1996/ehco/cmd/ehco"

![](monitor/traffic.png)


## Benchmark(Apple m1)

iperf:
Expand Down
2 changes: 1 addition & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

"relay_configs": [
{
"listen": "127.0.0.1:1234",
"listen": "127.0.0.1:12342",
"listen_type": "raw",
"transport_type": "raw",
"tcp_remotes": ["0.0.0.0:5201"],
Expand Down
3 changes: 1 addition & 2 deletions internal/constant/constant.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import "time"
var (
DefaultDeadline = 30 * time.Second

Version = "1.0.7"
Version = "1.1.0"
GitBranch string
GitRevision string
BuildTime string
Expand Down Expand Up @@ -47,5 +47,4 @@ const (

BUFFER_POOL_SIZE = 128 // 128 * 4kb
BUFFER_SIZE = 4 * 1024 // 4kb

)

0 comments on commit 967886a

Please sign in to comment.