|NO.Z.00076|——————————|^^ 编程 ^^|——|Hadoop&实时数仓.V02|——|实时数仓.v02|在Hadoop集群环境运行实时数仓程序.V2|
一、启动集群环境相关服务
### --- 启动zookeeper/kafka服务
~~~ # 启动zookeeper服务
[root@hadoop01 ~]# ./zk.sh start
~~~ # 启动kafka服务:所有节点
[root@hadoop01 ~]# kafka-server-start.sh -daemon /opt/yanqi/servers/kafka_2.12/config/server.properties
### --- 启动dfs/yarn服务
~~~ # 启动hdfs服务
[root@hadoop01 ~]# start-dfs.sh
~~~ # 启动yarn服务:可以不启动
[root@hadoop03 ~]# start-yarn.sh
### --- 启动canal服务
~~~ # 启动canal服务
[root@hadoop02 ~]# sh /opt/yanqi/servers/canal/bin/startup.sh
### --- 启动hbash服务
~~~ # 启动hbash服务
[root@hadoop02 ~]# start-hbase.sh
### --- 启动mysql服务
~~~ # 启动mysql服务
[root@hadoop03 ~]# systemctl start mysqld
### --- 启动redis服务
~~~ # 启动redis服务
[root@hadoop03 ~]# /opt/yanqi/servers/redis/bin/redis-server /opt/yanqi/servers/redis/bin/redis.conf
二、启动监控相关服务
### --- 启动prometheus服务
~~~ # 启动prometheus服务
~~~ # web-UI:http://hadoop02:9090/targets
[root@hadoop02 ~]# systemctl start prometheus
### --- 启动node_exporter服务:所有节点
~~~ # 启动node_exporter服务:所有节点
[root@hadoop02 ~]# systemctl start node_exporter.service
### --- 启动Pushgateway服务
~~~ # 启动Pushgateway服务
~~~ # web-UI:http://hadoop02:9091/#
[root@hadoop02 ~]# systemctl start pushgateway.service
### --- 启动grafana服务
~~~ # 启动grafana服务
~~~ # web-UI:http://hadoop02:3000
[root@hadoop02 ~]# systemctl status grafana-server
三、在hbash下创建相关表
### --- 在hbash中创建表:
~~~ # 在hbash中创建数据表
[root@hadoop02 ~]# /opt/yanqi/servers/hbase-1.3.1/bin/hbase shell
~~~在hbash中创建表:
hbase(main):001:0> create 'dim_yanqi_area', 'f1'
hbase(main):002:0> create 'yanqi_area', 'f1'
hbase(main):003:0> create 'yanqi_trade_orders', 'f1'
~~~辅助表:
hbase(main):004:0> create 'yanqi_trade_order', 'f1'
hbase(main):005:0> create 'dwd_yanqi_area', 'f1'
### --- 查看表中是否有数据
~~~ # 查看orders表中的数据
hbase(main):007:0> scan 'yanqi_trade_orders'
ROW COLUMN+CELL
~~~当前没有数据
四、启动kafka生产者和消费者
### --- 启动kafka生产者
~~~ # 启动kafka生产者
[root@hadoop02 ~]# kafka-console-producer.sh --broker-list hadoop02:9092 --topic canal
### --- 启动kafka消费者
~~~ # 启动kafka消费者
[root@hadoop02 ~]# kafka-console-consumer.sh --zookeeper hadoop02:2181/myKafka --topic canal --from-beginning
~~~等待消费数据
Walter Savage Landor:strove with none,for none was worth my strife.Nature I loved and, next to Nature, Art:I warm'd both hands before the fire of life.It sinks, and I am ready to depart
——W.S.Landor