Alternative Databases
To use a different database than the default one (levelDB), you may need to build the lagomd
binary manually with specific flags and configurations.
Learn about the different options supported.
Prerequisites
Golang version
>=1.22.2
(installation guide)Source code of the desired
lagomd
version. For example, if you want to usev19.0.0
, execute the following command to download only the necessary code:
Pebble DB
Install lagomd
binary from source
lagomd
binary from sourceCheck the binary version has the -pebbledb
suffix
danger
NOTE: if using a version before v19, you'll need to replace the cometbft-db dependency before installing the binary:
Update configuration
Make sure to update the db_backend
configuration parameter in the config.toml
:
Build docker image
To build a docker image with the lagomd
binary compiled to use pebbledb, run the following command:
Rocks DB
To set up a node with rocksDB, you need to install the corresponding library and related dependencies.
The installation process described below applies to Ubuntu OS. For other operating systems, refer to the rocksdb installation guide.
Install dependencies
snappy
zlib
bzip2
lz4
zstandard
gcc
>= 7clang
>= 5
Install all dependencies at once with this command:
Install librocksdb
librocksdb
To install this library, you will need to clone the rocksdb repository.
Clone only the required version of it. To find out which is the required version, check the tag of the grocksdb
dependency in the go.mod
file of the lagomchain repository. For example, if the go.mod
has:
You should check in the grocksdb repo, which RocksDB version is supported in the v1.9.2
tag. In this case, v1.9.2
supports RocksDB v9.2.1
.
To install librocksdb v9.2.1
, run the following commands:
The installation process may take several minutes.
Install lagomd
binary
lagomd
binaryOnce this completes, install the lagomd
binary with rocksDB support
If getting the errors related to dynamic loading of shared libraries:
Retry the command adding the dynamic linker library in your executable, the -ldl
flag in the CGO_LDFLAGS
:
Check the binary version has the -rocksdb
suffix
Update database configuration
Before starting the process, make sure to update the db_backend
configuration parameter in the config.toml
:
Version DB & MemIAVL
Version DB
VersionDB is a solution developed by the Cronos team to address the size of the IAVL database. For more information about it, refer to these resources:
Prerequisites
lagomd
binary withlibrocksdb
. Refer to the previous section for the procedure on how to build this binary.
Update configuration
To enable versionDB, add versiondb
to the list of store.streamers
in app.toml
:
When starting the node with this configuration, you should see a version.db
file in the data
directory.
Migration
If you have an existing database and want to migrate this data to versionDB, follow the migration guide.
MemIAVL
MemIAVL is a solution developed by the Cronos team to address performance issues of the current IAVL implementation (benchmarks here). For more information about it, check the documentation.
Prerequisites
lagomd
binary withlibrocksdb
. Refer to the RocksDB section for the procedure on how to build this binary.
Update configuration
To enable MemIAVL turn on the memiavl.enable
config item in app.toml
. MemIAVL only supports pruned node, the default configuration (memiavl.snapshot-keep-recent=0
) is equivalent to pruning=everything
. To support historical grpc query services, you should enable versionDB together with it. If you need to support very old merkle proof generations, don't use memIAVL.
The default MemIAVL section in app.toml
:
When starting the node with this configuration, you should see a memiavl.db
file in the data
directory.
Last updated