ubuntu单机安装open-falcon极度详细操作「建议收藏」

ubuntu单机安装open-falcon极度详细操作「建议收藏」redis127.0.0.1:6379> ping PONG证明已经成功安装了redis1.1.2 安装mysqlsudo apt-get

大家好,欢迎来到IT知识分享网。

备注:以下操作均由本人实际操作并得到验证,喜欢的同学可尝试操作安装。

步骤一

1.1 环境准备(使用系统:ubuntu 18.04

1.1.1 安装redis

ubuntu下安装(参考借鉴:https://www.runoob.com/redis/redis-install.html

sudo apt-get update

sudo apt-get install redis-server

启动redis

redis-server

查看redis是否启动?

redis-cli

以上命令将打开以下终端:

redis 127.0.0.1:6379>

127.0.0.1 是本机 IP ,6379 是 redis 服务端口。现在我们输入 PING 命令。

redis 127.0.0.1:6379> ping PONG

证明已经成功安装了redis

ubuntu单机安装open-falcon极度详细操作「建议收藏」

1.1.2 安装mysql

(参考借鉴:https://www.linuxidc.com/Linux/2017-05/143864.htm)

sudo apt-get update

sudo apt-get install mysql-server

sudo apt-get install mysql-client

sudo apt-get install libmysqlclient-dev

#服务启动后端口查询

sudo netstat -anp | grep mysql

#服务管理

#启动

sudo service mysql start / sudo systemctl mysql start

#停止

sudo service mysql stop / sudo systemctl mysql stop

#状态

sudo service mysql status / sudo systemctl status mysql.service

#重启

sudo service mysql restart

#连接数据库 mysql -h 127.0.0.1 -P 3306 -uroot -p (root用户密码默认为空)

#-h为远程IP,-P为端口号,-u为用户名,-p为密码

1.1.3 初始化MySQL表结构

cd /opt/ && git clone https://github.com/open-falcon/falcon-plus.git

cd /opt/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

1.2 从源码编译

编译前保证安装好golang环境,具体请参考:https://www.runoob.com/go/go-environment.html

#添加golang的环境变量,编辑文件/etc/profile,加入以下内容后使用”source /etc/profile”即刻生效;

# for golang env

export GOROOT=/usr/local/go

export GOPATH=/opt/go

export GOBIN=$GOPATH/bin

export PATH=$PATH:$GOROOT/bin:$GOPATH:$GOBIN

#将步骤1.1.3中的falcon-plus项目源码拷贝到$GOPATH/src/github.com/open-falcon/目录下

mkdir $GOPATH/src/github.com/open-falcon/

mv /opt/falcon-plus $GOPATH/src/github.com/open-falcon/ -r

ubuntu单机安装open-falcon极度详细操作「建议收藏」

cd $GOPATH/src/github.com/open-falcon/falcon-plus/

# make all modules

make all

# pack all modules

make pack

ubuntu单机安装open-falcon极度详细操作「建议收藏」

步骤二:启动后端

2.1 环境准备

2.1.1 创建工作目录

export FALCON_HOME=/opt/work

export WORKSPACE=$FALCON_HOME/open-falcon

mkdir -p $WORKSPACE

2.1.2 解压二进制包

tar -zxvf open-falcon-v0.3.x.tar.gz -C $WORKSPACE/

2.2 确认配置文件中数据库账号密码与实际相同,否则需要修改配置文件

cd $WORKSPACE grep -Ilr 3306 ./ | xargs -n1 — sed -i ‘s/root:/real_user:real_password/g’

2.3 启动

cd $WORKSPACE

./open-falcon start

初次启动可能会出现以下卡住的异常现象

ubuntu单机安装open-falcon极度详细操作「建议收藏」

原因是falcon-aggregator模块访问数据库的配置文件需要正确配置访问数据库的用户和密码,否者会无法访问数据库从而显示报错;报错日志如下:

ubuntu单机安装open-falcon极度详细操作「建议收藏」

解决方法:编辑falcon-aggregator,修改访问数据库的用户和密码;

ubuntu单机安装open-falcon极度详细操作「建议收藏」

vi aggregator/config/cfg.json

ubuntu单机安装open-falcon极度详细操作「建议收藏」

将图中real_user和real_password这两个字段替换为在数据库中登录的用户和密码,完成之后保存退出。

同理还要修改其它模块涉及数据库访问的登录用户和密码:

#falcon-graph模块:vi graph/config/cfg.json

ubuntu单机安装open-falcon极度详细操作「建议收藏」

#falcon-hbs模块:vi hbs/config/cfg.json

ubuntu单机安装open-falcon极度详细操作「建议收藏」

#falcon-nodata模块:vi nodata/config/cfg.json

ubuntu单机安装open-falcon极度详细操作「建议收藏」

#falcon-api模块:vi api/config/cfg.json

ubuntu单机安装open-falcon极度详细操作「建议收藏」

#falcon-alarm模块:vi alarm/config/cfg.json

ubuntu单机安装open-falcon极度详细操作「建议收藏」

再次执行启动命令:./open-falcon start

ubuntu单机安装open-falcon极度详细操作「建议收藏」

# 检查所有模块的启动状况 ./open-falcon check

ubuntu单机安装open-falcon极度详细操作「建议收藏」

更多命令行工具使用方法

# ./open-falcon [start|stop|restart|check|monitor|reload] module

./open-falcon start agent

For debugging , You can check $WorkDir/$moduleName/log/logs/xxx.log

步骤三:安装前端

3.1 创建工作目录

export FALCON_HOME=/opt/work

export WORKSPACE=$FALCON_HOME/open-falcon

mkdir -p $WORKSPACE

3.2 克隆前端组件代码

cd $WORKSPACE

git clone https://github.com/open-falcon/dashboard.git

3.3 安装依赖包

sudo apt-get install python-pip python-virtualenv

sudo apt-get install python-dev

sudo apt-get install ldap-utils

sudo apt-get install libmysqld-dev

#安装virtualenv的运行环境

cd $WORKSPACE/dashboard/

virtualenv ./env

./env/bin/pip install -r pip_requirements.txt -i https://pypi.douban.com/simple

可能会出现以下报错:ERROR: Failed building wheel for python-ldap

ubuntu单机安装open-falcon极度详细操作「建议收藏」

解决方法:安装以下依赖环境

sudo apt-get install python-dev

sudo apt-get install libldap2-dev

sudo apt-get install libsasl2-dev

./env/bin/pip install python-ldap

#再次执行

./env/bin/pip install -r pip_requirements.txt -i https://pypi.douban.com/simple

ubuntu单机安装open-falcon极度详细操作「建议收藏」

3.4 初始化数据库

如果前端与后端安装不同在一台服务器,参考步骤一中的1.1.3初始化数据表的操作;如果是在同一台服务器时,则这步可跳过。

3.5 修改配置

dashboard的配置文件为: ‘rrd/config.py’,请根据实际情况修改

## API_ADDR 表示后端api组件的地址 API_ADDR = “http://127.0.0.1:8080/api/v1”

## 根据实际情况,修改PORTAL_DB_*, 默认用户名为root,默认密码为””

(改为步骤一中安装MySQL数据库之后实际可访问的用户和密码)

## 根据实际情况,修改ALARM_DB_*, 默认用户名为root,默认密码为””

(改为步骤一中安装MySQL数据库之后实际可访问的用户和密码

#修改前

ubuntu单机安装open-falcon极度详细操作「建议收藏」

#修改后

ubuntu单机安装open-falcon极度详细操作「建议收藏」

3.6 以开发者模式启动

./env/bin/python wsgi.py

open http://127.0.0.1:8081 in your browser.

ubuntu单机安装open-falcon极度详细操作「建议收藏」

3.7 在生成环境启动

bash control start

open http://127.0.0.1:8081 in your browser.

ubuntu单机安装open-falcon极度详细操作「建议收藏」

3.8 停止dashboard运行

bash control stop

3.9 查看日志

bash control tail

3.10 dashboaed用户管理

dashbord没有默认创建任何账号包括管理账号,需要你通过页面进行注册账号。 想拥有管理全局的超级管理员账号,需要手动注册用户名为root的账号(第一个帐号名称为root的用户会被自动设置为超级管理员)。 超级管理员可以给普通用户分配权限管理。 小提示:注册账号能够被任何打开dashboard页面的人注册,所以当给相关的人注册完账号后,需要去关闭注册账号功能。只需要去修改api组件的配置文件cfg.json,将signup_disable配置项修改为true,重启api即可。当需要给人开账号的时候,再将配置选项改回去,用完再关掉即可。

参考借鉴:

https://book.open-falcon.org/zh_0_2/quick_install/

https://www.cnblogs.com/tonglin0325/p/8978710.html

如有错漏,欢迎各位同学指教纠正,喜欢的可以点赞收藏加转发~

免责声明:本站所有文章内容,图片,视频等均是来源于用户投稿和互联网及文摘转载整编而成,不代表本站观点,不承担相关法律责任。其著作权各归其原作者或其出版社所有。如发现本站有涉嫌抄袭侵权/违法违规的内容,侵犯到您的权益,请在线联系站长,一经查实,本站将立刻删除。 本文来自网络,若有侵权,请联系删除,如若转载,请注明出处:https://yundeesoft.com/6099.html

(0)
上一篇 2022-12-18 15:50
下一篇 2022-12-18 16:10

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注

关注微信