简体   繁体   English

几天后,私人以太坊区块链上的数据丢失/消失

[英]Data on Private Ethereum blockchain lost/disappears after couple of days

I am deploying a private ethereum blockchain (geth) on a virtual machine on Azure. 我正在Azure的虚拟机上部署私有以太坊区块链(geth)。 Upon deploying my Solidity contracts on the blockchain and launching my NodeJS application to it, I am able to add data normally through web apis of the nodejs Loopback App and everything is working fine and I can see the added data using the GET apis. 将我的Solidity合同部署在区块链上并启动我的NodeJS应用程序后,我可以通过nodejs Loopback App的Web API正常添加数据,并且一切正常,并且可以使用GET API查看添加的数据。

However, after 1-2-3 days (random) I am not able to retrieve the data I added through my GET apis, while am still able to add new data which confirms that Geth is running fine and wasn't interrupted. 但是,在1-2-3天(随机)之后,我将无法检索通过GET API添加的数据,而仍然能够添加新数据,以确认Geth运行正常且没有被中断。

I am running geth using: 我正在使用geth运行:

geth --datadir ./myDataDir --rpc --networkid 1441 console 2>> myEth.log

myEth.log isn't showing anything wrong, nodejs logs are clean as well. myEth.log没有显示任何错误,nodejs日志也很干净。

eth.syncing shows false which means the network is synced. eth.syncing显示为false ,表示网络已同步。

size of myDataDir folder is still increasing so logically data should be somewhere there but it's not showing. myDataDir文件夹的大小仍在增加,因此从逻辑myDataDir数据应该位于此处,但未显示。

This is not a private blockchain! 这不是私有的区块链!

--networkid 1441

This only says that you communicate with clients that also run a network with ID 1441. It might be unlikely, but if someone else runs a network with ID 1441, this node will connect to your node just fine. 这仅表示您与也运行ID为1441的网络的客户端进行通信。这不太可能,但是如果其他人运行ID为1441的网络,则该节点可以很好地连接到您的节点。 And in case, the other network with the same ID has a longer (more "heavier") chain, this overwrites your local chain. 并且,如果其他具有相同ID的网络具有更长(更“重”)的链,则会覆盖您的本地链。

To avoid this, try a more random network ID, maybe 7-9 digits, and disable discovery with 为避免这种情况,请尝试使用更随机的网络ID(可能是7-9位数字),并使用

 --nodiscovery

Or just use the --dev preset. 或者只是使用--dev预设。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM