open-falcon deploys installation using docker


Operating environment


Install docker on centos

  1. Log in to Centos with root privileges. Use commands:

    & su root 
    // When entering a password, the password is not displayed. 
  2. The yum package is updated to the latest.

    # yum update
  3. Uninstall the old docker (no docker installed before is negligible)

    # yum remove docker  docker-common docker-selinux docker-engine
  4. Installation of required packages, yum-util provides yum-config-manager functionality, and the other two are device mapper driver-dependent

    # yum install -y yum-utils device-mapper-persistent-data lvm2
  5. Setting up yum source

    # yum-config-manager --add-repo
    # yum-config-manager --add-repo
    // One of the two commands can be configured. It is recommended to configure the Ali cloud image.
  6. View all docker versions in the warehouse and select version installation

    # yum list docker-ce --showduplicates | sort -r
  7. Install docker

    # yum install docker-ce // / Because repo only opens stable warehouse by default, the latest stable version is installed here.
    # Yum install < FQPN >//e.g. yum install docker-ce-17.12.0.ce
     // Two commands execute one
  8. After successful installation, start docker and set docker to boot

    # systemctl start docker    
    # systemctl enable docker   
  9. Verify that the installation was successful (both client and service sections indicate that the docker installation started successfully)

    # docker version
  10. Run the first hello-world

    # docker run hello-world
  11. Now the docker installation is complete

    # service docker restart    

mysql installation

Unload old mysql

First uninstall mysql that centos has installed (skip if centos is not installed)

A) mysql installed in Yum mode

# yum remove mysql mysql-server mysql-libs compat-mysql51
# rm -rf /var/lib/mysql
# Rm/etc/my.cnf//It is possible that my.cnf will be renamed my.cnf.rpmsave

See if there is mysql software:

# rpm -qa|grep mysql

If it exists, continue deleting it.

B) mysql installed in RPM mode

Check whether mysql is installed in the rpm package in the system:

[root@localhost]# rpm -qa | grep -i mysql

Uninstall mysql:

[root@localhost]# rpm -e MySQL-server-5.6.17-1.el6.i686
[root@localhost]# rpm -e MySQL-client-5.6.17-1.el6.i686

Delete mysql service:

[root@localhost]# chkconfig --list | grep -i mysql
[root@localhost]# chkconfig --del mysql

Delete the decentralized mysql folder:

[root@localhost]# whereis mysql or find / name MySQL
mysql: /usr/lib/mysql /usr/share/mysql

Clear all directories and files related to mysql:

[root@localhost]# rm -rf /usr/lib/mysql
[root@localhost]# rm -rf /usr/share/mysql

At this point mysql should be uninstalled clean.

Install mysql

a) Start installing mysql containers

 docker run -itd \
        --name falcon-mysql \
        -v /home/work/mysql-data:/var/lib/mysql \
        -e MYSQL_ROOT_PASSWORD=test123456 \
        -p 3306:3306 \
 //Installed version is mysql: 5.7 default user name root password test123456

b) Initialize mysql table structure

# cd /tmp && \
  git clone --depth=1 && \
  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;

# rm -rf /tmp/falcon-plus/

redis installation

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

Section 2 Installation Backend

setup script

  1. pull images from

    # docker pull openfalcon/falcon-plus:v0.3
  2. 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 \
  3. start falcon backend modules, such as graph,api,etc.

    # docker exec falcon-plus 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 start/stop/restart xxx
  4. check status of backend modules

    docker exec falcon-plus ./open-falcon check
  5. or you can check logs at /home/work/open-falcon/logs/ in you host

    ls -l /home/work/open-falcon/logs/

Section 3 Installation Front End

setup script

Start falcon-dashboard in container

