2017-11-11 183 views
0

我'初学者卡夫卡开始动物园管理员和卡夫卡服务器上的文件被意外

1 /我下载卡夫卡的1.0.0版本

2 /我在bith server.properties更改的数据目录位置和属性zookeeper.properties

\设置\ server.properties \ CONFIG \ zookeeper.properties

3 /当我尝试启动动物园管理员和卡夫卡服务器 我有一个错误“Files was unexpected”

D:\ kafka-1.0.0-src \ kafka-1.0.0-src \ bin \ windows> zookeeper-server-start.bat .... \ config \ zookeeper。属性 文件étaitinattendu。

d:\卡夫卡-1.0.0-SRC \卡夫卡-1.0.0-SRC \ BIN \ WINDOWS>卡夫卡服务器的start.bat .... \设置\ server.properties 文件étaitinattendu 。

你能帮我吗?

回答

0

我假设饲养员&卡夫卡在每个用户自己的文件夹为“kafkaflume”

有kafkaflume文件夹内的2个文件夹:一个是饲养员,另外一个是卡夫卡 这里一个配置文件也给出了:flumekafka。 conf

您需要根据您的要求编辑此文件。

首先需要启动饲养员:

打开一个终端,去动物园管理员文件夹,并启动它:

bin/zkServer.sh start 

打开另一个终端,去卡夫卡的文件夹,并启动它:

bin/kafka-server-start.sh config/server.properties

打开另一个终端,进入kafka文件夹并启动生产程序为:

bin/kafka-console-producer.sh --broker-list localhost:9092 --topic <topicname> 

现在编辑flumekafka.conf文件以及数据加载准备HDFS文件夹。

现在从控制台运行flume agent命令。

======================= Flume的配置文件: =============== ========

# Name the components on this agent 
agent.sources = r1 
agent.sinks = k2 
agent.channels = c1 


# Describe/configure the source 
agent.sources.r1.type = org.apache.flume.source.kafka.KafkaSource 
agent.sources.r1.zookeeperConnect = localhost:2181 
agent.sources.r1.topic = <topicname> 
agent.sources.r1.groupId = group1 
agent.sources.r1.channels = c1 
agent.sources.r1.interceptors = i1 
agent.sources.r1.interceptors.i1.type = timestamp 
agent.sources.r1.kafka.consumer.timeout.ms = 10000 



# Describing/Configuring the sink 
agent.sinks.k2.type = hdfs 
agent.sinks.k2.hdfs.path = hdfs://localhost:8020/user/<username>/<foldername>/%y-%m-%d 
agent.sinks.k2.hdfs.rollInterval = 5 
agent.sinks.k2.hdfs.rollSize = 0 
agent.sinks.k2.hdfs.rollCount = 0 
agent.sinks.k2.hdfs.fileType = DataStream 
agent.sinks.k2.channel = c1 


# Describing/Configuring the channel agent.channels.MemChannel.type = memory 
agent.channels.c1.type=memory 
agent.channels.c1.capacity = 10000 
agent.channels.c1.transactionCapacity = 1000 
+0

为了更好的理解,我已经编写了Flume conf文件配置文件以满足您的其他需求或用途,请忽略它是否需要。 我希望它能帮助你@Eliane PDC –

0

谢谢Bhaskar您的回复,我的问题是我的JAVA_HOME在文件夹名称“程序文件”中有一些空格。