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 hbs
   Loaded: 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 ago
 Main PID: 1417 (falcon-graph)
   Memory: 7.0M
   CGroup: /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.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Terry_Tsang

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值