Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to solve the problem of storm trident distributed query

Shulou Source: shulou.com Published: 2022-05-31 17:18:32 09月25日 Update

This article mainly explains "how to solve the problem of storm trident distributed query", interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to solve the problem of storm trident distributed query.

The background is a simple scenario where sentences are read from a document, and then the number of times each word appears is calculated, and the results are stored in MyMemoryMapState.

Then do a distributed query:

Topology.newDRPCStream ("word", drpc) / / the default input fields is "args" .stateQuery (wordCounts, new Fields ("args"), new MapGet (), new Fields ("count"))

Code for drpc invocation

Drpc.execute ("word", "first")

The result shows that sometimes the query is null, sometimes there is data. It's strange that since you already have data in memory, why can't you find it?

Later I tried to modify the distributed query code.

The default input fields for topology.newDRPCStream ("word", drpc) / / is "args" .groupBy (new Fields ("args")) .stateQuery (wordCounts, new Fields ("args"), new MapGet (), new Fields ("count"))

And then the results can be queried every time. I don't understand why we have to groupby. Need to know the process of stateQuery!

At this point, I believe you have a deeper understanding of "how to solve the problem of storm trident distributed query". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Query distributed question result code content data sometimes learning input practical deeper interest memory words sentences scenarios practicality practical simple operation Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology Shulou Information MariaDB Linux Apple