Open-falcon 通过docker方式进行安装部署

通过容器运行 open-falcon

1、首先启动mysql数据库并初始化mysql的数据表

    ## start mysql in container
    docker run -itd \
        --name falcon-mysql \
        -v /home/work/mysql-data:/var/lib/mysql \
        -e MYSQL_ROOT_PASSWORD=test123456 \
        -p 3306:3306 \
        mysql:5.7

    ## init mysql table before the first running
    cd /tmp && \
    git clone --depth=1 https://github.com/open-falcon/falcon-plus && \
    cd /tmp/falcon-plus/ && \
    for x in `ls ./scripts/mysql/db_schema/*.sql`; do
        echo init mysql table $x ...;
        docker exec -i falcon-mysql mysql -uroot -ptest123456 < $x;
    done

    rm -rf /tmp/falcon-plus/

2、启动redis容器

docker run --name falcon-redis -p6379:6379 -d redis:4-alpine3.8

3、使用容器启动falcon-plus 模块

    ## pull images from hub.docker.com/openfalcon
    docker pull openfalcon/falcon-plus:v0.3
    
    ## run falcon-plus container
    docker run -itd --name falcon-plus \
         --link=falcon-mysql:db.falcon \
         --link=falcon-redis:redis.falcon \
         -p 8433:8433 \
         -p 8080:8080 \
         -e MYSQL_PORT=root:test123456@tcp\(db.falcon:3306\) \
         -e REDIS_PORT=redis.falcon:6379  \
         -v /home/work/open-falcon/data:/open-falcon/data \
         -v /home/work/open-falcon/logs:/open-falcon/logs \
         openfalcon/falcon-plus:v0.3
    
    ## start falcon backend modules, such as graph,api,etc.
    docker exec falcon-plus sh ctrl.sh start \
            graph hbs judge transfer nodata aggregator agent gateway api alarm
    
    ## or you can just start/stop/restart specific module as: 
    docker exec falcon-plus sh ctrl.sh start/stop/restart xxx

    ## check status of backend modules
    docker exec falcon-plus ./open-falcon check
    
    ## or you can check logs at /home/work/open-falcon/logs/ in your host
    ls -l /home/work/open-falcon/logs/

4、启动falcon-agent客户端容器

docker run -d --restart always --name falcon-agent -e NUX_ROOTFS=/rootfs -v /:/rootfs:ro openfalcon/falcon-plus:v0.3 ./agent/bin/falcon-agent -c /open-falcon/agent/config/cfg.json

5、通过源码进行构建open-falcon镜像

    构建 falcon-plus

    cd /tmp && \
    git clone https://github.com/open-falcon/falcon-plus && \
    cd /tmp/falcon-plus/ && \
    docker build -t falcon-plus:v0.3 .

   构建 falcon-dashboard

    cd /tmp && \
    git clone https://github.com/open-falcon/dashboard  && \
    cd /tmp/dashboard/ && \
    docker build -t falcon-dashboard:v0.2.1 .

 

你可能感兴趣的:(Open-falcon)