Using node shell of Metatron distributed Druid

Created with Sketch.

Using node shell of Metatron distributed Druid


Notice: Undefined offset: 1 in /data/httpd/www/html/wp-includes/media.php on line 70
0
(0)

The Metatron distributed Druid provides a shell for viewing various information of Druid. Most of the functions provided by the shell can be checked through Druid’s API. However, the shell makes it possible to use most of the functionality provided by the Druid API without the need for a separate tools like curl.

Let’s look at how to run the node shell.

First, install the latest Metatron distributed Druid. Metatron distribution Druid can be downloaded from release of GitHub and the URL is as follows: https://github.com/metatron-app/metatron-discovery/releases

Unpack the latest Metatron distributed Druid to the appropriate directory and run start-single.sh from the Druid Home directory. If the execution of Druid succeeds, run the Druid node shell with the following command.

bin/node.sh tools shell 

When the node shell is executed, the node shell prompt is displayed. Use the help command to display the available commands.

> help
loadstatus
loadqueue
servers [-full|-simple]
server <server-name> [-simple]
segments <server-name> [-full]
segment <server-name> <segment-id>
datasources [-regex=<name-regex >] [-full|-simple]
datasource <datasource-name> [-full|-simple|-lastUpdated]
datasource <datasource-name> -intervals|-interval=<interval> [-full|-simple]
datasource <datasource-name> -segments|-segment=<segment> [-full]
datasource <datasource-name> -disable -interval=<interval>|-segment=<segment>
datasource <datasource-name> -tiers
desc <datasource-name> DS_COMMENT
desc <datasource-name> DS_PROPS
desc <datasource-name> COLUMNS_COMMENTS
desc <datasource-name> COLUMN_PROPS <column-name>
desc <datasource-name> VALUES_COMMENTS <value>
dynamicConf
tiers [-simple]
tier <tier-name> [-simple]
rules [-simple]
rule <datasource-name> [-full]
lookups [-discover]
lookup <tier-name> [lookup-name]
tasks [-simple] [-completed [-recent=<duration>]]
task <task-id> [-status|-segments|-log]
query <datasource-name> <intervals> [-full]
sql <sql-string>

Most of the commands except the sql one are also provided as APIs of Druid. For a description of the functions, refer to the following URL: https://druid.apache.org/docs/latest/operations/api-reference.html

The SQL command executes a shell that can execute a separate Druid SQL, which allows you to execute SQL on Druid.


