数据获取和存储综合-----进行kafka,flume,和hive的数据综合处理实验

依次输入命令开启ssh服务、开启mysql、启动hdfs、启动yarm、启动Zookeepr

 输入hive进入hive

创建一张表,用来放数据:create table kafkatest(id int,name string,age int) clustered by(id) into 2 buckets stored as orc tblproperties('transactional'='true');

然后输入exit;退出hive

再重新启动一个终端,输入cd ~/bigdata/kafka_2.11-1.0.0 进入kafka目录下。

输入:nohup bin/kafka-server-start.sh config/server.properties >~/bigdata/kafka_2.11-1.0.0/logs/server.log 2>&1 &

后台启动kafka。

输入bin/kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic kafkatest创建一个kafka的topic。

扫描二维码关注公众号,回复: 6516129 查看本文章

再启动一个终端,输入:cd ~/bigdata/apache-flume-1.9.0-bin

进入flume目录下,输入:bin/flume-ng agent --conf conf/ --conf-file conf/kafkatoh启动flume。

 回到kafka目录下的终端(第二个打开的终端),输入:bin/kafka-console-producer.sh --broker-list localhost:9092 --topic kafkatest启动kafka的consumer。

向启动好的kafka中输入1,a,3(1对应hive表中的id,a对应name,3对应age,可以进行适当更换)。发现flume的终端在执行任务。
最后启动一个新的终端,输入hive,输入select * from kafkatest;可以查看到刚才键入的数据。

输入exit;退出hive。

猜你喜欢

转载自blog.csdn.net/weixin_44961794/article/details/91127737
今日推荐