|
| 1 | +--- |
| 2 | +title: export import snapshot |
| 3 | +weight: 4 |
| 4 | +--- |
| 5 | +`starcoin_db_exporter` command can export and offline import net main, barnard, halley, proxima snapshot |
| 6 | +offline import snapshot also can use import_snapshot.sh |
| 7 | + |
| 8 | +<!--more--> |
| 9 | + |
| 10 | +## Usage |
| 11 | +### export snapshot |
| 12 | +use `starcoin_db_exporter` |
| 13 | +run cmd |
| 14 | +```shell |
| 15 | +USAGE: |
| 16 | + starcoin_db_exporter export-snapshot [OPTIONS] --db-path <db-path> --net <net> --output <output> |
| 17 | + |
| 18 | +FLAGS: |
| 19 | + -h, --help Prints help information |
| 20 | + -V, --version Prints version information |
| 21 | + |
| 22 | +OPTIONS: |
| 23 | + -i, --db-path <db-path> starcoin node db path. like ~/.starcoin/main |
| 24 | + -t, --increment <increment> enable increment export snapshot |
| 25 | + -n, --net <net> Chain Network, like main, proxima |
| 26 | + -o, --output <output> output dir, like ~/, manifest.csv will write in output dir |
| 27 | +``` |
| 28 | +the output snapshot data file is in dir ~/snapshot, the export snapshot cost 1hour-2hour() |
| 29 | +increment export snapshot |
| 30 | +```shell |
| 31 | +./starcoin_db_exporter export-snapshot -i ~/.starcoin/main -n main -o ~/snapshot -t true |
| 32 | +USAGE: |
| 33 | + starcoin_db_exporter export-snapshot [OPTIONS] --db-path <db-path> --net <net> --output <output> |
| 34 | + |
| 35 | +FLAGS: |
| 36 | + -h, --help Prints help information |
| 37 | + -V, --version Prints version information |
| 38 | + |
| 39 | +OPTIONS: |
| 40 | + -i, --db-path <db-path> starcoin node db path. like ~/.starcoin/main |
| 41 | + -t, --increment <increment> enable increment export snapshot |
| 42 | + -n, --net <net> Chain Network, like main, proxima |
| 43 | + -o, --output <output> output dir, like ~/, manifest.csv will write in output dir |
| 44 | +``` |
| 45 | +this cmd use increment export snapshot data, dir ~/snapshot have old snapshot data, like ~/snpashot is the 1-400w block height |
| 46 | +snapshot data, then want get 1-500w block height snapshot data, use this cmd will export 400w-500w block snapshot data, then merge |
| 47 | +with old snapshot data gen new snapshot data |
| 48 | +### offline import snapshot |
| 49 | +#### use`starcoin_db_exporter` offline import |
| 50 | +```shell |
| 51 | +./starcoin_db_exporter apply-snapshot -i ~/snapshot -n main -o ~/.starcoin/main |
| 52 | +USAGE: |
| 53 | + starcoin_db_exporter apply-snapshot --input-path <input-path> --net <net> --to-path <to-path> |
| 54 | + |
| 55 | +FLAGS: |
| 56 | + -h, --help Prints help information |
| 57 | + -V, --version Prints version information |
| 58 | + |
| 59 | +OPTIONS: |
| 60 | + -i, --input-path <input-path> input_path, manifest.csv in this dir |
| 61 | + -n, --net <net> Chain Network |
| 62 | + -o, --to-path <to-path> starcoin node db path. like ~/.starcoin/main |
| 63 | +``` |
| 64 | + |
| 65 | +#### use `import_snapshot.sh` offline import snapshot |
| 66 | +`starcoin_db_exporter`and`import_snapshot.sh` under same path |
| 67 | +`import_net_block.sh $1 $2` |
| 68 | +$1 is net node like main, barnard |
| 69 | +$2 is import_snapshot.sh download snapshot which dir |
| 70 | +$3 is storage dir like ~/.starcoin/main, ~/.starcoin/barnard |
| 71 | + |
| 72 | +run cmd |
| 73 | +```shell |
| 74 | +./import_snapshot.sh barnard ~/snapshot/ ~/.starcoin/barnard |
| 75 | +``` |
0 commit comments