How to Use Lisk Commander to Manage Lisk Core

  • By Manu Gowda in Tutorial
  • 08 Aug 2019
  • 4 min read

This guide outlines the Lisk Commander 2.2.0 capabilities to install and manage Lisk Core instances.

Lisk Commander, our command-line interface (CLI) is an integral part of the Lisk SDK. We’re constantly adding new functionalities to help with anything from node management to voting for delegates. Today, we will show you how to use the new commands introduced in Lisk Commander 2.2.0 to install and manage multiple Lisk Core instances.

Note: Until now, installation and management of Lisk Core was done solely through installLisk.sh and lisk.sh scripts. Those scripts will be eventually removed and Lisk Commander will be responsible for both installation and management of Lisk Core. Installation made by Lisk Commander can’t be managed by Lisk Scripts and vice-versa.

Lisk Commander is available for Linux and macOS

First, you will need to download Lisk Commander. Lisk Commander requires a 64bit Linux (Ubuntu 16.04 LTS or 18.04 LTS) or macOS (High Sierra or Mojave) machine. Lisk Commander must be run as a non-privileged user. Here is an example of how you can install Lisk Commander on Linux and Mac:

Example of standalone Lisk Commander installation (Linux)

Example of standalone Lisk Commander installation (macOS)

Lisk Commander 2.2.0 introduces 8 commands to manage Lisk Core

With this release, we’ve added the following commands for a more convenient developer experience:

  • lisk core:restart <instance>
  • lisk core:start <instance>
  • lisk core:status <instance>
  • lisk core:stop <instance>
  • lisk core:uninstall <instance>
  • lisk core:upgrade <instance>
Lisk Commander 2.2.0
Lisk Commander 2.2.0

lisk core:install <instance>

Lisk Commander can install Lisk Core starting with version 2.0.0. This allows you to install Lisk Core, download the snapshot, insert the snapshot into the database and start the freshly installed node. By default, this will fetch the latest public release of Lisk Core and download the mainnetsnapshot. Extra options are provided to install a custom build of Lisk Core or specify a different network like testnet. It is also possible to install multiple versions or networks on the same machine with the install command. This command installs an instance of Lisk Core. For example, the command lisk core:install lisk-mainnet installs the latest Lisk Core software for Mainnet by default. In order to install a different version for different Lisk Network, you need to specify the version and network option e.g. by typing in:

lisk core:install --network=testnet lisk-testnet

This installs the Lisk Core 2.0.0-rc.0 for Testnet.

How to run Lisk Core and sync blockchain from scratch

To run Lisk Core without using the snapshot you can use the option --no-snapshot. This will make the node synchronize with the network from scratch. However, if you want to use custom snapshot — you can specify--snapshot-url parameter.

How to run Lisk Core using custom URL for binary

For the binary release, you need to make sure the .tar file has the proper format: 2.0.0-Linux-x86_64.tar.gz. You also need to have the checksum for the TAR file with the format 2.0.0-Linux-x86_64.tar.gz.SHA256 for the Commander to check the integrity of the binary. You can refer to our binary release for the file naming convention. Once your custom Lisk Core binary is ready, you can upload it to Amazon S3, Digital Ocean spaces or any other file server and use the custom URL with --release-url parameter.

lisk core:logs <instance>

Monitoring the logs of a node is an important feature that needs to be part of the command set. This command streams logs of a Lisk Core instance. For checking logs of a particular Lisk Core instance, specify the instance name (the same you used during the installation), for example:

lisk core:logs lisk-mainnet

lisk core:restart <instance>

The restart command stops and starts the Lisk Core, cache and database processes. Use it by typing in for example:

lisk core:restart lisk-mainnet

lisk core:start <instance>

Running lisk core:install will also start the application by default. However, it is possible to explicitly start and stop the application. This command starts the Lisk Core, cache, and the database process of an instance. Use it by typing in:

lisk core:start lisk-mainnet

lisk core:stop <instance>

This stops Lisk Core, cache, and database process of an instance after you type in:

lisk core:stop lisk-mainnet

lisk core:status <instance>

Use this command to find out the status of all Lisk Core instances. If you want to know the status of a specific instance, add its name after the command, for example:

lisk core:status lisk-mainnet

lisk core:uninstall <instance>

Uninstall command stops the running Lisk Core, cache and database processes. It also unregisters from the PM2 process manager and removes the data from the backup directory. You can use it by typing in:

lisk core:uninstall lisk-mainnet

How to manage custom config per instance using Lisk Commander

Sometimes you will need to manually edit the configuration files of a Lisk Core instance, for example in order to enable forging, change log level or any other config parameter. For this purpose, run lisk core:status lisk-mainnet command, which displays the installationPath of the instance. The config specific to the instance (in this example: lisk-mainnet) will be present in the root of the installationPath. After adjusting the config to your needs you can just run lisk core:restart lisk-mainnet to apply the changes.

We hope you will like our new version of Lisk Commander, if you have any feedback or feature request — join us on Discord or open an issue on the lisk-sdk GitHub repository.

Lisk is on a mission to enable developers to create decentralized, efficient, and transparent blockchain applications. Join us:

Manu Gowda

Backend QA Lead