Skip to content

Latest commit

 

History

History
223 lines (168 loc) · 6.99 KB

Session I (Demo).md

File metadata and controls

223 lines (168 loc) · 6.99 KB

Session I - The Basic Guided Tour

Prerequisite: See details here.
Suggested Reading: Getting Started.

Basic AnyLog commands

The basic AnyLog commands demonstrated in the Onboarding session:

Help commands

See details in the help command section.
Examples:

help
help index
help index streaming
help run kafka consumer

The logged events

Multiple logs that track events - logs examples: event log, error log, rest log, query log (needs to be enabled).

Examples:

get event log
get error log

The node name

The name on the CLI prompt can be set by the user to identify the node when multiple CLIs are used.

node_name = generic

The assignment above makes the CLI prompt appear as:

AL generic > 

The local dictionary

The local dictionary maps local values (like paths names and IPs) to unified names that can be shared across nodes.

Details are in the local dictionary section.

Examples:

get dictionary
abc = 123
!abc

!blockchain_file

get env var
$HOME

Use the local dictionary to see the local folders' setup:

get dictionary _dir

Details are in the local directory structure.

The communication services

Each node can offer 3 types of communication services:

Service Name Service Type
TCP A service allowing the node to send and receive messages from peer nodes using the AnyLog Network Protocol
REST A service allowing the node communicate with 3rd parties applications and data sources using REST
Messaging A message broker service allowing data sources and 3rd parties applications to publish data on the node

Enable the TCP and REST services and view existing connections:

get connections   # command returns no connection

run tcp server where internal_ip = !ip and internal_port = 20048 and external_ip = !external_ip and external_port = 20048 and bind = false and threads = 6
run rest server where internal_ip = !ip and internal_port = 20049 and external_ip = !external_ip and external_port = 20049 and bind = false

get connections     # command returns the details of each communication service

Disable authentication:

set authentication off      # The training ignors authentication of users, nodes and their permissions

Enable message queue:

set echo queue on

echo this is a test message
get echo queue

Test node configuration

A node can validate proper configurations using the test node command.

test node

Details are available here.

Connecting to a DBMS

Supported databases: PostgreSQL for larger nodes and SQLite for smaller nodes or data in RAM.

2 system databases:
- system_query - orchestrate query results - almgm - tracks data ingestion and Manage HA

Connect to a dbms:

connect dbms system_query where type = sqlite and memory = true # Used for local processing
get databases

The Metadata

Details are available in Managing Metadata and Blockchain Commands.

Get metadata from a peer node

Copy the metadata from a peer node in the network. See details here.

blockchain seed from [ip:port]

Note: the proper way to provide the metadata to a node is to enable the blockchain synchronizer service on the node.
This process will update the node continuously with updates to the metadata. Details are available here.

Examples of metadata commands:

blockchain get *
blockchain get operator

blockchain get operator bring.table [operator][name] [operator][city] [operator][ip]  [operator][port] 
blockchain get operator where [city] = toronto  bring.table [operator][name] [operator][city] [operator][ip]  [operator][port] 

blockchain get operator where [city] = toronto  bring [operator][ip] : [operator][port] separator = ,

blockchain get operator where [city] = toronto  bring.ip_port

Test node connectivity with peers

A process to validate that the node can communicate with peers in the network. See details here.

test network

Execute commands on a peer node

Use the TCP connection to communicate with peers.

  • With a single peer: run client ip:port
  • With multiple peers: run client (ip:port, ip:port, ip:port ...)

Examples:

run client 23.239.12.151:32348 get status
run client 23.239.12.151:32348 get disk usage .
run client 23.239.12.151:32348 get cpu usage

Monitoring commands:

Additional info is in the following sections:

Examples:

run client (blockchain get operator where [city] = toronto  bring.ip_port) get status

run client (blockchain get operator where [city] = toronto  bring.ip_port) get disk usage .

destination = blockchain get operator where [city] = toronto  bring.ip_port

!destination

run client (!destination) get status
run client (!destination) get disk usage .
run client (!destination) get memory info

run client (!destination) get processes

run client (!destination) get databases

help continuous
continuous cpu  

Data setup:

Examples:

get virtual tables
get tables where dbms = litsanleandro
get columns where table = ping_sensor and dbms = litsanleandro

get data nodes

Data Query

Details are in the query section.

Examples:

run client () sql litsanleandro format = table "select insert_timestamp, device_name, timestamp, value from ping_sensor WHERE timestamp > NOW() - 1 day limit 100"
run client () sql litsanleandro format = table "select count(*), min(value), max(value) from ping_sensor WHERE timestamp > NOW() - 1 day;"

query status

run client () sql edgex format=table "select increments(minute, 1, timestamp), min(timestamp) as min_ts, max(timestamp) as max_ts, min(value) as min_value, avg(value) as avg_value,  count(*) as row_count from rand_data where timestamp >= NOW() - 1 hour;"

run client () sql edgex format=table "select timestamp, value FROM rand_data WHERE period(minute, 5, NOW(), timestamp) ORDER BY timestamp"

The remote CLI (Demonstrating 3rd party application interacting with the network):

Connection via the REST protocol.
Queries and commands can be issued on the Remote CLI.
Examples:

get status
get dictionary
get databases