1. 程式人生 > >Centos7 7.5 1804 安裝Open-falcon 0.2.1

Centos7 7.5 1804 安裝Open-falcon 0.2.1

1.下載安裝wget

yum install -y wget

2.升級所有安裝包

yum   -y  update

3.安裝git

yum -y install git

gie version

安裝結束後檢視git版本 git >=  1.7.5

4.安裝go語言環境

yum -y install epel-release yum -y install golang

go version 

安裝結束後檢視go版本   go > 1.6

5.安裝redis

yum -y install redis

啟動redis

systemctl  start  redis

建立開機啟動

systemctl  enable redis

檢視redis狀態

systemctl status redis

6.安裝mysql

 下載安裝repo源 :wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm

                          rpm -ivh mysql-community-release-el7-5.noarch.rpm

安裝mysql

 yum -y  install mysql-server 

啟動mysql 

systemctl start mysql

檢視mysql狀態

systemctl  status mysql

設定環境變數GOROOT和GOPATH

export GOROOT=/usr/lib/golang

export GOPATH=/home

7.在github get open-falcon原始碼

建立GOPATH下的本地路徑

mkdir -p $GOPATH/src/github.com/open-falcon

cd $GOPATH/src/github.com/open-falcon

將原始碼get  $GOPATH/src/github.com/open-falcon

git clone https://github.com/open-falcon/falcon-plus.git

初始化資料庫

cd $GOPATH/src/github.com/open-falcon/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

root使用者沒有密碼 可直接回車

編譯並打包

cd $GOPATH/src/github.com/open-falcon/falcon-plus/

go get github.com/open-falcon/rrdlite

make all

make pack

部署後端

建立目錄

export WORKSPACE=/home/work

mkdir -p $WORKSPACE

解壓二進位制安裝包

cd $GOPATH/src/github.com/open-falcon/falcon-plus/

tar xf open-falcon-v0.2.1.tar.gz -C $WORKSPACE

修改配置檔案cfg.json

模組 配置檔案所在路徑
aggregator    /home/work/aggregator/config/cfg.json
graph /home/work/graph/config/cfg.json
hbs /home/work/hbs/config/cfg.json
nodata /home/work/nodata/config/cfg.json
api /home/work/api/config/cfg.json
alarm /home/work/alarm/config/cfg.json

啟動後端模組

cd $WORKSPACE

./open-falcon start

檢查各個模組啟動狀態

./open-falcon check

部署後端模組

export FRONTSPACE=/home/front/open-falcon

mkdir -p $FRONTSPACE

獲取前端程式碼

cd $FRONTSPACE

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" -y

cd $FRONTSPACE/dashboard/ virtualenv ./env

./env/bin/pip install -r pip_requirements.txt

開啟防火牆8081埠

firewall-cmd --add-port=8081/tcp --permanent

重新載入防火牆配置

firewall-cmd --reload

在生產環境啟動

bash control start

在開發環境啟動

./env/bin/python wsgi.py