Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions docs/using_javatron/backup_restore.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# Node Data Backup and Restore

java-tron nodes store their persistent data in a specified data directory, which defaults to `/output-directory/`. You can specify a different data storage location by adding the `-d` or `--output-directory` parameter to the java-tron node startup command. For example:
java-tron nodes store their persistent data in a specified data directory, which defaults to `output-directory` (a relative path under the current working directory). You can specify a different data storage location by adding the `-d` or `--output-directory` parameter to the java-tron node startup command. For example:

```
java -jar build/libs/FullNode.jar -d ./outputdir
```

Inside the data directory, all persistent state is stored under a `database/` subdirectory, whose name is controlled by the `storage.db.directory` configuration item (default: `database`). If you change `storage.db.directory`, make sure your backup and restore steps target the renamed directory.


## Backing Up Node Data

Expand Down Expand Up @@ -72,15 +74,16 @@ The table below lists the download addresses for FullNode data snapshots. Please
| Official Data Source (Asia: Singapore) | [http://35.247.128.170/](http://35.247.128.170/) | LevelDB data, includes internal transactions |
| Official Data Source (Americas: Virginia, USA) | [http://34.48.6.163/](http://34.48.6.163/) | LevelDB data, does not include internal transactions, includes historical account balances |

**Note:**
**Note:**

- **LevelDB** and **RocksDB** data are not interchangeable. The database type for a FullNode is specified by the `db.engine` configuration item in the configuration file, with selectable values being `LEVELDB` or `ROCKSDB`.
- Internal transactions can be enabled/disabled through the configuration items `vm.saveInternalTx` or `vm.saveFeaturedInternalTx` in the configuration file. Internal transactions are saved only when `vm.saveInternalTx` is enabled. If `saveFeaturedInternalTx` is also enabled, all types of internal transactions will be saved; otherwise, only `call`, `create`, and `suicide` transactions will be saved. Affected interface: [`gettransactioninfobyid`](https://developers.tron.network/reference/gettransactioninfobyid-1)
- Historical account balances can be enabled/disabled through the configuration item `storage.balance.history.lookup` in the configuration file. Affected interface: [`getaccountbalance`](https://developers.tron.network/reference/getaccountbalance)
- **LevelDB** and **RocksDB** data are not interchangeable. The database type for a FullNode is specified by the `db.engine` configuration item in the configuration file, with selectable values being `LEVELDB` or `ROCKSDB`. If you have a snapshot in LevelDB format but want to run the node with the RocksDB engine, the [Data Conversion Tool](toolkit.md/#data-conversion-tool) in the toolkit can convert LevelDB data into RocksDB format.
- Internal transactions can be enabled/disabled through the configuration items `vm.saveInternalTx` or `vm.saveFeaturedInternalTx` in the configuration file. Internal transactions are saved only when `vm.saveInternalTx` is enabled. If `saveFeaturedInternalTx` is also enabled, all types of internal transactions will be saved; otherwise, only `call`, `create`, and `suicide` transactions will be saved. Affected interface: [`gettransactioninfobyid`](../api/http/block-and-tx-query/gettransactioninfobyid.md)
- The configuration item `vm.saveCancelAllUnfreezeV2Details` additionally records the bandwidth/energy/TRON Power cancellation amounts as an `extra` field on internal transactions generated by the `CANCELALLUNFREEZEV2` opcode. This setting only takes effect when both `vm.saveInternalTx` and `vm.saveFeaturedInternalTx` are also enabled.
- Historical account balances can be enabled/disabled through the configuration item `storage.balance.history.lookup` in the configuration file. Affected interface: [`getaccountbalance`](../api/http/account/getaccountbalance.md)

#### Lite FullNode Data Snapshots

The TRON network has supported **Lite FullNode** type nodes since the GreatVoyage-V4.1.0 release. Compared to a regular FullNode, a Lite FullNode has a smaller database and faster startup speed because it only requires state data and necessary historical data to start. The table below lists the download addresses for Lite FullNode data snapshots.
The TRON network has supported **Lite FullNode** type nodes since the GreatVoyage-v4.1.0 release. Compared to a regular FullNode, a Lite FullNode has a smaller database and faster startup speed because it only requires state data and necessary historical data to start. The table below lists the download addresses for Lite FullNode data snapshots.

| Lite FullNode Node Data Source | Download Address | Description |
| :----------------------------- | :--------------- | :---------- |
Expand All @@ -94,11 +97,11 @@ The TRON network has supported **Lite FullNode** type nodes since the GreatVoyag
For detailed information on Nile Testnet data snapshots, please refer to the [official website](https://nileex.io/). The usage method is the same as for Mainnet data snapshots.

### Data Snapshot Usage Steps

The steps for using data snapshots are as follows:

1. Download the corresponding compressed backup database based on your needs.
2. Extract the compressed database backup to the `output-directory` directory (or specify another target directory as needed). For detailed decompression instructions, refer to the Data Snapshot Download and Extraction Methods
section below.
2. Extract the compressed database backup to the `output-directory` directory (or specify another target directory as needed). For detailed decompression instructions, refer to the Data Snapshot Download and Extraction Methods section below.
3. Start the node. The node reads data from the `output-directory` by default. If your data was decompressed into a different directory, add the `-d` parameter and specify the database directory name when starting the node.

#### Data Snapshot Download and Extraction Methods
Expand All @@ -120,7 +123,7 @@ Run the script:
bash download_snapshot.sh
```

Note: This method avoids storing the complete compressed file and extracts the data on-the-fly, **significantly reducing disk space requirements**.
**Note:** This method avoids storing the complete compressed file and extracts the data on-the-fly, **significantly reducing disk space requirements**.

**Method 2: Full Download Before Extraction (Requires Sufficient Storage Space)**

Expand All @@ -132,4 +135,4 @@ wget SNAPSHOT_URL/FullNode_output-directory.tgz
tar -zxvf FullNode_output-directory.tgz
```

Note: During extraction, both the compressed archive and the extracted files must be stored simultaneously. We recommend using two 3TB disks (3TB+ for the archive & 3TB+ for the extracted data). You can release the archive disk after extraction to reduce costs.
**Note:** During extraction, both the compressed archive and the extracted files must be stored simultaneously. We recommend using two 3TB disks (3TB+ for the archive & 3TB+ for the extracted data). You can release the archive disk after extraction to reduce costs.