> sql
sql> select * from sales_geo limit 10;
2019-09-25T13:54:21,667 INFO [main] com.metamx.http.client.pool.ChannelResourceFactory - Generating: http://172.23.253.176:8082
2019-09-25T13:54:21,667 INFO [main] com.metamx.http.client.pool.ChannelResourceFactory - Generating: http://172.23.253.176:8082
2019-09-25T13:54:21,667 INFO [main] com.metamx.http.client.pool.ChannelResourceFactory - Generating: http://172.23.253.176:8082
2019-09-25T13:54:21,668 INFO [main] com.metamx.http.client.pool.ChannelResourceFactory - Generating: http://172.23.253.176:8082
2019-09-25T13:54:21,668 INFO [main] com.metamx.http.client.pool.ChannelResourceFactory - Generating: http://172.23.253.176:8082
2019-09-25T13:54:21,668 INFO [main] com.metamx.http.client.pool.ChannelResourceFactory - Generating: http://172.23.253.176:8082
2019-09-25T13:54:21,669 INFO [main] com.metamx.http.client.pool.ChannelResourceFactory - Generating: http://172.23.253.176:8082
2019-09-25T13:54:21,669 INFO [main] com.metamx.http.client.pool.ChannelResourceFactory - Generating: http://172.23.253.176:8082
2019-09-25T13:54:21,669 INFO [main] com.metamx.http.client.pool.ChannelResourceFactory - Generating: http://172.23.253.176:8082
2019-09-25T13:54:21,670 INFO [main] com.metamx.http.client.pool.ChannelResourceFactory - Generating: http://172.23.253.176:8082
2019-09-25T13:54:21,670 INFO [main] com.metamx.http.client.pool.ChannelResourceFactory - Generating: http://172.23.253.176:8082
2019-09-25T13:54:21,670 INFO [main] com.metamx.http.client.pool.ChannelResourceFactory - Generating: http://172.23.253.176:8082
2019-09-25T13:54:21,671 INFO [main] com.metamx.http.client.pool.ChannelResourceFactory - Generating: http://172.23.253.176:8082
2019-09-25T13:54:21,671 INFO [main] com.metamx.http.client.pool.ChannelResourceFactory - Generating: http://172.23.253.176:8082
2019-09-25T13:54:21,671 INFO [main] com.metamx.http.client.pool.ChannelResourceFactory - Generating: http://172.23.253.176:8082
2019-09-25T13:54:21,672 INFO [main] com.metamx.http.client.pool.ChannelResourceFactory - Generating: http://172.23.253.176:8082
2019-09-25T13:54:21,672 INFO [main] com.metamx.http.client.pool.ChannelResourceFactory - Generating: http://172.23.253.176:8082
2019-09-25T13:54:21,672 INFO [main] com.metamx.http.client.pool.ChannelResourceFactory - Generating: http://172.23.253.176:8082
2019-09-25T13:54:21,673 INFO [main] com.metamx.http.client.pool.ChannelResourceFactory - Generating: http://172.23.253.176:8082
2019-09-25T13:54:21,673 INFO [main] com.metamx.http.client.pool.ChannelResourceFactory - Generating: http://172.23.253.176:8082
  [Category, City, Country, CustomerName, DaystoShipActual, DaystoShipScheduled, Discount, OrderID, PostalCode, ProductName, Profit, ProfitRatio, Quantity, Region, Sales, SalesAboveTarget, SalesForecast, SalesperCustomer, Segment, ShipDate, ShipMode, ShipStatus, State, Sub-Category, __time, count, latitude, location, longitude, orderprofitable]
  --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  [Office Supplies, Houston, United States, Darren Powers, 4.0, 6.0, 0.2, CA-2011-103800, 77095, Message Book, Wirebound, Four 5 1/2 X 4 Forms/Pg., 200 Dupl. Sets/Book, 6.0, 33.8, 2, Central, 16.0, null, 22.0, 16.45, Consumer, 2011. 1. 8., Standard Class, Shipped Early, Texas, Paper, 2011-01-04T00:00:00.000Z, 1, 29.8941, java.util.ArrayList, -95.6481, null]
  [Office Supplies, Naperville, United States, Phillina Ober, 4.0, 6.0, 0.2, CA-2011-112326, 60540, Avery 508, 4.0, 36.3, 3, Central, 12.0, null, 15.0, 11.78, Home Office, 2011. 1. 9., Standard Class, Shipped Early, Illinois, Labels, 2011-01-05T00:00:00.000Z, 1, 41.7662, java.util.ArrayList, -88.141, null]
  [Office Supplies, Naperville, United States, Phillina Ober, 4.0, 6.0, 0.8, CA-2011-112326, 60540, GBC Standard Plastic Binding Systems Combs, -5.0, -155.0, 2, Central, 4.0, null, 5.0, 3.54, Home Office, 2011. 1. 9., Standard Class, Shipped Early, Illinois, Binders, 2011-01-05T00:00:00.000Z, 1, 41.7662, java.util.ArrayList, -88.141, null]
  [Office Supplies, Naperville, United States, Phillina Ober, 4.0, 6.0, 0.2, CA-2011-112326, 60540, SAFCO Boltless Steel Shelving, -65.0, -23.8, 3, Central, 273.0, null, 357.0, 272.74, Home Office, 2011. 1. 9., Standard Class, Shipped Early, Illinois, Storage, 2011-01-05T00:00:00.000Z, 1, 41.7662, java.util.ArrayList, -88.141, null]
  ...
> Retrieved 10 rows in 102 msec
sql> ;

Clearly, the Node shell is a duplicate of Druid’s API, but does not require a separate tool to call a REST API and saves you from having to write down the long URL of the API each time. It also provides administrators convenience by integrating most management functions into one.

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

As you found this post useful...

Share this post on your social media!

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?

Leave a Reply

Your email address will not be published. Required fields are marked *