本文主要是介绍open-falcon graph 部署,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
目的
搭建 graph 服务
作用
graph是存储绘图数据的组件
graph组件 接收transfer组件推送上来的监控数据
处理query组件的查询请求、返回绘图数据
依赖
mysql db
编译
版本修改
modules/graph/g/g.go
const (VERSION = "20200818"
)
编译
# make graph
go build -o bin/graph/falcon-graph ./modules/graph
graph 服务器搭建
创建目录
mkdir /apps/svr/falcon-plus/graph/{bin,config,logs} -p
配置文件
/apps/svr/falcon-plus/graph/config/cfg.json
{"debug": false,"http": {"enabled": true,"listen": "0.0.0.0:6071"},"rpc": {"enabled": true,"listen": "0.0.0.0:6070"},"rrd": {"storage": "/data/graph/6070"},"db": {"dsn": "falcon:falcontest@tcp(ns-yun-020021.133.com:3307)/graph?loc=Local&parseTime=true","maxIdle": 4},"callTimeout": 5000,"migrate": {"enabled": false,"concurrency": 2,"replicas": 500,"cluster": {"graph-00" : "xx.xx.xx.21:6070","graph-01" : "xx.xx.xx.22:6070","graph-02" : "xx.xx.xx.23:6070","graph-03" : "xx.xx.xx.24:6070"}}
}
目录结构说明
# pwd
/apps/svr/falcon-plus/graph
# tree
.
├── bin
│ └── falcon-graph 启动文件
├── config
│ └── cfg.json 配置文件
└── logs
启动测试
# /apps/svr/falcon-plus/graph/bin/falcon-graph -c /apps/svr/falcon-plus/graph/config/cfg.json
2020/08/18 13:20:10 debug.go:45: [GIN-debug] [WARNING] Running in "debug" mode. Switch to "release" mode in production.- using env: export GIN_MODE=release- using code: gin.SetMode(gin.ReleaseMode)
2020/08/18 13:20:10 debug.go:45: [GIN-debug] GET /api/v2/health --> github.com/open-falcon/falcon-plus/modules/graph/http.configCommonRoutes.func1 (3 handlers)
2020/08/18 13:20:10 debug.go:45: [GIN-debug] GET /api/v2/version --> github.com/open-falcon/falcon-plus/modules/graph/http.configCommonRoutes.func2 (3 handlers)
2020/08/18 13:20:10 debug.go:45: [GIN-debug] GET /api/v2/workdir --> github.com/open-falcon/falcon-plus/modules/graph/http.configCommonRoutes.func3 (3 handlers)
2020/08/18 13:20:10 debug.go:45: [GIN-debug] GET /api/v2/config --> github.com/open-falcon/falcon-plus/modules/graph/http.configCommonRoutes.func4 (3 handlers)
2020/08/18 13:20:10 debug.go:45: [GIN-debug] POST /api/v2/config/reload --> github.com/open-falcon/falcon-plus/modules/graph/http.configCommonRoutes.func5 (3 handlers)
2020/08/18 13:20:10 debug.go:45: [GIN-debug] GET /api/v2/stats/graph-queue-size --> github.com/open-falcon/falcon-plus/modules/graph/http.configCommonRoutes.func6 (3 handlers)
2020/08/18 13:20:10 debug.go:45: [GIN-debug] GET /counter/all --> github.com/open-falcon/falcon-plus/modules/graph/http.configProcRoutes.func1 (3 handlers)
2020/08/18 13:20:10 debug.go:45: [GIN-debug] GET /index/updateAll --> github.com/open-falcon/falcon-plus/modules/graph/http.configIndexRoutes.func1 (3 handlers)
2020/08/18 13:20:10 debug.go:45: [GIN-debug] GET /index/updateAll/concurrent --> github.com/open-falcon/falcon-plus/modules/graph/http.configIndexRoutes.func2 (3 handlers)
2020/08/18 13:20:10 debug.go:45: [GIN-debug] POST /api/v2/index --> github.com/open-falcon/falcon-plus/modules/graph/http.configIndexRoutes.func3 (3 handlers)
2020/08/18 13:20:10 cfg.go:90: g.ParseConfig ok, file /apps/svr/falcon-plus/graph/config/cfg.json
2020/08/18 13:20:10 db.go:26: g.InitDB ok
2020/08/18 13:20:10 rrdtool.go:55: rrdtool.Start ok
2020/08/18 13:20:10 main.go:22: 1364 register signal notify
2020/08/18 13:20:10 rpc.go:54: rpc.Start ok, listening on 0.0.0.0:6070
^C2020/08/18 13:20:26 main.go:27: recv interrupt
2020/08/18 13:20:26 main.go:31: graceful shut down
2020/08/18 13:20:26 main.go:36: http stop ok
2020/08/18 13:20:26 rpc.go:86: rpc, recv sigout and exiting...
2020/08/18 13:20:26 main.go:42: rpc stop ok
启动服务配置
/usr/lib/systemd/system/falcon-graph.service
[Unit]
Description=falcon hbs
After=network-online.target
Before=shutdown.target[Service]
Type=simple
User=apps
Group=apps
LimitNOFILE=65535
ExecStart=/apps/svr/falcon-plus/graph/bin/falcon-graph -c /apps/svr/falcon-plus/graph/config/cfg.json
Restart=always
StandardOutput=journal
启动
[root@ns-yun-020021 config]# systemctl daemon-reload
[root@ns-yun-020021 config]# systemctl start falcon-graph
[root@ns-yun-020021 config]# systemctl status falcon-graph
● falcon-graph.service - falcon hbsLoaded: loaded (/usr/lib/systemd/system/falcon-graph.service; static; vendor preset: disabled)Active: active (running) since Tue 2020-08-18 13:22:17 CST; 2s agoMain PID: 1417 (falcon-graph)Memory: 7.0MCGroup: /system.slice/falcon-graph.service└─1417 /apps/svr/falcon-plus/graph/bin/falcon-graph -c /apps/svr/falcon-plus/graph/config/cfg.json
Aug 18 13:22:17 ns-yun-020021.133.com falcon-graph[1417]: 2020/08/18 13:22:17 debug.go:45: [GIN-debug] GET /api/...ers)
Aug 18 13:22:17 ns-yun-020021.133.com falcon-graph[1417]: 2020/08/18 13:22:17 debug.go:45: [GIN-debug] GET /coun...ers)
Aug 18 13:22:17 ns-yun-020021.133.com falcon-graph[1417]: 2020/08/18 13:22:17 debug.go:45: [GIN-debug] GET /inde...ers)
Aug 18 13:22:17 ns-yun-020021.133.com falcon-graph[1417]: 2020/08/18 13:22:17 debug.go:45: [GIN-debug] GET /inde...ers)
Aug 18 13:22:17 ns-yun-020021.133.com falcon-graph[1417]: 2020/08/18 13:22:17 debug.go:45: [GIN-debug] POST /api/...ers)
Aug 18 13:22:17 ns-yun-020021.133.com falcon-graph[1417]: 2020/08/18 13:22:17 cfg.go:90: g.ParseConfig ok, file /ap...json
Aug 18 13:22:17 ns-yun-020021.133.com falcon-graph[1417]: 2020/08/18 13:22:17 db.go:26: g.InitDB ok
Aug 18 13:22:17 ns-yun-020021.133.com falcon-graph[1417]: 2020/08/18 13:22:17 rrdtool.go:55: rrdtool.Start ok
Aug 18 13:22:17 ns-yun-020021.133.com falcon-graph[1417]: 2020/08/18 13:22:17 main.go:22: 1417 register signal notify
Aug 18 13:22:17 ns-yun-020021.133.com falcon-graph[1417]: 2020/08/18 13:22:17 rpc.go:54: rpc.Start ok, listening on...6070
Hint: Some lines were ellipsized, use -l to show in full.
这篇关于open-falcon graph 部署的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!