Open-falcon 安裝部署手冊
阿新 • • 發佈:2019-05-05
ls -l epel源 targe lin monitor system ESS lib brush
搭建環境
OS: RHEL 7.3 kernel: 3.10.0-514.el7.x86_64 host0: 10.16.112.128 <-> rhel-node01 host1: 10.16.112.253 <-> rhel-node02 host2: 10.16.112.247 <-> rhel-node03 # 安裝epel源 wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo echo 7 > /etc/yum/vars/releasever
基礎環境
安裝 go
因為官方yum和阿裏yum都沒有go的安裝包,故只能通過fedora的epel倉庫來安裝
# yum install -y epel-release # yum install golang -y # 驗證 # go version go version go1.8.3 linux/amd64
安裝redis
# yum install redis -y # 開機啟動redis # systemctl enable redis # 啟動redis # systemctl start redis # 查看redis狀態 # systemctl status redis
安裝mysql-server
# 安裝mysql源 # wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm # rpm -ivh mysql-community-release-el7-5.noarch.rpm # yum install -y mysql-server # 啟動mysql # systemctl start mysql # 開機啟動mysql # systemctl enable mysql # 查看mysql 狀態 # systemctl status mysql
這裏若沒有配置mysql源則會安裝mariadb ,故需先卸載yum remove mariadb -y
安裝git
# yum install git -y
獲取falcon源碼
# git clone https://github.com/open-falcon/falcon-plus.git
初始化數據庫
# cd /opt/src/falcon-plus-master/scripts/mysql/db_schema [[email protected] db_schema]# mysql -h 127.0.0.1 -u root -p < 1_uic-db-schema.sql Enter password: [[email protected] db_schema]# mysql -h 127.0.0.1 -u root -p < 2_portal-db-schema.sql Enter password: [[email protected] db_schema]# mysql -h 127.0.0.1 -u root -p < 3_dashboard-db-schema.sql Enter password: [[email protected] db_schema]# mysql -h 127.0.0.1 -u root -p < 4_graph-db-schema.sql Enter password: [[email protected] db_schema]# mysql -h 127.0.0.1 -u root -p < 5_alarms-db-schema.sql Enter password: # 驗證 [[email protected] db_schema]# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 7 Server version: 5.6.39 MySQL Community Server (GPL) Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement. mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | alarms | | dashboard | | falcon_portal | | graph | | mysql | | performance_schema | | uic | +--------------------+ 8 rows in set (0.00 sec) mysql>
安裝falcon
編譯 falcon
# vim ~/.bash_profile export GOROOT=/usr/lib/golang export GOPATH=/opt/pkg # mkdir -p $GOPATH/src/github.com/open-falcon # git clone https://github.com/open-falcon/falcon-plus.git Cloning into ‘falcon-plus‘... remote: Counting objects: 8158, done. remote: Compressing objects: 100% (33/33), done. remote: Total 8158 (delta 7), reused 18 (delta 5), pack-reused 8120 Receiving objects: 100% (8158/8158), 15.46 MiB | 445.00 KiB/s, done. Resolving deltas: 100% (4221/4221), done. # cd $GOPATH/src/github.com/open-falcon/falcon-plus/ # make all modules # make all go build -o bin/agent/falcon-agent ./modules/agent go build -o bin/aggregator/falcon-aggregator ./modules/aggregator go build -o bin/graph/falcon-graph ./modules/graph go build -o bin/hbs/falcon-hbs ./modules/hbs go build -o bin/judge/falcon-judge ./modules/judge go build -o bin/nodata/falcon-nodata ./modules/nodata go build -o bin/transfer/falcon-transfer ./modules/transfer go build -o bin/gateway/falcon-gateway ./modules/gateway go build -o bin/api/falcon-api ./modules/api go build -o bin/alarm/falcon-alarm ./modules/alarm go build -ldflags "-X main.GitCommit=`git rev-parse --short HEAD` -X main.Version=0.2.1" -o open-falcon # make pack go build -ldflags "-X main.GitCommit=`git rev-parse --short HEAD` -X main.Version=0.2.1" -o open-falcon tar -C out -zcf open-falcon-v0.2.1.tar.gz . # ls -l $GOPATH/src/github.com/open-falcon/falcon-plus/ | grep *.tar.gz -rw-r--r--. 1 root root 40059905 Mar 8 11:43 open-falcon-v0.2.1.tar.gz
部署後端
# cd $GOPATH/src/github.com/open-falcon/falcon-plus/ # tar -xzvf open-falcon-v0.2.1.tar.gz -C $WORKSPACE # 修改對應mysql的密碼, 若無密碼則去掉password即可 # find . -name cfg.json ./agent/config/cfg.json ./aggregator/config/cfg.json ./graph/config/cfg.json ./hbs/config/cfg.json ./judge/config/cfg.json ./nodata/config/cfg.json ./transfer/config/cfg.json ./gateway/config/cfg.json ./api/config/cfg.json ./alarm/config/cfg.json ##------------- 對應mysql連接 ------------- "database": { "addr": "root:[PASSWD]@tcp(127.0.0.1:3306)/falcon_portal?loc=Local&parseTime=true", "idle": 10, "ids": [1, -1], "interval": 55 } # 啟動falcon # ./open-falcon start [falcon-graph] 3639 [falcon-hbs] 3647 [falcon-judge] 3656 [falcon-transfer] 3662 [falcon-nodata] 3668 [falcon-aggregator] 3675 [falcon-agent] 3683 [falcon-gateway] 3690 [falcon-api] 3696 [falcon-alarm] 3708 # 查看狀態 # ./open-falcon check falcon-graph UP 3639 falcon-hbs UP 3647 falcon-judge UP 3656 falcon-transfer UP 3662 falcon-nodata UP 3668 falcon-aggregator UP 3675 falcon-agent UP 3683 falcon-gateway UP 3690 falcon-api UP 3696 falcon-alarm UP 3708
部署前端
# mkdir -p $FRONTSPACE # cd $FRONTSPACE # git clone https://github.com/open-falcon/dashboard.git Cloning into ‘dashboard‘... remote: Counting objects: 1044, done. remote: Total 1044 (delta 0), reused 0 (delta 0), pack-reused 1044 Receiving objects: 100% (1044/1044), 1.43 MiB | 281.00 KiB/s, done. Resolving deltas: 100% (564/564), done. # 安裝依賴 # yum install -y python-virtualenv python-devel openldap-devel mysql-devel # yum groupinstall "Development tools" -y # cd $FRONTSPACE/dashboard/ # virtualenv ./env # 安裝所需依賴庫 ./env/bin/pip install -r pip_requirements.txt # 啟動 # bash control start falcon-dashboard started..., pid=1654
falcon 登錄配置
URL: http://{IP}:8081
falcon無默認用戶,可使用頁面圖形化方式註冊用戶登錄
集成grafana
grafana下載: http://grafana.org
# grafana解壓 # tar xvf grafana-5.0.0.linux-x64.tar.gz -C /opt/app/ # 修改grafana配置 # cp sample.ini grafana.ini # get code # cd ~ # git clone https://github.com/open-falcon/grafana-openfalcon-datasource.git # 安裝插件 # mv ~/grafana-openfalcon-datasource /opt/grafana/data/plugins # 啟動grafana ${GRAFANA_PATH_Installed}/bin/grafana-server
參考: https://github.com/open-falcon/grafana-openfalcon-datasource
Open-falcon 安裝部署手冊