我已经开始学习卡夫卡了。尝试对其进行基本操作。我一直坚持关于“经纪人”的观点。
我的 kafka 正在运行,但是当我想创建一个分区时。
from kafka import TopicPartition
(ERROR THERE) consumer = KafkaConsumer(bootstrap_servers='localhost:1234')
consumer.assign([TopicPartition('foobar', 2)])
msg = next(consumer)
Run Code Online (Sandbox Code Playgroud)
回溯(最近一次调用):文件“”,第 1 行,在文件“/usr/local/lib/python2.7/dist-packages/kafka/consumer/group.py”中,第 284 行,在init self._client = KafkaClient(metrics=self._metrics, **self.config) 文件 "/usr/local/lib/python2.7/dist-packages/kafka/client_async.py", line 202, in init self.config['api_version '] = self.check_version(timeout=check_timeout) 文件“/usr/local/lib/python2.7/dist-packages/kafka/client_async.py”,第 791 行,在 check_version 中引发 Errors.NoBrokersAvailable() kafka.errors。 NoBrokersAvailable:NoBrokersAvailable
python apache-kafka kafka-consumer-api kafka-python kafka-producer-api
您好,我开始了火花流学习,但我无法运行简单的应用程序我的代码在这里
import org.apache.spark._
import org.apache.spark.streaming._
import org.apache.spark.streaming.StreamingContext._
val conf = new SparkConf().setMaster("spark://beyhan:7077").setAppName("NetworkWordCount")
val ssc = new StreamingContext(conf, Seconds(1))
val lines = ssc.socketTextStream("localhost", 9999)
val words = lines.flatMap(_.split(" "))
Run Code Online (Sandbox Code Playgroud)
我收到如下错误
scala> val newscc = new StreamingContext(conf, Seconds(1))
15/10/21 13:41:18 WARN SparkContext: Another SparkContext is being constructed (or threw an exception in its constructor). This may indicate an error, since only one SparkContext may be running in this JVM (see SPARK-2243). The other SparkContext was created at:
Run Code Online (Sandbox Code Playgroud)
谢谢
我正在创建一种机器学习算法,并希望将其导出。假设我正在使用scikit学习库和随机森林算法。
modelC=RandomForestClassifier(n_estimators=30)
m=modelC.fit(trainvec,yvec)
Run Code Online (Sandbox Code Playgroud)
模型
如何导出它或有任何功能?
python ×2
apache-kafka ×1
apache-spark ×1
kafka-python ×1
python-2.7 ×1
scala ×1
scikit-learn ×1