一、环境准备1、配置防火墙,今天小编就来说说关于小米系统基础架构?下面更多详细答案一起来看看吧!
小米系统基础架构
open-falcon的目标是做最开放、最好用的互联网企业级监控产品。一、环境准备
1、配置防火墙
开放端口6030、8433、8081,允许任意IP访问
firewall-cmd --add-port=6030/tcp --permanent
firewall-cmd --add-port=8433/tcp --permanent
firewall-cmd --add-port=8081/tcp --permanent
firewall-cmd --reload
2、安装wget、vim、git
yum install -y wget vim git
3、安装golang、redis
yum install -y epel-release
yum install -y golang
yum install -y redis
#启动开机启动redis
systemctl start redis
systemctl enable redis
4、安装mysql 5.6
#获取repo
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
#安装rpm包
rpm -ivh mysql-community-release-el7-5.noarch.rpm
#安装MySQL
yum install -y mysql-server
#启动Mysql
systemctl start mysql
5、设置临时位置变量
export GOROOT=/usr/lib/golang
export GOPATH=/opt/git
6、在github下载后端
# 创建存放源码文件的目录
mkdir -p $GOPATH/src/github.com/open-falcon
cd $GOPATH/src/github.com/open-falcon
#克隆源码
git clone http://github.com/open-falcon/falcon-plus.git
7、初始化数据库
cd $GOPATH/src/github.com/open-falcon/falcon-plus/scripts/mysql/db_schema
# 执行5个脚本初始化数据库,提示“Enter password”,如果mysql的root没有设置密码,回车即可
mysql -h 127.0.0.1 -u root -p < 1_uic-db-schema.sql
mysql -h 127.0.0.1 -u root -p < 2_portal-db-schema.sql
mysql -h 127.0.0.1 -u root -p < 3_dashboard-db-schema.sql
mysql -h 127.0.0.1 -u root -p < 4_graph-db-schema.sql
mysql -h 127.0.0.1 -u root -p < 5_alarms-db-schema.sql
8、编译后端源码
cd $GOPATH/src/github.com/open-falcon/falcon-plus
#编译
make all
#打包
make pack
二、部署后端
1、设置临时位置变量
export backSPACE=/opt/open-falcon/back
2、创建工作目录
mkdir -p $BACKSPACE
3、解压缩包
cd $GOPATH/src/github.com/open-falcon/falcon-plus
tar -xzvf open-falcon-v0.2.1.tar.gz -C $BACKSPACE
4、修改各模块配置文件cfg.json
①、vim /opt/open-falcon/back/aggregator/config/cfg.json
"database": {
"addr": "root:passwd@tcp(127.0.0.1:3306)/falcon_portal?loc=Local&parseTime=true",
"idle": 10,
"ids": [1, -1],
"interval": 55
②、vim /opt/open-falcon/back/graph/config/cfg.json
"db": {
"dsn": "root:passwd@tcp(127.0.0.1:3306)/graph?loc=Local&parseTime=true",
"maxIdle": 4
},
③、vim /opt/open-falcon/back/hbs/config/cfg.json
{
"debug": true,
"database": "root:passwd@tcp(127.0.0.1:3306)/falcon_portal?loc=Local&parseTime=true",
"hosts": "",
"maxConns": 20,
"maxIdle": 15,
"listen": ":6030",
"trustable": [""],
"http": {
"enabled": true,
"listen": "0.0.0.0:6031"
}
}
④、vim /opt/open-falcon/back/nodata/config/cfg.json
"config": {
"enabled": true,
"dsn": "root:passwd@tcp(127.0.0.1:3306)/falcon_portal?loc=Local&parseTime=true&wait_timeout=604800",
"maxIdle": 4
},
⑤、vim /opt/open-falcon/back/api/config/cfg.json
{
"log_level": "debug",
"db": {
"falcon_portal": "root:passwd@tcp(127.0.0.1:3306)/falcon_portal?charset=utf8&parseTime=True&loc=Local",
"graph": "root:passwd@tcp(127.0.0.1:3306)/graph?charset=utf8&parseTime=True&loc=Local",
"uic": "root:passwd@tcp(127.0.0.1:3306)/uic?charset=utf8&parseTime=True&loc=Local",
"dashboard": "root:passwd@tcp(127.0.0.1:3306)/dashboard?charset=utf8&parseTime=True&loc=Local",
"alarms": "root:passwd@tcp(127.0.0.1:3306)/alarms?charset=utf8&parseTime=True&loc=Local",
"db_bug": true
},
⑥、vim /opt/open-falcon/back/alarm/config/cfg.json
"falcon_portal": {
"addr": "root:passwd@tcp(127.0.0.1:3306)/alarms?charset=utf8&loc=Local",
"idle": 10,
"max": 100
},
5、启动后端
cd /opt/open-falcon/back
/open-falcon start
三、部署前端
1、设置临时位置变量
export FRONTSPACE=/opt/open-falcon/front
2、创建工作目录
mkdir -p $FRONTSPACE
3、从github上克隆前端源码
cd $FRONTSPACE
git clone http://github.com/open-falcon/dashboard.git
4、安装依赖
yum install -y python-virtualenv
yum install -y python-devel
yum install -y openldap-devel
yum install -y mysql-devel
yum groupinstall -y "Development tools"
# 通过virtualenv创建目录env作为独立的运行环境
cd $FRONTSPACE/dashboard
virtualenv /env
# 生成 requirements.txt 并安装依赖
/env/bin/pip install -r pip_requirements.txt
5、编辑dashboard配置文件config.py
29 # portal database
30 # TODO: read from api instead of db
31 PORTAL_DB_HOST = os.environ.get("PORTAL_DB_HOST","127.0.0.1")
32 PORTAL_DB_PORT = int(os.environ.get("PORTAL_DB_PORT",3306))
33 PORTAL_DB_USER = os.environ.get("PORTAL_DB_USER","root")
34 PORTAL_DB_PASS = os.environ.get("PORTAL_DB_PASS","passwd")
35 PORTAL_DB_NAME = os.environ.get("PORTAL_DB_NAME","falcon_portal")
6、启动前端
cd $FRONTSPACE/dashboard
bash control start
四、使用openfalcon
1、访问openfalcon页面
浏览器访问http://服务器IP地址:8081
PS:具体的监控项添加参考官方文档:http://book.open-falcon.org/zh/