首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Apache在与Ignite集成时未能启动Ignite节点

Apache在与Ignite集成时未能启动Ignite节点
EN

Stack Overflow用户
提问于 2017-09-21 10:57:35
回答 1查看 204关注 0票数 1

我正在发现Apache,并创建了一个简单的应用程序,类似于他们的单词计数示例。它将多个.txt文件中的单词流到缓存中。我可以在Java应用程序中使用SqlFieldsQuery类来查询这些单词。

代码语言:javascript
复制
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);
                                }}}}}}}}

现在,我决定使用从Ignite缓存中检索这些单词。但由于某种原因,我整合齐柏林飞艇和伊格尼特的尝试失败了。我遵循本教程https://apacheignite-tools.readme.io/docs/apache-zeppelin并配置Ignite解释器,类似于他们的建议。

首先,启动Ignite节点和客户端节点,该节点不断地将单词流到“word”缓存中。然后,我尝试在齐柏林飞艇中执行SQL查询,并继续获取Failed to start Ignite node错误。

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

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-09-21 11:46:26

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

看来齐柏林最新的代码库支持ApacheIgnite2.1 https://github.com/apache/zeppelin/pull/2549

因此,您可以尝试从源Apache的点燃解释器构建齐柏林飞艇。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46342161

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档