一, 环境说明
说明: all in one 是一个单机版本 dbus 环境, 是给用户快速体验 dbus 的功能, 只是一个简单体验版, 不能用于其它环境或者用途, 具体包括如下:
1) 基础组建:
- zookeeper 3.4.6
- kafka 0.10.0.0
- storm 1.0.1
- granfana 4.2.0
- logstash 5.6.1
- influxdb (需要单独安装, 参考如下步骤 3)
- MySQL (需要单独安装, 参考如下步骤 2)
2)dbus 相关包:
- dbus-keeper 0.5.0
- dbus-stream-main 0.5.0
- dbus-router 0.5.0
- dbus-heartbeat 0.5.0
- dbus-log-processor 0.5.0
3)MySQL 数据源所需:
canal
1.1 环境依赖
安装 dbus-allinone 环境的建议配置如下
JDK 1.8.181 或 以上
CPU 2 核 或以上
内存 16GB 或以上
磁盘 20GB 或以上
注: 一台 Linux CentOS 服务器, 该服务器最好是空机器, 上面不要安装 dbus 所依赖的 zk,kafka,storm 等
1.2 修改域名
注: ip 是您的具体 ip, 这里用 192.168.0.1 为例子
修改服务器 / etc/hosts 文件设置相应的域名信息如下:
192.168.0.1 dbus-n1
修改服务器 hostname 命令如下:
hostname dbus-n1
配置好后, 服务器 IP 和域名信息如下:
1.3 创建 App 用户及配置 SSH 免密登录
由于 dbus 启动拓扑采用的 SSH 调用 storm 命令, all in one 包中默认的调用 SSH 使用 App 用户和 22 端口, 因此要正常体验 all in one 需要创建 App 账户和配置 SSH 免密登录, 免密登录配置的从 dbus-n1 到 dbus-n1 的免密登录
配置完成后执行如下命令看时候配置成功
- [App@dbus-n1 ~]$ SSH -p 22 App@dbus-n1
- Last login: Fri Aug 10 15:54:45 2018 from 10.10.169.53
- [App@dbus-n1 ~]$
二, 前期准备
2.1 安装 MySQL
2.1.1 下载
推荐下载 MySQL 版本: 5.7.19 地址: https://dev.mysql.com/downloads/mysql/
2.1.2 安装
解压 MySQL-5.7.19-1.el6.x86_64.rpm-bundle.tar 包后, 执行以下命令安装:
- rpm -ivh MySQL-community-server-5.7.19-1.el6.x86_64.rpm --nodeps
- rpm -ivh MySQL-community-client-5.7.19-1.el6.x86_64.rpm --nodeps
- rpm -ivh MySQL-community-libs-5.7.19-1.el6.x86_64.rpm --nodeps
- rpm -ivh MySQL-community-common-5.7.19-1.el6.x86_64.rpm --nodeps
- rpm -ivh MySQL-community-libs-compat-5.7.19-1.el6.x86_64.rpm --nodeps
2.1.3 配置
在 / etc/my.cnf 配置文件中, 只是增加 bin-log 相关配置, 其他不用修改, 关注以下汉字注释部分
- [mysqld]
- # dbus 相关配置开始
- log-bin=MySQL-bin
- binlog-format=ROW
- server_id=1
- # dbus 相关配置结束
2.1.4 启动
执行以下命令启动 MySQL:
service mysqld start
2.2. 安装 InfluxDB
2.2.1 下载
推荐下载 InfluxDB 版本: influxdb-1.1.0.x86_64 地址: https://portal.influxdata.com/downloads
2.2.2 安装
在 dbus-n1 上切换到 root 用户, 在 influxdb-1.1.0.x86_64.rpm 的存放目录下执行如下命令:
rpm -ivh influxdb-1.1.0.x86_64.rpm
2.2.3 启动
在 dbus-n1 上执行如下命令:
service influxdb start
2.2.4 初始化配置
在 dbus-n1 上执行如下命令:
- # 登录 influx
- influx
- # 执行初始化脚本
- create database dbus_stat_db
- use dbus_stat_db
- CREATE USER "dbus" WITH PASSWORD 'dbus!@#123'
- ALTER RETENTION POLICY autogen ON dbus_stat_db DURATION 15d
三, 安装 Dbus-allinone 包
3.1 下载
在百度网盘提供 dbus-allinone.tar.gz 包, 访问 release 页面下载最新包: https://github.com/BriData/DBus/releases
3.2 安装
将下载的 dbus-allinone 包上传到服务器 /App 目录下, 且必须在此目录下
- # 如果没有 App 目录, 要先创建 App 目录
- mkdir /App
- cd /App
- tar -zxvf dbus-allinone.tar.gz
3.3 初始化数据库
以 root 身份登录 MySQL 客户端, 执行以下命令进行数据库初始化, 会创建 dbmgr 库以及用户, canal 用户, dbus 库以及用户, testschema 库以及用户:
source /App/dbus-allinone/sql/init.sql
3.4 启动
执行 start.sh 一键启动 dbus 所有服务, 启动项比较多.
- cd /App/dbus-allinone
- ./start.sh
请耐心等待 (大概需要 5 分钟左右时间), 正确的启动日志如下:
- Start grafana...
- Grafana started. pid: 23760
- =============================================================================================
- Start zookeeper...
- zookeeper pid 23818
- Zookeeper started.
- =============================================================================================
- Start kafka...
- No kafka server to stop
- kafka pid 24055
- kafka started.
- =============================================================================================
- Start Canal ...
- canal started.
- =============================================================================================
- Start logstash...
- No logstash to stop
- nohup: appending output to `nohup.out'
- logstash pid 24151
- logstash started.
- =============================================================================================
- Start storm nimbus...
- No storm nimbus to stop
- Storm nimbus pid 24215
- Storm nimbus started.
- =============================================================================================
- Start storm supervisor...
- No storm supervisor to stop
- Storm supervisor pid 24674
- Storm supervisor started.
- =============================================================================================
- Start storm ui...
- No storm ui to stop
- Storm ui pid 24939
- Storm ui started. ui port: 6672
- =============================================================================================
- Stop storm topology.
- Storm topology stoped.
- =============================================================================================
- Start storm topology...
- Storm topology started.
- =============================================================================================
- Start Dbus Heartbeat...
- No Dbus Heartbeat to stop
- Dbus Heartbeat pid 26854
- Dbus Heartbeat started.
- =============================================================================================
- Start Dbus keeper...
- =========================stop===========================
- keeper-proxy process not exist
- gateway process not exist
- keeper-mgr process not exist
- keeper-service process not exist
- register-server process not exist
- =========================start===========================
- register-server started. pid: 27077
- keeper-proxy started. pid: 27172
- gateway started. pid: 27267
- keeper-mgr started. pid: 27504
- keeper-service started. pid: 27645
- Dbus keeper prot: 6090
- Dbus keeper started.
- =============================================================================================
3.5 生成检查报告看是否启动正常
进入目录 / App/dbus-allinone/allinone-auto-check-0.5.0, 执行自动检测脚本 auto-check.sh, 稍等待一会儿
- cd /App/dbus-allinone/allinone-auto-check-0.5.0
- ./auto-check.sh
会在目录 / App/dbus-allinone/allinone-auto-check-0.5.0/reports 下生产对应时间的检查报告, 如下所示
- [App@dbus-n1 reports]$ tree
- .
└── 20180824111905
└── check_report.txt
打开 check_report.txt 文件查看相应的检查报告, 如下所示
- (注意以 #开头为解释说明信息, 报告中不会生成 )
- # 出现以下信息说明 dbusmgr 库正常
- check db&user dbusmgr start:
- ============================================
- table t_avro_schema data count: 0
- table t_data_schema data count: 4
- table t_data_tables data count: 4
- table t_dbus_datasource data count: 2
- table t_ddl_event data count: 0
- table t_encode_columns data count: 0
- table t_encode_plugins data count: 1
- table t_fullpull_history data count: 0
- table t_meta_version data count: 5
- table t_plain_log_rule_group data count: 1
- table t_plain_log_rule_group_version data count: 1
- table t_plain_log_rule_type data count: 0
- table t_plain_log_rules data count: 5
- table t_plain_log_rules_version data count: 5
- table t_project data count: 1
- table t_project_encode_hint data count: 1
- table t_project_resource data count: 1
- table t_project_sink data count: 1
- table t_project_topo data count: 1
- table t_project_topo_table data count: 1
- table t_project_topo_table_encode_output_columns data count: 1
- table t_project_topo_table_meta_version data count: 0
- table t_project_user data count: 1
- table t_query_rule_group data count: 0
- table t_sink data count: 1
- table t_storm_topology data count: 0
- table t_table_action data count: 0
- table t_table_meta data count: 7
- table t_user data count: 2
- # 出现以下信息说明 dbus 库正常
- check db&user dbus start:
- ============================================
- table db_heartbeat_monitor data count: 15
- table test_table data count: 0
- table db_full_pull_requests data count: 0
- # 出现以下信息说明 canal 用户正常
- check db&user canal start:
- ============================================
- master status File:MySQL-bin.000002, Position:12047338
- table db_heartbeat_monitor data count: 15
- table test_table data count: 0
- table db_full_pull_requests data count: 0
- # 出现以下信息说明 testschema 库正常
- check db&user testschema start:
- ============================================
- table test_table data count: 0
- # 出现以下信息说明 zk 启动正常
- check base component zookeeper start:
- ============================================
- 23818 org.apache.zookeeper.server.quorum.QuorumPeerMain
- # 出现以下信息说明 kafka 启动正常
- check base component kafka start:
- ============================================
- 24055 kafka.Kafka
- # 出现以下信息说明 storm nimbus,supervisor,ui 启动正常
- check base component storm start:
- ============================================
- 26500 org.apache.storm.daemon.worker
- 25929 org.apache.storm.daemon.worker
- 27596 org.apache.storm.LogWriter
- 26258 org.apache.storm.LogWriter
- 24215 org.apache.storm.daemon.nimbus
- 27035 org.apache.storm.LogWriter
- 27611 org.apache.storm.daemon.worker
- 26272 org.apache.storm.daemon.worker
- 24674 org.apache.storm.daemon.supervisor
- 24939 org.apache.storm.ui.core
- 26486 org.apache.storm.LogWriter
- 27064 org.apache.storm.daemon.worker
- 25915 org.apache.storm.LogWriter
- # 出现以下信息说明 influxdb 启动正常
- check base component influxdb start:
- ============================================
- influxdb 10265 1 0 Aug08 ? 02:28:06 /usr/bin/influxd -pidfile /var/run/influxdb/influxd.pid -config /etc/influxdb/influxdb.conf
- App 28823 28746 0 11:19 pts/3 00:00:00 /bin/sh -c ps -ef | grep influxdb
- App 28827 28823 0 11:19 pts/3 00:00:00 grep influxdb
- # 出现以下信息说明 grafana 启动正常
- check base component grafana start:
- ============================================
- App 23760 1 0 11:09 pts/3 00:00:00 ./grafana-server
- App 28828 28746 0 11:19 pts/3 00:00:00 /bin/sh -c ps -ef | grep grafana
- App 28832 28828 0 11:19 pts/3 00:00:00 grep grafana
- # 出现以下信息说明心跳 heartbeat 启动正常
- check base component heartbeat start:
- ============================================
- 26854 com.creditease.dbus.heartbeat.start.Start
- # 出现以下信息说明 logstash 启动正常
- check base component logstash start:
- ============================================
- 24151 org.jruby.Main
- # 出现以下信息说明 canal 启动正常
- check canal start:
- ============================================
- zk path [/DBus/Canal/otter-testdb] exists.
- 24105 com.alibaba.otter.canal.deployer.CanalLauncher
- # 出现以下信息说明 dispatcher-appender,MySQL-extractor,splitter-puller,router 启动正常
- check topology start:
- ============================================
- API: http://dbus-n1:6672/API/v1/topology/summary
- topology testlog-log-processor status is ACTIVE
- topology testdb-MySQL-extractor status is ACTIVE
- topology testdb-splitter-puller status is ACTIVE
- topology testdb-dispatcher-appender status is ACTIVE
- topology tr-router status is ACTIVE
- # 出现以下信息说明从数据库 ->extractor-dispatcher->appender 线路正常
- check flow line start:
- ============================================
- first step insert heart beat success.
- data arrive at topic: testdb
- data arrive at topic: testdb.testschema
- data arrive at topic: testdb.testschema.result
四, 验证 all in one 包是否安装成功
4.1 登录 grafana 前提
需要在通过浏览器登录 grafana 的机器配置 host 文件, 如果已经配置过请跳过此前提
如果验证机器是 Windows 系统, 修改 C:\Windows\System32\drivers\etc\hosts 文件设置相应的域名信息如下:
- # 192.168.0.1 替换成部署 allinone 包的服务器 ip 地址
- 192.168.0.1 dbus-n1
如果验证机器是 Linux 系统, 修改 / etc/hosts 文件设置相应的域名信息如下:
- # 192.168.0.1 替换成部署 allinone 包的服务器 ip 地址
- 192.168.0.1 dbus-n1
4.2 登录 grafana
登录 grafana url 地址: http://dbus-n1:3000/login
4.3 MySQL 插入数据验证
- # 登录测试用户
- MySQL -utestschema -p #testschema 账户密码: j0<C6cqcqr:TestSchema
- # 执行测试脚本
- use testschema;
- INSERT INTO test_table (NAME, BIRTHDAY) VALUES ('testdataname', '2018-08-10 18:00:00');
- INSERT INTO test_table (NAME, BIRTHDAY) VALUES ('testdataname', '2018-08-10 18:00:00');
- INSERT INTO test_table (NAME, BIRTHDAY) VALUES ('testdataname', '2018-08-10 18:00:00');
- INSERT INTO test_table (NAME, BIRTHDAY) VALUES ('testdataname', '2018-08-10 18:00:00');
- INSERT INTO test_table (NAME, BIRTHDAY) VALUES ('testdataname', '2018-08-10 18:00:00');
4.4 查看 DBus 是否实时获取到数据
五, 验证 logstash 抽取心跳日志是否安装成功
dbus-heartbeat 心跳模块儿产生日志位置在:/App/dbus-allinone/dbus-heartbeat-0.5.0/logs/heartbeat/heartbeat.log, 利用 logstash 抽取该日志文件, 把非结构化的数据, 提取成结构化的数据
5.1 日志中原始非结构化数据如下:
通过如下命令, 查看要提取的非结构化数据, 如下图所示, 每一分钟产生 3 条包含 "插入心跳包成功" 的日志
- cd /App/dbus-allinone/dbus-heartbeat-0.5.0/logs/heartbeat/
- tail -f heartbeat.log | grep "插入心跳包成功"
5.2 在 Dbus Keeper 上配置相应的结构化规则和查看规则执行后的结果
提取规则如下图:
规则执行后结果
5.3 在 grafana 查看实时提取流量监控
选择 log table deatil board
选择 table:testlog.testlog_schema.t_heartbeat_data
六, 登录 DBus Keeper 体检 UI 操作
6.1 登录 dbus keeper 前提
需要在通过浏览器登录 dbus keeper 的机器配置 host 文件, 如果已经配置过请跳过此前提
如果验证机器是 Windows 系统, 修改 C:\Windows\System32\drivers\etc\hosts 文件设置相应的域名信息如下:
- # 192.168.0.1 替换成部署 allinone 包的服务器 ip 地址
- 192.168.0.1 dbus-n1
如果验证机器是 Linux 系统, 修改 / etc/hosts 文件设置相应的域名信息如下:
- # 192.168.0.1 替换成部署 allinone 包的服务器 ip 地址
- 192.168.0.1 dbus-n1
6.2 登录 dbus keeper
登录 dbus keeper url 地址: http://dbus-n1:6090/login
体验管理员功能, 请使用用户: admin 密码: 12345678
管理员界面如下:
体验租户功能, 请使用用户: user@dbus.com 密码: 12345678
租户界面如下:
Git 地址: https://github.com/BriData
来源: http://blog.51cto.com/14159827/2421024