2017-11-11 179 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在文件夾名稱「程序文件」中有一些空格。