github.com/klaytn/klaytn@v1.12.1/db_migration/db_migration.sh (about) 1 # This code calls db migration. 2 3 # To use the db migration, a klaytn client should not be running. 4 # You need to have access to the DB. 5 # To checkout migration status, `tail -f logs-body.out` 6 7 # BIN file 8 KLAYTN_BIN=~/klaytn/bin/ken 9 10 # src DB 11 SRC_DB_TYPE=LevelDB # one of "LevelDB", "BadgerDB", "MemoryDB", "DynamoDBS3" 12 DATA_DIR=~/klaytn/data # for localDB ("LevelDB", "BadgerDB", "MemoryDB"). neglected config for "DynamoDBS3" 13 SRC_DB=body # result of `ls $DATA_DIR/klay/chaindata` 14 # * one of "body", "bridgeservice", "header", "misc", "receipts", "statetrie/0", "statetrie/1", "statetrie/2", "statetrie/3", "txlookup" 15 SRC_DB_DIR=$DATA_DIR/klay/chaindata/$SRC_DB 16 17 # Dst DynamoDB 18 DST_DB_TYPE=DynamoDBS3 # one of "LevelDB", "BadgerDB", "MemoryDB", "DynamoDBS3" 19 DST_DB_DIR=~/klaytn/db_migration/dst # for localDB ("LevelDB", "BadgerDB", "MemoryDB"). neglected config for "DynamoDBS3" 20 DST_TABLENAME=db-migration # for remoteDB ("DynamoDBS3"). neglected config for localDB 21 DST_RCU=100 # neglected config for existing DB. 22 DST_WCU=4000 # recommended to use auto-scaling up to 4000 while db migration 23 24 # set this value if you are using DynamoDB 25 export AWS_ACCESS_KEY_ID= 26 export AWS_SECRET_ACCESS_KEY= 27 28 # call db migration 29 $KLAYTN_BIN db-migration start \ 30 --db.single --db.dst.single \ 31 --dbtype $SRC_DB_TYPE --dst.dbtype $DST_DB_TYPE \ 32 --datadir $SRC_DB_DIR \ 33 --dst.datadir $DST_DB_DIR --db.dst.dynamo.tablename $DST_TABLENAME \ 34 --db.dst.dynamo.is-provisioned --db.dst.dynamo.read-capacity $DST_RCU --db.dst.dynamo.write-capacity $DST_WCU \ 35 &> logs-$(basename $SRC_DB).out &