具体详情请参考官方文档 http://book.open-falcon.org/zh_0_2/quick_install/ centos6.8 建议centos7系统 否则后面按照官方文档来是有很多问题的 需要解决Python依赖问题 Python2.7 版本以上,由于centos6.8 pyhton默认版本是 2.6
环境准备
安装redis
yum install -y redis
安装mysql
yum install -y mysql-server #可以选择源码编译安装
注意,请确保redis和MySQL已启动。
初始化MySQL表结构
cd /tmp/ && git clone https://github.com/open-falcon/falcon-plus.git
cd /tmp/falcon-plus/scripts/mysql/db_schema/
mysql -h 127.0.0.1 -u root -p < 1_uic-db-schema.sql
mysql -h 127.0.0.1 -u root -p < 2_portal-db-schema.sql
mysql -h 127.0.0.1 -u root -p < 3_dashboard-db-schema.sql
mysql -h 127.0.0.1 -u root -p < 4_graph-db-schema.sql
mysql -h 127.0.0.1 -u root -p < 5_alarms-db-schema.sql
rm -rf /tmp/falcon-plus/
下载版本包
https://github.com/open-falcon/falcon-plus/releases/download/v0.2.0/open-falcon-v0.2.0.tar.gz
启动后端
配置go语言开发环境
yum install golang -y #需要epel源
go version
go version go1.9.4 linux/amd64
[root@ db_schema]# find / -name go
/etc/alternatives/go
/var/lib/alternatives/go
/usr/bin/go
/usr/lib/golang/pkg/linux_amd64/cmd/go
/usr/lib/golang/pkg/linux_amd64/go
/usr/lib/golang/bin/go
/usr/lib/golang/src/cmd/go #需要这个路劲
/usr/lib/golang/src/go
export GOROOT=/usr/lib/golang
export GOPATH=/usr/local
export FALCON_HOME=/usr/local
export WORKSPACE=$FALCON_HOME/open-falcon
创建工作目录
创建工作目录
export FALCON_HOME=/usr/local
export WORKSPACE=$FALCON_HOME/open-falcon
mkdir -p $WORKSPACE
tar xf open-falcon-v0.2.1.tar.gz -C $WORKSPACE
首先确认配置文件中数据库账号密码与实际相同,否则需要修改配置文件。
cd $WORKSPACE grep -Ilr 3306 ./ | xargs -n1 -- sed -i 's/root:password/real_user:real_password/g'
如
[root@sz_fy_nginx_haproxy_11_147 open-falcon]# cat aggregator/config/cfg.json { "debug": true, "http": { "enabled": true, "listen": "0.0.0.0:6055" }, "database": { "addr": "root:@tcp(127.0.0.1:3306)/falcon_portal?loc=Local&parseTime=true", #默认账户是root 密码为空 修改成对应的账户密码 并在mysql里面授权 "idle": 10, "ids": [1, -1], "interval": 55 }, "api": { "connect_timeout": 500, "request_timeout": 2000, "plus_api": "http://127.0.0.1:8099", "plus_api_token": "default-token-used-in-server-side", "push_api": "http://127.0.0.1:1988/v1/push" } }
mysql> grant all on falcon_portal.* to falcon@'localhost' identified by 'xxx';
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> grant all on graph.* to falcon@'localhost' identified by 'xxx';
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> grant all on alarms.* to falcon@'localhost' identified by 'xxx';
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> grant all on dashboard.* to falcon@'localhost' identified by 'xxx';
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> grant all on uic.* to falcon@'localhost' identified by 'xxx';
Query OK, 0 rows affected, 1 warning (0.00 sec)
cd $WORKSPACE ./open-falcon start # 检查所有模块的启动状况 ./open-falcon check
更多的命令行工具用法
# ./open-falcon [start|stop|restart|check|monitor|reload] module ./open-falcon start agent ./open-falcon check falcon-graph UP 53007 falcon-hbs UP 53014 falcon-judge UP 53020 falcon-transfer UP 53026 falcon-nodata UP 53032 falcon-aggregator UP 53038 falcon-agent UP 53044 falcon-gateway UP 53050 falcon-api UP 53056 falcon-alarm UP 53063 For debugging , You can check $WorkDir/$moduleName/log/logs/xxx.log
安装前端,这里选择在一台机器上面部署
cd $WORKSPACE
git clone https://github.com/open-falcon/dashboard.git
安装依赖包
yum install -y python-virtualenv
yum install -y python-devel
yum install -y openldap-devel
#yum install -y mysql-devel
yum groupinstall "Development tools"
cd $WORKSPACE/dashboard/
virtualenv ./env
./env/bin/pip install -r pip_requirements.txt -i https://pypi.douban.com/simple #centos6上面执行是通不过的 ,解决办法 升级Python2.7 (暂未验证,不建议随便升级系统Python版本,会影响系统稳定性) 或者如下操作
解决
wget --no-check-certificate https://bootstrap.pypa.io/ez_setup.py
python ez_setup.py --insecure
wget https://pypi.python.org/packages/11/b6/abcb525026a4be042b486df43905d6893fb04f05aac21c32c638e939e447/pip-9.0.1.tar.gz
[root@open-falcon-server dashboard]# tar xf pip-9.0.1.tar.gz
[root@open-falcon-server dashboard]# cd pip-9.0.1
[root@open-falcon-server pip-9.0.1]# python setup.py install
[root@open-falcon-server dashboard]# pip install -r pip_requirements.txt
Running setup.py install for python-dateutil ... done
Running setup.py install for python-ldap ... done
Successfully installed Babel-2.5.3 Flask-0.10.1 Flask-Babel-0.9 Jinja2-2.7.2 Werkzeug-0.9.4 gunicorn-19.1.1 itsdangerous-0.24 markupsafe-1.0 python-dateutil-2.2 python-ldap-2.5.2 pytz-2018.4 requests-2.3.0 six-1.11.0 speaklater-1.3
修改配置
dashboard的配置文件为: 'rrd/config.py',请根据实际情况修改
## API_ADDR 表示后端api组件的地址
API_ADDR = "http://127.0.0.1:8080/api/v1"
## 根据实际情况,修改PORTAL_DB_*, 默认用户名为root,默认密码为""
## 根据实际情况,修改ALARM_DB_*, 默认用户名为root,默认密码为""
以开发者模式启动
./env/bin/python wsgi.py
open http://127.0.0.1:8081 in your browser.
在生产环境启动
bash control start
open http://127.0.0.1:8081 in your browser.
停止dashboard运行
bash control stop
查看日志
bash control tail
访问测试 ip:8081
dashbord没有默认创建任何账号包括管理账号,需要你通过页面进行注册账号。
想拥有管理全局的超级管理员账号,需要手动注册用户名为root的账号(第一个帐号名称为root的用户会被自动设置为超级管理员)。
超级管理员可以给普通用户分配权限管理。