Indexer Fullnode
This document describes how to run an indexer fullnode on the Jin network. See Indexing guide that describes the basic indexing concept and the available options for indexing service on the Jin blockchain.
The below installation steps are verified only on macOS with Apple silicon.
Summary
To run an indexer fullnode, these are the steps in summary:
- Make sure that you have all the required tools and packages described below in this document.
- Follow the method #1 of setting up a public fullnode by using the source code and prepare the setup, but do not run the
cargo run -p aptos-node --release -- -f ./fullnode.yamlcommand yet.Docker not supportedDocker is not yet supported for indexer fullnode. In the above step 2, use only the source code method.
- Edit the
fullnode.yamlas described below in this document. - Run the indexer fullnode by executing the command described below in this document.
Required tools and packages
- Install Brew.
- Install Cargo and Rust via Install Rust.
- Install libpq. This is a Postgres C API library. Make sure to perform all export commands after the installation.
- macOS:
brew install libpq - Linux:
apt install libpq
- macOS:
- Install PostgreSQL:
- macOS:
brew install postgres - Linux:
apt install postgres
- macOS:
- Install Diesel:
cargo install diesel_cli --no-default-features --features postgres.
Setup
Start the PostgreSQL server:
- macOS:
brew services start postgresql - Linux:
pg_ctl -D /opt/homebrew/var/postgres start
- macOS:
Run the following command to create a PostgreSQL user
postgres(macOS commmand example below):/opt/homebrew/bin/createuser -s postgresEnsure you are able to do:
psql postgres.Install the Diesel CLI:
cargo install diesel_cli --no-default-features --features postgresClone
aptos-corerepo:git clone https://github.com/aptos-labs/aptos-core.gitcdintoaptos-core/crates/indexerdirectory.Run the command:
diesel migration run --database-url postgresql://localhost/postgresThis will create a database schema with the subdirectory
migrationslocated in thisaptos-core/crates/indexerdirectory.- If for some reason this database is already being used, try a different database. For example:
DATABASE_URL=postgres://postgres@localhost:5432/indexer_v2 diesel database reset
- If for some reason this database is already being used, try a different database. For example:
Follow the method #1 of setting up a public fullnode by using the source code and prepare the setup, but do not run the
cargo run -p aptos-node --release -- -f ./fullnode.yamlcommand yet. Docker is not yet supported for the indexer fullnode.Edit the
./fullnode.yamland add the following configuration:storage:
enable_indexer: true
# This is to avoid the node being pruned
storage_pruner_config:
ledger_pruner_config:
enable: false
indexer:
enabled: true
postgres_uri: "postgres://postgres@localhost:5432/postgres"
processor: "default_processor"
check_chain_id: true
emit_every: 500Run the indexer fullnode with:
cargo run --bin aptos-node --features "indexer" -- --config </path/to/fullnode.yaml>`