Use persistent data dir as failover mechanism

+1 vote

Hi,

I'm running Multichain as master in a docker container with a volume mapped to a permanent storage so if the container dies, it can be restarted using the same data dir.

However this is not working as expected, as on restart, I get the following error:

/data/chain1 folder already exists...
Starting the chain with multichaind -txindex -printtoconsole -shrinkdebugfilesize -datadir=/data chain1...

MultiChain 2.0 beta 1 Daemon (latest protocol 20006)

 

 

 

 

 

 

 

 

 

 

MultiChain version build 2.0 beta 1 protocol 20006 (Nov 21 2018, 10:39:54)
Using OpenSSL version OpenSSL 1.0.1h 5 Jun 2014
Using BerkeleyDB version Berkeley DB 4.8.30: (April  9, 2010)
Default data directory /data/chain1
Using data directory /data/chain1
Using config file /data/chain1/chain1.conf
Using at most 125 connections (65536 file descriptors available)
Using 16 threads for script verification
Using wallet wallet.dat
init message: Verifying wallet...
CDBEnv::Open : LogDir=/data/chain1/database ErrorFile=/data/chain1/db.log
init message: Initializing multichain...
mchn: Parameter set is valid - initializing blockchain parameters...
Wallet mode: 00000003
nFileVersion = 100000
Keys: 2 plaintext, 0 encrypted, 2 w/ metadata, 2 total
Node paused state is set to 00000000
Binding RPC on address :: port 8570 (IPv4+IPv6 bind any: 1)
Bound to [::]:8571
Bound to 0.0.0.0:8571
Filter initialization completed
Other nodes can connect to this node using:
multichaind chain1@174.16.212.240:8571

Setting banned transaction list:    0 transactions
init message: Loading block index...
Opening LevelDB in /data/chain1/blocks/index
Opened LevelDB successfully
Opening LevelDB in /data/chain1/chainstate
Opened LevelDB successfully
nFileVersion = 100000
Keys: 2 plaintext, 0 encrypted, 2 w/ metadata, 2 total
LoadBlockIndexDB: last block file = 0
LoadBlockIndexDB: last block file info: CBlockFileInfo(blocks=11, size=3000, heights=0...10, time=2019-01-18...2019-01-18)
Checking all blk files are present...
LoadBlockIndexDB(): transaction index enabled
LoadBlockIndexDB(): hashBestChain=006e9bbff1dd146a9cdff73d4bd8e1f729f4f75568650f0523f3e0b99e345229 height=10 date=2019-01-18 18:08:26 progress=1.000000
Error: Incorrect or no genesis block found. Wrong datadir for network?
Error: Incorrect or no genesis block found. Wrong datadir for network?
Shutdown: In progress...
StopNode()
Node stopped
Shutdown: done
CDBEnv::EnvShutdown : Error 22 shutting down database environment: Invalid argument

Apparently, on restart, it's detecting that there is already an existing data dir, so it's just trying to spin up the master node again using it with:

multichaind -txindex -printtoconsole -shrinkdebugfilesize -datadir=/data chain1

But maybe I need to start it in a different way when the data dir is already there.

Can you please advice?

Thanks!

 

asked Jan 18, 2019 by emedina

1 Answer

+1 vote
 
Best answer
The issue was that on creation I was not setting the datadir as well.
answered Jan 19, 2019 by emedina
selected Mar 10, 2019 by emedina
Great, thanks for answering your own question.
...