open-falcon升级(v0.1--->v0.2)

open-falcon v0.1升级v0.2

v0.1环境变量:
export HOME=/home/neo
export WORKSPACE=$HOME/open-falcon
export GOPATH=$HOME/workspace
#export GOROOT=$HOME/go
#export PATH=$GOROOT/bin:$GOPATH/bin:$PATH
v0.2 准备新的数据库
数据库脚本地址:https://github.com/open-falcon/falcon-plus/blob/master/scripts/mysql/db_schema/5_alarms-db-schema.sql
mysql -u root < 5_alarms-db-schema.sql

下载v0.2版本的二进制程序

cd ~ && wget https://github.com/open-falcon/falcon-plus/releases/download/v0.2.0/open-falcon-v0.2.0.tar.gz
mkdir open-falcon-v0.2 && tar xf open-falcon-v0.2.0.tar.gz -C open-falcon-v0.2

升级思路:

官方文档提示只需要替换二进制文件即可,在实际的测试环境下,不可以。
比方说:agent v0.1版本目录下,无config和bin目录,而agent v0.2版本是需要在agent/config目录下查找配置文件,
且v0.2版本,在启动agent时,需要调用agent/bin/falcon-agent 此二进制文件运行。
操作简单的升级思路是:直接将各个组件目录先备份,重命名,将v0.2版本的目录重命名正常,且先修改配置文件即可。

升级agent

# 配置v0.2的config/cfg.json配置文件
{
    "debug": true,
    "hostname": "",
    "ip": "",
    "plugin": {
        "enabled": false,
        "dir": "./plugin",
        "git": "https://github.com/open-falcon/plugin.git",
        "logs": "./logs"
    },
    "heartbeat": {
        "enabled": true,
        "addr": "127.0.0.1:6030",   # 修改
        "interval": 60,
        "timeout": 1000
    },
    "transfer": {
        "enabled": true,
        "addrs": [
            "127.0.0.1:8433"        # 修改
        ],
        "interval": 60,
        "timeout": 1000
    },
    "http": {
        "enabled": true,
        "listen": ":1988",
        "backdoor": false
    },
    "collector": {
        "ifacePrefix": ["eth", "em"],
        "mountPoint": []
    },
    "default_tags": {               # 新增default_tags
    },
    "ignore": {
        "cpu.busy": true,
        "df.bytes.free": true,
        "df.bytes.total": true,
        "df.bytes.used": true,
        "df.bytes.used.percent": true,
        "df.inodes.total": true,
        "df.inodes.free": true,
        "df.inodes.used": true,
        "df.inodes.used.percent": true,
        "mem.memtotal": true,
        "mem.memused": true,
        "mem.memused.percent": true,
        "mem.memfree": true,
        "mem.swaptotal": true,
        "mem.swapused": true,
        "mem.swapfree": true
    }
}

cd ~/open-falcon && mv agent agent-v0.1
cp -r ~/open-falcon-v0.2/agent ~/open-falcon/
[neo@node1 open-falcon]$ pwd
/home/neo/open-falcon
[neo@node1 open-falcon]$ tree agent/ -L 2
agent/
├── bin
│   └── falcon-agent
├── config
│   └── cfg.json
├── logs
│   └── agent.log
├── plugins
│   ├── plugins.go
│   ├── reader.go
│   └── scheduler.go
└── public
    ├── css
    ├── img
    ├── index.html
    └── js
# 启动服务,v0.2版本,可以由open-falcon统一管理服务,
cd ~/open-falcon
./open-falcon [ check | help | monitor | reload | restart | start | stop ]
~/open-falcon/open-falcon start agent
~/open-falcon/open-falcon check
    falcon-graph         UP            2220 
      falcon-hbs         UP            4257 
    falcon-judge         UP            4274 
 falcon-transfer         UP            2104 
   falcon-nodata       DOWN               - 
