监控平台 / 系统运维

小米开源监控平台Open-Falcon安装部署

浅时光 · 10月18日 · 2020年 5505次已读

一、系统环境准备

目前我这里使用单机版进行部署,也可以前后端进行分离,前端,后端,数据库分别在不同的服务器上进行部署搭建

1、更改主机名

[[email protected] ~]# hostnamectl set-hostname open-falcon

2、配置阿里源

####备份系统BASE源
[[email protected]open-falcon ~]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

####阿里源####
[[email protected] ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

####epel源####
[[email protected] ~]# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

####更新缓存####
[[email protected] ~]# yum clean all
[[email protected] ~]# yum makecache
[[email protected] ~]# yum repolist

3、安装基础命令

[[email protected] ~]# yum -y install vim net-tools lrzsz ntp wget get curl rsync git

4、时间同步

[[email protected] ~]# systemctl start ntpd
[[email protected] ~]# systemctl enable ntpd
[[email protected] ~]# systemctl status ntpd
[[email protected] ~]# date	    ##检查时间

5、关闭防火墙

[[email protected] ~]# systemctl stop firewalld
[[email protected] ~]# systemctl disable firewalld
[[email protected] ~]# setenforce 0
[[email protected] ~]# sed -ri 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config

二、软件环境准备

1、部署go

  • 注意:官方yum和文章来源(Source):https://www.dqzboy.com阿里yum都没有go的安装包,只能通过fedor文章来源(Source):https://www.dqzboy.coma的epel仓库来安装
#安装
[[email protected] ~]# yum install -y epel-release
[[email protected] ~]# yum install golang -y

#检查
[[email protected] ~]# go version
go version go1.11.5 linux/amd64

2、部署redis

#部署新版redis
[[email protected] ~]# yum install -y http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
#安装
[[email protected] ~]# yum --enablerepo=remi install redis

#启动
[[email protected] ~]# systemctl start redis

#开机自启
[[email protected] ~]# systemctl enable redis
Created symlink from /etc/systemd/system/multi-user.target.wants/redis.service to /usr/lib/systemd/system/redis.service.

#检查状态
[[email protected] ~]# systemctl status redis

3、部署MySQL

[[email protected] ~]# wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
[[email protected] ~]# rpm -ivh mysql57-community-release-el7-11.noarch.rpm

#查看 mysql server
[[email protected] ~]# yum repolist enabled | grep "mysql.*-community.*"
[[email protected] ~]# yum repolist all | grep mysql

#安装
[[email protected] ~]# yum install mysql-community-server

#启动数据库
[[email protected] ~]# systemctl start mysqld.service
[[email protected] ~]# systemctl enable mysqld.service
[[email protected] ~]# systemctl status mysqld.service
  • MySQL5.7.6 之后会在启动 mysql 进程的时候生成一个用户密码,首次登陆需要这个密码才行。密码保存在 mysql 进程的日志里,即(/var/log/mysqld.log)
#查看登陆密码
[[email protected] ~]#  cat /var/log/mysqld.log | grep 'password'

#登陆
[[email protected] ~]#  mysql -uroot -p
  • 修改ROOT密码
mysql> set global validate_password_policy=0;
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123';

三、部署open-falcon

1、文章来源(Source):https://www.dqzboy.com部署后端

1.1:初始化数据库

[[email protected] ~]#  cd /tmp/ && git clone https://github.com/open-falcon/falcon-plus.git
[[email protected] ~]# cd /tmp/falcon-plus/scripts/mysql/db_schema/
[[email protected] ~]# mysql -h 127.0.0.1 -u root -p < 1_uic-db-schema.sql
[[email protected] ~]# mysql -h 127.0.0.1 -u root -p < 2_portal-db-schema.sql
[[email protected] ~]# mysql -h 127.0.0.1 -u root -p < 3_dashboard-db-schema.sql
[[email protected] ~]# mysql -h 127.0.0.1 -u root -p < 4_graph-db-schema.sql
[[email protected] ~]# mysql -h 127.0.0.1 -u root -p < 5_alarms-db-schema.sql
[[email protected] ~]# rm -rf /tmp/falcon-plus/
文章来源(Source):https://www.dqzboy.com

1.2:创建工作目录

[[email protected] ~]# vim /etc/profile
export FALCON_HOME=/usr/local/open-falcon

[[email protected] ~]# source /etc/profile
[[email protected] ~]# mkdir -p $FALCON_HOME

1.3:程序包下载

[[email protected] ~]# wget https://github.com/open-falcon/falcon-plus/releases/download/v0.3/open-falcon-v0.3.tar.gz

[[email protected] ~]# tar -zxvf open-falcon-v0.3.tar.gz -C $FALCON_HOME
[[email protected] ~]# cd $FALCON_HOME

1.4:修改配置文件cfg.json

[[email protected] ~]# vim /usr/local/open-falcon/aggregator/config/cfg.json
小米开源监控平台Open-Falcon安装部署-浅时光博客
[[email protected] ~]# vim /usr/local/open-falcon/graph/config/cfg.json
%s#root:#root:passwd#g
小米开源监控平台Open-Falcon安装部署-浅时光博客
[[email protected] ~]# vim /usr/local/open-falcon/hbs/config/cfg.json
小米开源监控平台Open-Falcon安装部署-浅时光博客
[[email protected] ~]# vim /usr/local/open-falcon/nodata/config/cfg.json
小米开源监控平台Open-Falcon安装部署-浅时光博客
[[email protected] ~]# vim /usr/local/open-falcon/api/config/cfg.json
小米开源监控平台Open-Falcon安装部署-浅时光博客
[[email protected] ~]# vim /usr/local/open-falcon/alarm/config/cfg.json
小米开源监控平台Open-Falcon安装部署-浅时光博客
文章来源(Source):https://www.dqzboy.com

1.5:启动后端

[[email protected] ~]# cd $FALCON_HOME
[[email protected] open-falcon]# ./open-falcon start

#检查
[[email protected] open-falcon]# ./open-falcon check
小米开源监控平台Open-Falcon安装部署-浅时光博客

2、部署前端

2.1:前端代码下载

[[email protected] ~]# cd $FALCON_HOME
[[email protected] open-falcon]# git clone https://github.com/open-falcon/dashboard.git

2.2:安装依文章来源(Source):https://www.dqzboy.com赖包

[[email protected] open-falcon]# yum install -y python-virtualenv
[[email protected] open-falcon]# yum install -y python-devel
[[email protected] open-falcon]# yum install -y openldap-devel
[[email protected] open-falcon]# yum install -y mysql-devel
[[email protected] open-falcon]# yum groupinstall "Development tools" -y

2.3:查看需要安装的模块

[[email protected] open-falcon]# cd dashboard/

[[email protected] dashboard]# cat pip_requirements.txt 
Flask==1.0
Flask-Babel==0.9
Jinja2>=2.10.1
Werkzeug==0.15.3
gunicorn==19.9.0
python-dateutil==2.2
requests==2.3.0
mysql-python
python-ldap

##注意:3.0版本修改Werkzeug==0.15.4  才可以启动
[[email protected] dashboard]# vim pip_requirements.txt 
Werkzeug==0.15.4

2.4:安装模块

[[email protected] dashboard]# virtualenv ./env
[[email protected] dashboard]# ./env/bin/pip install -r pip_requirements.txt -i https://pypi.douban.com/simple

2.5:修改配置

  • 配置说明:
    • dashboard的配置文件为: ‘rrd/config.py’,根据实际情况修改:
    • API_ADDR 表示后端api文章来源(Source):https://www.dqzboy.com组件的地址:API_ADDR = "http://127.0.0.1:8080/api/v1"
  • 根据实际情况,修改PORTAL_DB_*, 默认用户名为root,默认密码为””文章来源(Source):https://www.dqzboy.com
  • 根据实际情况,修改ALARM_DB_*, 默认用户名为root,默认密文章来源(Source):https://www.dqzboy.com码为””
[[email protected] dashboard]# cp rrd/config.py{,_bak}
[[email protected] dashboard]# vim rrd/config.py
小米开源监控平台Open-Falcon安装部署-浅时光博客

2.6:启动服务

#生成环境启动
[[email protected] dashboard]# bash control start

#开发模式启动
[[email protected] dashboard]# ./env/bin/python wsgi.py

四、访问网站

  • 默认端口8081
小米开源监控平台Open-Falcon安装部署-浅时光博客
  • 注意:dashbord默认没有创建任何账号包括管理账号,文章来源(Source):https://www.dqzboy.com需要你通过页面进行注册账号
小米开源监控平台Open-Falcon安装部署-浅时光博客
小米开源监控平台Open-Falcon安装部署-浅时光博客
小米开源监控平台Open-Falcon安装部署-浅时光博客
小米开源监控平台Open-Falcon安装部署-浅时光博客
0 条回应
    本站已安全运行: | 耗时 0.418 秒 | 查询 111 次 | 内存 19.90 MB