fix blockchain utilities readme

This commit is contained in:
Riccardo Spagni 2016-09-03 21:54:10 +02:00
parent f1d4e4a3f2
commit 04b120fb39
No known key found for this signature in database
GPG Key ID: 55432DF31CCD4FCD
1 changed files with 15 additions and 42 deletions

View File

@ -4,41 +4,24 @@ Copyright (c) 2014-2016, The Monero Project
## Introduction
The blockchain utilities allow one to convert an old style blockchain.bin file
to a new style database. There are two ways to upgrade an old style blockchain:
The recommended way is to run a `blockchain_export`, then `blockchain_import`.
The other way is to run `blockchain_converter`. In both cases, you will be left
with a new style blockchain.
For importing into the LMDB database, compile with `DATABASE=lmdb`
e.g.
`DATABASE=lmdb make release`
This is also the default compile setting on the master branch.
The exporter will use the LMDB database as its source.
If you are still using an old style in-memory database (blockchain.bin), you will
have to either resync from scratch, or use an older version of the tools to export
it and import it.
The blockchain utilities allow one to import and export the blockchain.
## Usage:
See also each utility's "--help" option.
### Export an existing in-memory database
### Export an existing blockchain database
`$ blockchain_export`
`$ monero-blockchain-export`
This loads the existing blockchain, for whichever database type it was compiled for, and exports it to `$MONERO_DATA_DIR/export/blockchain.raw`
This loads the existing blockchain and exports it to `$MONERO_DATA_DIR/export/blockchain.raw`
### Import the exported file
`$ blockchain_import`
`$ monero-blockchain-import`
This imports blocks from `$MONERO_DATA_DIR/export/blockchain.raw` (exported using the `blockchain_export` tool as described above)
into the current database.
This imports blocks from `$MONERO_DATA_DIR/export/blockchain.raw` (exported using the
`monero-blockchain-export` tool as described above) into the current database.
Defaults: `--batch on`, `--batch size 20000`, `--verify on`
@ -47,14 +30,14 @@ Batch size refers to number of blocks and can be adjusted for performance based
Verification should only be turned off if importing from a trusted blockchain.
If you encounter an error like "resizing not supported in batch mode", you can just re-run
the `blockchain_import` command again, and it will restart from where it left off.
the `monero-blockchain-import` command again, and it will restart from where it left off.
```bash
## use default settings to import blockchain.raw into database
$ blockchain_import
$ monero-blockchain-import
## fast import with large batch size, database mode "fastest", verification off
$ blockchain_import --batch-size 20000 --database lmdb#fastest --verify off
$ monero-blockchain-import --batch-size 20000 --database lmdb#fastest --verify off
```
@ -100,21 +83,11 @@ BerkeleyDB flags (takes one):
```
## Examples:
$ blockchain_import --database lmdb#fastest
$ blockchain_import --database berkeley#fastest
$ monero-blockchain-import --database lmdb#fastest
$ monero-blockchain-import --database berkeley#fastest
$ blockchain_import --database lmdb#nosync
$ blockchain_import --database lmdb#nosync,nometasync
$ monero-blockchain-import --database lmdb#nosync
$ monero-blockchain-import --database lmdb#nosync,nometasync
$ blockchain_import --database berkeley#txn_nosync
```
### Blockchain converter with batching
`blockchain_converter` has also been updated and includes batching for faster writes. However, on lower RAM systems, this will be slower than using the exporter and importer utilities. The converter needs to keep the blockchain in memory for the duration of the conversion, like the original bitmonerod, thus leaving less memory available to the destination database to operate.
Due to higher resource use, it is recommended to use the importer with an exported file instead of the converter.
```bash
$ blockchain_converter --batch on --batch-size 20000
$ monero-blockchain-import --database berkeley#txn_nosync
```