# docker run -itd --name falcon-dashboard \
        -p 8081:8081 \
        --link=falcon-mysql:db.falcon \
        --link=falcon-plus:api.falcon \
        -e API_ADDR=http://api.falcon:8080/api/v1 \
        -e PORTAL_DB_HOST=db.falcon \
        -e PORTAL_DB_PORT=3306 \
        -e PORTAL_DB_USER=root \
        -e PORTAL_DB_PASS=test123456 \
        -e PORTAL_DB_NAME=falcon_portal \
        -e ALARM_DB_HOST=db.falcon \
        -e ALARM_DB_PORT=3306 \
        -e ALARM_DB_USER=root \
        -e ALARM_DB_PASS=test123456 \
        -e ALARM_DB_NAME=alarms \
        -w /open-falcon/dashboard openfalcon/falcon-dashboard:v0.2.1  \
       './control startfg'

Problems encountered

(a) For port occupancy, we can change - p 8081:8081 to - p 8087:8081.

b) Then re-run may encounter problems with the current container

Need to delete first to view all current containers

# docker ps -a

Find the container id/name, stop the container, and delete it.

# id of docker stop falcon-dashboard
 # id of docker rm falcon-dashboard

Run the command again

c) encountered the following problems

[External Link Picture Transfer Failure (img-sb0IKbB9-1565328713021) (C: Users Administrator Desktop 153134(1)].jpg)

You can try to run it several times more.


Modify docker image source:

The default source of docker is foreign official source, which downloads slowly and can be changed to domestic one.

Modify or add/etc/docker/daemon.json

# vi /etc/docker/daemon.json
  "registry-mirrors": [""]
# System CTL restart docker. service // restart docker service

Section 4 Front-end Interface

Open the page

a) In centos browser, you can enter

b) In windows system browser, you can enter centos host ip:8081

[Img-cBnuyOdP-1565328713023 (C: Users Administrator AppData Roaming Typora typora-user-images 15892.png)]

First login requires registration

[Img-vCWKeGzX-1565328713023 (C: Users Administrator AppData Roaming Typora typora-user-images 15660.png)]

Problems encountered

If you can't open the page, it may be that the firewall is not closed. Centos7 defaults to firewall as a firewall.

View firewall status

# firewall-cmd --state

Stop firewall

# systemctl stop firewalld.service

Prohibit firewall boot-up

# systemctl disable firewalld.service

Enter the website again to enter the interface.

Section 5 Establishing open-falcon Mirror

a) Building falcon-plus

# cd /tmp && \
    git clone && \
    cd /tmp/falcon-plus/ && \
    docker build -t falcon-plus:v0.3 .

b) Buliding falcon-dashboard

# cd /tmp && \
    git clone  && \
    cd /tmp/dashboard/ && \
    docker build -t falcon-dashboard:v0.2.1 .

Section 6 Shutdown and Restart

  1. Start docker

    # service docker start
  2. View the current docker image

    # docker ps -a
  3. Start the redis service

    # docker start falcon-redis
  4. service mysql start

    # docker start falcon-mysql
  5. Start the falcon-plus service

    docker start falcon-plus

    Start the service in falcon-plus

    # docker exec -it falcon-plus
    # ./open-falcon start
    # exit // exit

    Check open-falon startup

    # docker exex -it falcon-plus /bin/bash
    # ./open-falcon check
    # exit // exit
  6. Start the falcon-dashboard service

    # docker start falcon-dashboard

    Start in production environment

    # docker exec -it falcon-dashboard /bin/bash
    # bash control start
    # exit // exit

    view log

    # docker exec -it falcon-dashboard /bin/bash
    # bash control tail
    # exit // exit

lon startup

# docker exex -it falcon-plus /bin/bash
# ./open-falcon check
# exit // exit
  1. Start the falcon-dashboard service

    # docker start falcon-dashboard

    Start in production environment

    # docker exec -it falcon-dashboard /bin/bash
    # bash control start
    # exit // exit

    view log

    # docker exec -it falcon-dashboard /bin/bash
    # bash control tail
    # exit // exit

Tags: Docker MySQL yum CentOS

Posted on Thu, 08 Aug 2019 22:48:09 -0700 by Kardall