1. 程式人生 > >部署Open-Falcon-0.2.1

部署Open-Falcon-0.2.1

場景:生產環境部署Open-Falcon-0.2.1監控

部署過程(單機安裝)

1. 官方安裝文件

http://book.open-falcon.org/zh_0_2/quick_install/

1. 安裝redis和mysql

我本機已安裝mysql,版本為mysql5.7,這裡直接拿來官方的步驟,如你本地已安裝,那就忽略此步驟

# yum install -y redis mysql-server

2. 下載falcon-plus.git

# cd /tmp && wget https://github.com/open-falcon/falcon-plus/archive/master.zip
# unzip master.zip
# cd falcon-plus-master/scripts/mysql/db_schema/

3. 初始化資料庫

由於安裝的是mysql5.7,所以在初始化資料庫的時候需要確保mysql使用者密碼plugin必須是mysql_native_password,低於此版本的應該沒問題,不確定的可以自行檢視點選我檢視方法.

# mysql -u root -p < 1_uic-db-schema.sql
# mysql -u root -p < 2_portal-db-schema.sql
# mysql -u root -p < 3_dashboard-db-schema.sql
# mysql -u root -p < 4_graph-db-schema.sql
# mysql -u root -p < 5_alarms-db-schema.sql

4. 安裝go環境

# yum install golang
# mkdir ~/workspace
# echo 'export GOPATH="$HOME/workspace"' >> ~/.bashrc
# source ~/.bashrc

5. 建立工作目錄

# export FALCON_HOME=/home/homework
# export WORKSPACE=$FALCON_HOME/open-falcon
# mkdir -p $WORKSPACE

6. 下載二進位制包

# mkdir $WORKSPACE && cd !$ && wget https://github.com/open-falcon/falcon-plus/releases/download/v0.2.1/open-falcon-v0.2.1.tar.gz
# tar zxf open-falcon-v0.2.1.tar.gz && rm -rf open-falcon-v0.2.1.tar.gz

7. 修改配置檔案

# cd $WORKSPACE
# grep -Ilr 3306  ./ | xargs -n1 -- sed -i 's/root:/使用者名稱:密碼/g'

在啟動後端前,由於使用mysql5.7,需要在下面模組的配置檔案內連線mysql的url加上引數“&allowNativePasswords=true”
falcon-graph
falcon-hbs
falcon-nodata
falcon-aggregator
falcon-api
falcon-alarm

# vim xxxx/config/cfg.json
...
"database": "root:[email protected](127.0.0.1:3306)/falcon_portal?loc=Local&parseTime=true&allowNativePasswords=true",
...

否則模組無法啟動,日誌內會出現下面報錯

this user requires mysql native password authentication.

8. 啟動和檢查後端服務

# ./open-falcon start
[falcon-graph] 54107
[falcon-hbs] 54132
[falcon-judge] 26801
[falcon-transfer] 26808
[falcon-nodata] 54159
[falcon-aggregator] 54172
[falcon-agent] 63721
[falcon-gateway] 29834
[falcon-api] 54188
[falcon-alarm] 54197

# ./open-falcon check
        falcon-graph         UP           55800 
          falcon-hbs         UP           55817 
        falcon-judge         UP           55832 
     falcon-transfer         UP           55843 
       falcon-nodata         UP           55853 
   falcon-aggregator         UP           55865 
        falcon-agent         UP           55883 
      falcon-gateway         UP           55895 
          falcon-api         UP           56948 
        falcon-alarm         UP           55972 

如果某個模組狀態為DOWN,就去檢視該模組的log日誌,位置是xxx/logs/xxx.log