gpt4 book ai didi

java - 与 Ignite 集成时出现 Apache Zeppelin 'Failed to start Ignite node' 错误

转载 作者:行者123 更新时间:2023-11-30 02:22:58 27 4
gpt4 key购买 nike

我发现了 Apache Ignite 并创建了一个类似于其字数统计示例的简单应用程序。它将多个 .txt 文件中的单词流式传输到缓存中。我可以在 Java 应用程序中的 SqlFieldsQuery 类的帮助下查询这些单词。

public class NodeStartup {

public static void main(String[] args) throws IgniteException {
// Start Server Node
Ignition.start("config/example-ignite.xml");
}
}

public class StreamWordsToCache {
public static void main(String[] args) throws Exception {
// Mark the cluster member as a Client
Ignition.setClientMode(true);

// Start a Client Node
try (Ignite ignite = Ignition.start("config/example-ignite.xml")) {
// Checks if Server nodes not found
if (!ExamplesUtils.hasServerNodes(ignite))
return;

// If cache doesn't exist, create it within the cluster, otherwise use the existing one
IgniteCache<AffinityUuid, String> theCache = ignite.getOrCreateCache(CacheConfig.wordsCache());

// Create Streamers for the cache
try (IgniteDataStreamer<AffinityUuid, String> theStreamer = ignite.dataStreamer(theCache.getName())) {

//Stream words from articles
while (true) {
File directory = new File("src/main/resources/");
if (directory.listFiles() != null) {
List<File> filesInDir = new ArrayList<>(Arrays.asList(directory.listFiles()));
for (File file : filesInDir) {
System.out.println("Start reading file : " + file.getName());
try (LineNumberReader lineNumberReader = new LineNumberReader(new FileReader(file))) {
for (String line = lineNumberReader.readLine(); line != null; line = lineNumberReader.readLine()) {
for (String word : line.split(" "))
if (!word.isEmpty() && word.matches("(?!(?:that|with|from))\\b(?<!\\b[-.])[^\\d\\W]{4,}+\\b(?![-.]\\b)"))
// Stream words into Ignite
// Unique key (AffinityUuid) is created for each word
// AffinityUuid ensures that identical words are processed on the same cluster node
// in order to process them faster
theStreamer.addData(new AffinityUuid(word), word);
}}}}}}}}

现在我决定使用 Apache Zeppelin 从 Ignite 缓存中检索这些单词。但由于某种原因,我尝试整合 Zeppelin 和 Ignite 失败了。我正在关注本教程 https://apacheignite-tools.readme.io/docs/apache-zeppelin并按照他们的建议配置了 Ignite Interpreter。

enter image description here首先,我启动 Ignite 节点和客户端节点,将单词连续流式传输到“单词”缓存中。然后我尝试在 Zeppelin 注释中执行 SQL 查询,并不断收到 Failed to start Ignite node 错误。 enter image description here enter image description here

造成这种行为的原因可能是什么?我的项目中使用的 Ignite 版本是 2.1.0,Zeppelin 二进制文件是 0.7.2,这会导致问题吗?或者 ignite.jdbc.url 属性值可能有问题?jdbc:ignite://localhost:11211/words

最佳答案

您的 Zeppelin 版本 (0.7.2) 已通过 Apache Ignite 1.9.0 认证因此,我认为您问题的根本原因是 Ignite 版本不同。

看起来Zeppelin最新的代码库支持Apache Ignite 2.1 https://github.com/apache/zeppelin/pull/2549

所以,你可以尝试从源代码构建 Zeppelin Ignite Interpreter for Apache Zeppelin

关于java - 与 Ignite 集成时出现 Apache Zeppelin 'Failed to start Ignite node' 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46342161/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com