<aside> 💡

Read the sharding AIP here:

https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-97.md

</aside>

Instructions

Storage sharding is managed through your local node configuration. Since the new storage format is incompatible with the previous one, a full DB wipe is required to proceed.

<aside> 💡

Aptos node version required for sharding upgrade: aptos-node-v1.21.2 or higher

</aside>

Flag to start the format migration:


storage:
	rocksdb_configs:
		enable_storage_sharding: true

  1. We’re going to start with the validator fullnode (VFN) first, so that you can swap this with validator node later to minimize the downtime.
    1. Update the node config file to enable sharding.
    2. Wipe the db for VFN, start the node again using the sharding config. make sure it started syncing data, and wait for it to fully sync.
  2. Now promote your new VFN running on sharding mode to be the Validator.
    1. Stop the validator node, stop the VFN.
    2. Save the VFN configuration files somewhere else for later (fullnode.yaml, and identity file)
    3. Copy the validator.yaml configuration file (make sure to update this config to enable sharding), validator identity file, secure-data.json and consensus_db from Validator machine to VFN.
      1. /opt/aptos/data/db/consensus_db
      2. /opt/aptos/data/secure-data.json
    4. Restart the VFN machine, now it should be working as a validator node.
    5. Note you might need to update network address after you swap. Depends on if the IP/DNS for the node has changed. https://aptos.dev/en/network/nodes/validator-node/connect-nodes/connect-to-aptos-network#3-update-on-chain-network-addresses
  3. Now you can configure the old validator machine to be your new VFN
    1. Copy the saved configuration file previously to this machine
    2. Update the node config file to enable sharding.
    3. Wipe the db and delete the secure-data.json file
    4. restart the node
  4. Verify node is on sharding mode
    1. When node is running, go to v1/info endpoint, you should be able to see "new_storage_format":true

Here is a list of flags (and examples) that might require attention during the migration.


# Note: Replace the address with the upstream you want to use.
seeds:
  D717AF1761645FFACFE5A455FB021052AC0FEFBC1B97FC3681BA61423C043D23:
    addresses:
    - /dns4/pfn0.backup.cloud-a.mainnet.aptoslabs.com/tcp/6182/noise-ik/D717AF1761645FFACFE5A455FB021052AC0FEFBC1B97FC3681BA61423C043D23/handshake/0
    role: Upstream

storage:
  db_path_overrides:
    ledger_db_path: "/disk0/db"
    state_kv_db_path:
      metadata_path: "/disk0/db"
      shard_paths:
        - shards: "1-3,7"
          path: "/disk1/db"
        - shards: "11-12,15"
          path: "/disk2/db"
    state_merkle_db_path:
      metadata_path: "/disk0/db"
      shard_paths:
        - shards: "0-7"
          path: "/disk3/db"
        - shards: "8-15"
          path: "/disk4/db"