The Basic Guided Tour

Suggeted Readings

Basic EdgeLake commands

The basic EdgeLake commands demonstrated in the Onboarding session:

  • Help commands - See details in the help command section
    help
    help index
    help index streaming
    help run kafka consumer
  • Log Events - Logs that track events - logs examples: event log, error log, rest log, query log (needs to be enabled).
    get event log
    get error log
  • 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:
    EL generic >
    
  • Local Directories - The local dictionary maps local values (like paths names and IPs) to unified names that can be shared across nodes. Farther Details
    get dictionary
    abc = 123
    !abc
    !blockchain_file
    get env var
    $HOME
    
    # Use the local dictionary to see the local folders' setup:
    get dictionary _dir
    

Communication Services

Each node can offer 3 types of communication services:

Service NameService Type
TCPA service allowing the node to send and receive messages from peer nodes using the AnyLog Network Protocol
RESTA service allowing the node communicate with 3rd parties applications and data sources using REST
MessagingA message broker service allowing data sources and 3rd parties applications to publish data on the node

Node Configuration

  • Enable the TCP and REST services and view existing connections:
    # command returns no connection
    get connections
    
    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
    
    # command returns the details of each communication service
    get connections   
    
  • 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 dbms system_query where type = sqlite and memory = true # Used for local processing
    get databases
    

Metadata

A node in the network interacts with 2 layers of metadata:

  • With a local metadata layer. The local metadata layer includes the local databases, tables and views that are used by the node to organize the data locally such that the data is unified with data on peer nodes and is accessible to permitted members of the network.
  • With a global metadata layer shared by all the members of the network.

Details are available in Managing Metadata and Blockchain Commands

  • 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
    

Communicating with Peers

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 ...)
  • Test node connectivity with peers - A process to validate that the node can communicate with peers in the network. See details here.
    test network
  • Communicating with Other Nodes
    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

The following examples use !destination, this is value is derived from the blockchain metadata

destination = blockchain get operator where [city] = toronto  bring.ip_port
  • Monitoring Nodes
    run client (!destination) get status
    run client (!destination) get disk usage .
    run client (!destination) get memory info
    run client (!destination) get processes
  • Alerts and Monitoring
    schedule time = 5 minutes and name = "Get Disk Space" task disk_d_free = get disk free d:\
  • Monitoring Data
    get data monitored
    get data monitored where dbms = dmci and table = sensor_reading
  • Monitoring Calls

Data Monitoring & Querying

  • Data Monitoring 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
    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"