How to Set Up a BigchainDB Network¶
Until now, everything could be done by a node operator, by themselves. Now the node operators, also called Members, must share some information with each other, so they can form a network.
There is one special Member who helps coordinate everyone: the Coordinator.
Member: Connect to the Other Members¶
At this point the Member should have received the
The Member must copy the
into their local
Every Member now shares the same
genesis_time (used to identify the Network),
and the same list of
Each Member must edit their
and make the following changes:
moniker = "Name of our node" create_empty_blocks = false log_level = "main:info,state:info,*:error" persistent_peers = "<Member 1 node id>@<Member 1 hostname>:26656,\ <Member 2 node id>@<Member 2 hostname>:26656,\ <Member N node id>@<Member N hostname>:26656," send_rate = 102400000 recv_rate = 102400000 recheck = false
Note: The list of
persistent_peers doesn’t have to include all nodes
in the network.
Member: Start MongoDB¶
If you installed MongoDB using
sudo apt install mongodb, then MongoDB should already be running in the background. You can check using
systemctl status mongodb.
If MongoDB isn’t running, then you can start it using the command
mongod, but that will run it in the foreground. If you want to run it in the background (so it will continue running after you logout), you can use
mongod --fork --logpath /var/log/mongodb.log. (You might have to create the
/var/log directory if it doesn’t already exist.)
If you installed MongoDB using
sudo apt install mongodb, then a MongoDB startup script should already be installed (so MongoDB will start automatically when the machine is restarted). Otherwise, you should install a startup script for MongoDB.
Member: Start BigchainDB and Tendermint Using Monit¶
This section describes how to manage the BigchainDB and Tendermint processes using Monit, a small open-source utility for managing and monitoring Unix processes. BigchainDB and Tendermint are managed together, because if BigchainDB is stopped (or crashes) and is restarted, Tendermint won’t try reconnecting to it. (That’s not a bug. It’s just how Tendermint works.)
sudo apt install monit
If you installed the
bigchaindb Python package as above, you should have the
bigchaindb-monit-config script in your
PATH now. Run the script to build a configuration file for Monit:
Run Monit as a daemon, instructing it to wake up every second to check on processes:
monit -d 1
Monit will run the BigchainDB and Tendermint processes and restart them when they crash. If the root
bigchaindb_ process crashes, Monit will also restart the Tendermint process.
You can check the status by running
monit status or
By default, it will collect program logs into the
To learn more about Monit, use
monit -h (help) or read the Monit documentation.
bigchaindb-monit-config -h if you want to arrange a different folder for logs or some of the Monit internal artifacts.
If you want to start and manage the BigchainDB and Tendermint processes yourself, then look inside the file bigchaindb/pkg/scripts/bigchaindb-monit-config to see how it starts BigchainDB and Tendermint.
How Others Can Access Your Node¶
If you followed the above instructions, then your node should be publicly-accessible with BigchainDB Root URL
http://hostname:9984. That is, anyone can interact with your node using the BigchainDB HTTP API exposed at that address. The most common way to do that is to use one of the BigchainDB Drivers.