EOS MongoDB支持

好消息!EOSIO开始有分支重新支持MongoDB了,兼容现有主网。链接:https://github.com/EOSIO/eos/pull/4304

操作步骤如下:

        git clone -b release/1.1 https://github.com/EOSIO/eos.git

        cd eos

        git fetch –all –tags –prune

        git merge -m “merge” –commit origin/gh#3030-enable-mongodb

        git submodule update –init –recursive

        ./eosio_build.sh

        cd build/

        make install

修改config.ini配置文件,添加如下两行:

        plugin = eosio::mongo_db_plugin

        mongodb-uri = mongodb://localhost:27017/eosmain

其中,eosmain是要写入的MongoDB数据库名。

好了,万事俱备,开始启动

进入~/opt/mongodb/bin目录,启动MongoDB服务。

        cd ~/opt/mongodb/bin

        ./mongod

这时MongoDB服务会默认监听27017端口,如下图所示。

        新开一个小窗,重启nodeos,需要加上–replay-blockchain,以使历史交易数据同步到MongoDB。

        如果没有意外的话,此时MongoDB应该开始写入相关记录了。

        执行mongo程序进入MongoDB控制台,查询相应数据库和记录,如下图。

        本文完。

猜你喜欢

转载自blog.csdn.net/agecntao/article/details/81220018
eos