falcon-aggregator       DOWN               - 
    falcon-agent         UP           24014 
  falcon-gateway       DOWN               - 
      falcon-api       DOWN               - 
    falcon-alarm         UP            7239

升级transfer(同样的,目录结构变化,升级思路与agent一致)

# transfer的配置文件无需改变
mv ~/open-falcon/transfer ~/open-falcon/transfer-v0.1
cp ~/open-falcon-v0.2/transfer ~/open-falcon/transfer
~/open-falcon/open-falcon stop transfer
~/open-falcon/open-falcon start transfer

升级graph

# 配置文件无需改变,直接用graph的v0.2版本替换
cd ~/open-falcon && mv graph graph-v0.1
cp -r ../open-falcon-v0.2/graph ./
./open-falcon stop graph
./open-falcon start graph
./open-falcon check

升级query模块(api模块替换)

v2版本是将api模块,代替query模块
cd ~/open-falcon && ./query/control stop    #停止query服务
mv query query-v0.1
cp -r ../open-falcon-v0.2/api ./
./open-falcon start api
./open-falcon check

升级hbs模块

cd ~/open-falcon && mv hbs hbs-v0.1
cp -r ../open-falcon-v0.2/hbs ./
./open-falcon stop hbs
./open-falcon start hbs

升级judge

cd ~/open-falcon && mv judge judge-v0.1
cp -r ../open-falcon-v0.2/judge ./
./open-falcon stop judge
./open-falcon start judge
./open-falcon check

升级alarm

# alarm的配置文件:alarm/config/cfg.json
{
    "log_level": "debug",
    "http": {
        "enabled": true,
        "listen": "0.0.0.0:9912"
    },
    "redis": {
        "addr": "127.0.0.1:6379",
        "maxIdle": 5,
        "highQueues": [
            "event:p0",
            "event:p1",
            "event:p2"
        ],
        "lowQueues": [
            "event:p3",
            "event:p4",
            "event:p5",
            "event:p6"
        ],
        "userIMQueue": "/queue/user/im",
        "userSmsQueue": "/queue/user/sms",
        "userMailQueue": "/queue/user/mail"
    },
    "api": {
        "im": "http://127.0.0.1:10086/wechat",
        "sms": "http://127.0.0.1:10086/sms",
        "mail": "http://127.0.0.1:10086/mail",
        "dashboard": "http://node1:8081",
        "plus_api":"http://node1:8080",
        "plus_api_token": "default-token-used-in-server-side"
    },
    "falcon_portal": {
        "addr": "root:@tcp(127.0.0.1:3306)/alarms?charset=utf8&loc=Asia%2FChongqing",
        "idle": 10,
        "max": 100
    },
    "worker": {
        "im": 10,
        "sms": 10,
        "mail": 50
    },
    "housekeeper": {
        "event_retention_days": 7,
        "event_delete_batch": 100
    }
}   
======
cd ~/open-falcon && mv alarm alarm-v0.1
cp -r ../open-falcon-v0.2/alarm ./
 ./open-falcon stop alarm
 ./open-falcon start alarm
 ./open-falcon check

升级aggregator

升级nodata

升级gateway

升级dashboard (全新安装)

# 全新安装
cd ~/open-falcon && git clone https://github.com/open-falcon/dashboard.git && cd dashboard
yum install -y python-virtualenv
yum install -y python-devel
yum install -y openldap-devel
yum install -y mysql-devel
yum groupinstall "Development tools"
virtualenv ./env
./env/bin/pip install -r pip_requirements.txt -i http://mirrors.aliyun.com/pypi/simple      # -i 指定pip的源

# 配置,图形展示工具grafana拉去open-falcon数据源的API地址:
vim rrd/config.py
    API_ADDR = "http://127.0.0.1:8080/api/v1"   # 默认接口地址
# 修改配置信息,如数据库密码等信息
cd ../ && ./open-falcon stop dashboard
cd ../ && ./open-falcon start dashboard
./open-falcon check

你可能感兴趣的:(open-falcon升级(v0.1--->v0.2))