3.2.5 把整个消费模块打包到集群中运行

我们不可能每次都在 idea 中运行我们的消费者模块程序, 也需要打包到集群上运行.

由于缺少一些必须的依赖 jar 包, 所以需要先下载依赖 jar 包


步骤1: 使用 pom.xml 文件, 让 maven 自动帮我们下载依赖

pom.xml copy 到 /opt/module/telecom 目录下.

稍微修改下pom.xmlparent去掉

然后执行下面的命令开始下载 jar 包, 并把下载到的 jar 包自动 copy 到./lib 目录下

# 如果 ./lib 目录不存在会自动创建
mvn dependency:copy-dependencies -DoutputDirectory=./lib

步骤2: 把消费模块的 jar 包 copy 到 /opt/module/telecom 目录下, 并执行

java -Djava.ext.dirs=./lib -cp consumer.jar com.atguigu.dataconsumer.HBaseConsumer

可以编写执行脚本, 方便执行.

Copyright © 尚硅谷大数据 2019 all right reserved,powered by Gitbook
该文件最后修订时间: 2018-12-27 20:16:27

results matching ""

    No results matching ""