我在发现Apache Ignite并创建了一个类似于其字数统计示例的简单应用程序。它将来自多个.txt文件的单词放入缓存中。我可以在Java应用程序的SqlFieldsQuery类的帮助下查询这些单词。Apache Zeppelin'Ignite node'在与Ignite集成时无法启动Ignite node'错误
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。
首先,我启动Ignite节点和客户端节点,它将单词连续地流入“单词”缓存。然后我试图在齐柏林纸币中执行SQL查询,并不断收到
Failed to start Ignite node
错误。
这种行为可能是什么原因造成的?我的项目中使用的Ignite版本是2.1.0,Zeppelin二进制文件的版本是0.7.2,是否会导致问题?或者可能是ignite.jdbc.url
属性值有问题? jdbc:ignite://localhost:11211/words
刚拿到它的工作建立飞艇!问题出在Ignite的版本上。我在我的项目中将其更改为1.9.0,并解决了问题。这个链接真的很有用https://zeppelin.apache.org/supported_interpreters.html – samba