A server that synchronize IRIS blockChain data into a database
conf: config of projectmodule: project modulemongodb: mongodb script to create databaseservice: main logic of sync-server, sync data from blockChain and write to databasestore: database modelutil: common constants and helper functionsmain.go: bootstrap project
run script mongodb.js in mongodb folder to create database before run project
- Build:
make all - Run:
make run - Cross compilation:
make build-linux
- DB_ADDR:
requiredstringmongodb addrs(example:127.0.0.1:27017, 127.0.0.2:27017, ...) - DB_USER:
requiredstringmongodb user(example:user) - DB_PASSWD:
requiredstringmongodb password(example:DB_PASSWD) - DB_DATABASE:
requiredstringmongodb database name(example:DB_DATABASE)
-
SER_BC_FULL_NODE:
requiredstringfull node url(example:tcp://127.0.0.1:26657, tcp://127.0.0.2:26657, ...) -
SER_BC_CHAIN_ID:
requiredstringchain id(example:rainbow-dev) -
WORKER_NUM_CREATE_TASK:
requiredstringnum of worker to create tasks(example:2) -
WORKER_NUM_EXECUTE_TASK:
requiredstringnum of worker to execute tasks(example:30) -
NETWORK:
optionstringnetwork type(example:testnet,mainnet)
If you synchronizes irishub data from specify block height(such as:17908 current time:1576208532)
- At first, stop the irishub-sync and run follow sql in mongodb
db.sync_task.insert({'start_height':NumberLong(17908),'end_height':NumberLong(0),'current_height':NumberLong(0),'status':'unhandled','last_update_time':NumberLong(1576208532)})
- Then, start irishub-sync