快速部署DBus體驗實時數據流計算

1、環境說明

說明all in one是一個單機版本dbus環境,是給用戶快速體驗dbus的功能,只是一個簡單體驗版,不能用於其它環境或者用途,具體包括以下:node

1)基礎組建:mysql

  • 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相關包:linux

  • 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數據源所需:git

  • canal

1.1 環境依賴

安裝dbus-allinone環境的建議配置以下github

  • JDK 1.8.181 或 以上
  • CPU 2核 或以上
  • 內存 16GB或以上
  • 磁盤 20GB或以上

注:一臺Linux centos服務器, 該服務器最好是空機器,上面不要安裝dbus所依賴的zk,kafka,storm等sql

1.2 修改域名

注:ip是您的具體ip,這裏用192.168.0.1爲例子數據庫

修改服務器/etc/hosts文件設置相應的域名信息以下:apache

192.168.0.1 dbus-n1

修改服務器hostname命令以下:windows

hostname dbus-n1

配置好後,服務器IP和域名信息以下:centos

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、前期準備

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

3、安裝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

4、驗證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是否實時獲取到數據

5、驗證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

6、登陸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

租戶界面以下:

開源網址: https://github.com/BriData

相關文章
相關標籤/搜索