本文主要是介绍open-falcon falcon-api 服务搭建,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
目的
部署 falcon-api
api 提供一系列接口
提供了用户,模板,组件, agent 间的交互
版本修改
modules/api/config/g.go
const (VERSION = "20200818"
)
编译
# make api
go build -o bin/api/falcon-api ./modules/api
创建目录
mkdir /apps/svr/falcon-plus/api/{bin,logs,data,config} -p
配置文件
/apps/svr/falcon-plus/api/config/cfg.json
{"log_level": "info","db": {"faclon_portal": "falcon:falcontest@tcp(ns-yun-020021.133.com:3306)/falcon_portal?charset=utf8&parseTime=True&loc=Local","graph": "falcon:falcontest@tcp(ns-yun-020021.133.com:3306)/graph?charset=utf8&parseTime=True&loc=Local","uic": "falcon:falcontest@tcp(ns-yun-020021.133.com:3306)/uic?charset=utf8&parseTime=True&loc=Local","dashboard": "falcon:falcontest@tcp(ns-yun-020021.133.com:3306)/dashboard?charset=utf8&parseTime=True&loc=Local","alarms": "falcon:falcontest@tcp(ns-yun-020021.133.com:3306)/alarms?charset=utf8&parseTime=True&loc=Local","db_bug": true},"graphs": {"cluster": {"graph-00" : "xx.xxx.xx.21:6070","graph-01" : "xx.xxx.xx.22:6070","graph-02" : "xx.xxx.xx.23:6070","graph-03" : "xx.xxx.xx.24:6070"},"max_conns": 100,"max_idle": 100,"conn_timeout": 1000,"call_timeout": 5000,"numberOfReplicas": 500},"metric_list_file": "/apps/svr/falcon-plus/api/data/metric","web_port": "0.0.0.0:8080","dashboard": "http://falcon-dashboard.133.com/","access_control": true,"salt": "pleaseinputwhichyouareusingnow","skip_auth": false,"default_token": "default-token-used-in-server-side","gen_doc": false,"gen_doc_path": "doc/module.html"
}
启动测试
# /apps/svr/falcon-plus/api/bin/falcon-api -c /apps/svr/falcon-plus/api/config/cfg.json
INFO[0000] graph.Start ok
启动文件
/usr/lib/systemd/system/falcon-api.service
[Unit]
Description=falcon api
After=network-online.target
Before=shutdown.target[Service]
Type=simple
User=apps
Group=apps
LimitNOFILE=65535
ExecStart=/apps/svr/falcon-plus/api/bin/falcon-api -c /apps/svr/falcon-plus/api/config/cfg.json
Restart=always
StandardOutput=journal
启动服务
[root@ns-yun-020026 api]# systemctl daemon-reload
[root@ns-yun-020026 api]# systemctl start falcon-api
[root@ns-yun-020026 api]# systemctl status falcon-api
● falcon-api.service - falcon apiLoaded: loaded (/usr/lib/systemd/system/falcon-api.service; static; vendor preset: disabled)Active: active (running) since Tue 2020-08-18 17:16:55 CST; 3s agoMain PID: 10630 (falcon-api)CGroup: /system.slice/falcon-api.service└─10630 /apps/svr/falcon-plus/api/bin/falcon-api -c /apps/svr/falcon-plus/api/config/cfg.json
Aug 18 17:16:55 ns-yun-020026.133.com systemd[1]: Started falcon api.
Aug 18 17:16:55 ns-yun-020026.133.com systemd[1]: Starting falcon api...
Aug 18 17:16:55 ns-yun-020026.133.com falcon-api[10630]: time="2020-08-18T17:16:55+08:00" level=info msg="graph.Start ok"
这篇关于open-falcon falcon-api 服务搭建的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!