1. 概述
OpenFalcon 是一款企业级、高可用、可扩展的开源监控解决方案,详细介绍请查看官方资料,我是参照官方手册进行安装的,记录了一些特殊的问题点。
2. 环境准备
-
Oracle Linux 7.4
-
更换阿里 yum 源:centos、epel、mysql(centos 源中已经拿掉了mysql,需要额外添加)
$ wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo ###注意,我用的 OracleLinux7.4,还需要将 Centos-7.repo 中的 $releasever 替换为7,Centos 不需要修改。 $ wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo $ wget http://repo.mysql.com/mysql57-community-release-el7.rpm $ rpm -ivh mysql57-community-release-el7.rpm $ yum makecache
-
安装 redis
$ yum install -y redis $ systemctl start redis
-
安装 mysql
$ yum install -y mysql-community-server $ systemctl start mysql # 初次安装修改 root 密码 $ grep 'password' /var/log/mysqld.log 2018-01-18T07:40:04.075286Z 1 [Note] A temporary password is generated for root@localhost: .>!66%z*_f:N $ mysql -uroot -p.>!66%z*_f:N # 改密码 mysql> set password=password('123456');
-
初始化 MySQL 表结构
$ cd /tmp/ && git clone https://github.com/open-falcon/falcon-plus.git
$ cd /tmp/falcon-plus/scripts/mysql/db_schema/
$ 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
$ rm -rf /tmp/falcon-plus/
-
下载编译好的二进制版本
3. 安装服务端
- 创建工作目录
$ export FALCON_HOME=/home/work
$ export WORKSPACE=$FALCON_HOME/open-falcon
$ mkdir -p $WORKSPACE
- 解压二进制包
$ tar -xzvf open-falcon-v0.2.1.tar.gz -C $WORKSPACE
- 修改配置文件中的数据库账号信息
$ cd $WORKSPACE
$ grep -Ilr 3306 ./
aggregator/config/cfg.json
hbs/config/cfg.json
api/config/cfg.json
graph/config/cfg.json
alarm/config/cfg.json
nodata/config/cfg.json
# 确保上面配置文件中的数据库连接的账号密码与自己配置的一致
- 启动
cd $WORKSPACE
./open-falcon start
# 检查所有模块的启动状况
./open-falcon check
- 更多命令
# ./open-falcon [start|stop|restart|check|monitor|reload] module
$ ./open-falcon start agent
$ ./open-falcon check
falcon-graph UP 53007
falcon-hbs UP 53014
falcon-judge UP 53020
falcon-transfer UP 53026
falcon-nodata UP 53032
falcon-aggregator UP 53038
falcon-agent UP 53044
falcon-gateway UP 53050
falcon-api UP 53056
falcon-alarm UP 53063
# For debugging , You can check $WorkDir/$moduleName/log/logs/xxx.log
4. 安装前端
- 进入工作目录
$ cd $WORKSPACE
- 克隆前端组件代码
$ git clone https://github.com/open-falcon/dashboard.git
- 尝试安装依赖包
$ yum install -y python-virtualenv
# 结果遇到问题,python-virtualenv 依赖 python-2.7.5-58.el7.x86_64,已经安装的是 python-2.7.5-58.0.1.el7.x86_64,具体解决办法请看下面“python 依赖包版本低需要降级”,解决之后继续下面的步骤.
$ yum install -y python-devel
$ yum install -y openldap-devel
$ yum install -y mysql-devel
$ yum groupinstall "Development tools"
$ cd $WORKSPACE/dashboard/
$ virtualenv ./env
$ ./env/bin/pip install -r pip_requirements.txt -i http://mirrors.aliyun.com/pypi/simple/
- 修改配置
#dashboard的配置文件为: 'rrd/config.py',请根据实际情况修改
$ vim ./rrd/config.py
## API_ADDR 表示后端api组件的地址
API_ADDR = "http://127.0.0.1:8080/api/v1"
## 根据实际情况,修改PORTAL_DB_*, 默认用户名为root,默认密码为""
## 根据实际情况,修改ALARM_DB_*, 默认用户名为root,默认密码为""
- 以开发者模式启动
$ ./env/bin/python wsgi.py
- 在生产环境启动
$ bash control start
- 停止dashboard运行
$ bash control stop
- 查看日志
$ bash control tail
- 打开浏览器使用吧 http://ip:8081
python 依赖包版本低需要降级
1. 问题描述:
python-virtualenv 依赖 python-2.7.5-58.el7.x86_64 ,已经安装的是 python-2.7.5-58.0.1.el7.x86_64,我需要卸载python-2.7.5-58.0.1.el7.x86_64,然后重新安装 python-2.7.5-58.el7.x86_64。
2. 卸载 python
$ rpm -qa|grep python|xargs rpm -e --allmatches --nodeps
$ whereis python|xargs rm -fr
3. 卸载 yum
$ rpm -qa|grep yum|xargs rpm -e --allmatches --nodeps
$ mv /etc/yum.repos.d /etc/yyyyy.repos.d
$ whereis yum|xargs rm -fr
4. 下载 python 安装包并安装
$ mkdir /usr/local/src/python
$ cd /usr/local/src/python
$ wget https://mirrors.aliyun.com/centos/7.4.1708/os/x86_64/Packages/glibc-2.17-196.el7.x86_64.rpm
$ wget https://mirrors.aliyun.com/centos/7.4.1708/os/x86_64/Packages/python-2.7.5-58.el7.x86_64.rpm
$ wget https://mirrors.aliyun.com/centos/7.4.1708/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm
$ wget https://mirrors.aliyun.com/centos/7.4.1708/os/x86_64/Packages/python-pycurl-7.19.0-19.el7.x86_64.rpm
$ wget https://mirrors.aliyun.com/centos/7.4.1708/os/x86_64/Packages/python-devel-2.7.5-58.el7.x86_64.rpm
$ wget https://mirrors.aliyun.com/centos/7.4.1708/os/x86_64/Packages/python-libs-2.7.5-58.el7.x86_64.rpm
$ wget https://mirrors.aliyun.com/centos/7.4.1708/os/x86_64/Packages/python-urlgrabber-3.10-8.el7.noarch.rpm
$ wget https://mirrors.aliyun.com/centos/7.4.1708/os/x86_64/Packages/rpm-python-4.11.3-25.el7.x86_64.rpm
$ rpm -ivh glibc* ./python-* ./rpm-python-*
5. 下载 yum 安装包并安装
$ mkdir /usr/local/src/yum
$ cd /usr/local/src/yum
$ wget https://mirrors.aliyun.com/centos/7.4.1708/os/x86_64/Packages/yum-3.4.3-154.el7.centos.noarch.rpm
$ wget https://mirrors.aliyun.com/centos/7.4.1708/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
$ wget https://mirrors.aliyun.com/centos/7.4.1708/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-42.el7.noarch.rpm
$ rpm -ivh ./yum*
$ mv /etc/yyyyy.repos.d /etc/yum.repos.d
$ yum makecache
网友评论