在Linux上怎么安装和配置Apache Samza(2)

root@dev:/usr/local/hello-samza# mvn clean package
root@dev:/usr/local/hello-samza# mkdir -p deploy/samza
root@dev:/usr/local/hello-samza# tar -xvf ./target/hello-samza-0.10.0-dist.tar.gz -C deploy/samza


执行Samza任务:

完成build Samza包之后,你就可以在grid使用t run-job.sh 脚本来完成一些任务了

root@dev:/usr/local/hello-samza # deploy/samza/bin/run-job.sh --config-factory=org.apache.samza.config.factories.PropertiesConfigFactory --config-path=file://$PWD/deploy/samza/config/wikipedia-feed.properties
 

上面的这个任务将会从Wikipedia上把实施反馈编辑撤销掉,会把这些编辑放到一个叫“thelinuxfaq-raw”的主题里面去.

让这个主题运行几分钟后,你再来看下Kafka 最后面的更新情况:

root@dev:/usr/local/hello-samza#  deploy/kafka/bin/kafka-console-consumer.sh  --zookeeper localhost:2181 --topic thelinuxfaq-raw


再次访问YARN UI界面(:8088). 你就看到Samza很正常的运行而不是有错误提示了!

关闭Samza:

一切都弄好了,你就可以使用grid脚本关闭所有的相关服务器了.
root@dev:/usr/local/hello-samza #  bin/grid stop all

输出示例:
EXECUTING: stop all
EXECUTING: stop kafka
EXECUTING: stop yarn
stopping resourcemanager
stopping nodemanager
EXECUTING: stop zookeeper
JMX enabled by default
Using config: /usr/local/hello-samza/deploy/zookeeper/bin/../conf/zoo.cfg
Stopping zookeeper ... STOPPED

启动Samza :

同意的,你可以使用grid脚本来启动所有服务,

root@dev:/usr/local/hello-samza #  bin/grid start all

输出示例:
EXECUTING: start all
EXECUTING: start zookeeper
JMX enabled by default
Using config: /usr/local/hello-samza/deploy/zookeeper/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
EXECUTING: start yarn
....
EXECUTING: start kafka

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/10876656a4b962fbb2f5a3365c1c60f9.html