Bigchaindb is a Decentralized (immutable) database and a combination of both traditional distributed Databases & traditional blockchain databases. Basically, the BigchainDB network stores data in blocks like blockchain stores data of transactions.
In any organization, the data of a user remains in any Centralized database like (MySQL, MongoDB, etc). So, here the organization will have full control of all data to easily modify it (the data is mutable). Due to this, the BigchainDB network community created a distributed database that stores data in a Decentralized (immutable) database like blockchain. Due to immutability, no one can modify data, only the owner of that data can change the ownership. The owner of that data will have a private key to change the ownership. If the owner wants to give ownership to another user then it simply makes a transaction like a blockchain and gives ownership to another user.
We are going to setup Bigchaindb network in ubuntu 16.04
1- first of all we will take pull code of Bigchaindb project from github
$ export GIT_BRANCH=master
$ curl -fOL https://raw.githubusercontent.com/bigchaindb/bigchaindb/${GIT_BRANCH}/pkg/scripts/stack.sh
Now we will open file with command
bash stack.sh -h
That looks like
$ bash stack.sh -h
Usage: $ bash stack.sh [-h]
Deploys the BigchainDB network.
ENV[STACK_SIZE]
Set STACK_SIZE environment variable to the size of the network you desire.
Network mimics a production network environment with single or multiple BDB
nodes. (default: 4).
ENV[STACK_TYPE]
Set STACK_TYPE environment variable to the type of deployment you desire.
You can set it one of the following: ["docker", "local", "cloud"].
(default: docker)
ENV[STACK_TYPE_PROVIDER]
Set only when STACK_TYPE="cloud". Only "azure" is supported.
(default: )
ENV[STACK_VM_MEMORY]
(Optional) Set only when STACK_TYPE="local". This sets the memory
of the instance(s) spawned. (default: 2048)
ENV[STACK_VM_CPUS]
(Optional) Set only when STACK_TYPE="local". This sets the number of VCPUs
of the instance(s) spawned. (default: 2)
ENV[STACK_BOX_NAME]
(Optional) Set only when STACK_TYPE="local". This sets the box Vagrant box name
of the instance(s) spawned. (default: ubuntu/xenial64)
ENV[STACK_REPO]
(Optional) To configure bigchaindb repo to use, set STACK_REPO environment
variable. (default: bigchaindb/bigchaindb)
ENV[STACK_BRANCH]
(Optional) To configure bigchaindb repo branch to use set STACK_BRANCH environment
variable. (default: master)
ENV[TM_VERSION]
(Optional) Tendermint version to use for the setup. (default: 0.22.3)
ENV[MONGO_VERSION]
(Optional) MongoDB version to use with the setup. (default: 3.6)
ENV[AZURE_CLIENT_ID]
Only required when STACK_TYPE="cloud" and STACK_TYPE_PROVIDER="azure". Steps to generate:
https://github.com/Azure/vagrant-azure#create-an-azure-active-directory-aad-application
ENV[AZURE_TENANT_ID]
Only required when STACK_TYPE="cloud" and STACK_TYPE_PROVIDER="azure". Steps to generate:
https://github.com/Azure/vagrant-azure#create-an-azure-active-directory-aad-application
ENV[AZURE_SUBSCRIPTION_ID]
Only required when STACK_TYPE="cloud" and STACK_TYPE_PROVIDER="azure". Steps to generate:
https://github.com/Azure/vagrant-azure#create-an-azure-active-directory-aad-application
ENV[AZURE_CLIENT_SECRET]
Only required when STACK_TYPE="cloud" and STACK_TYPE_PROVIDER="azure". Steps to generate:
https://github.com/Azure/vagrant-azure#create-an-azure-active-directory-aad-application
ENV[AZURE_REGION]
(Optional) Only applicable, when STACK_TYPE="cloud" and STACK_TYPE_PROVIDER="azure".
Azure region for the BigchainDB instance. Get list of regions using Azure CLI.
e.g. az account list-locations. (default: westeurope)
ENV[AZURE_IMAGE_URN]
(Optional) Only applicable, when STACK_TYPE="cloud" and STACK_TYPE_PROVIDER="azure".
Azure image to use. Get list of available images using Azure CLI.
e.g. az vm image list --output table. (default: Canonical:UbuntuServer:16.04-LTS:latest)
ENV[AZURE_RESOURCE_GROUP]
(Optional) Only applicable, when STACK_TYPE="cloud" and STACK_TYPE_PROVIDER="azure".
Name of Azure resource group for the instance.
(default: bdb-vagrant-rg-2018-05-30)
ENV[AZURE_DNS_PREFIX]
(Optional) Only applicable, when STACK_TYPE="cloud" and STACK_TYPE_PROVIDER="azure".
DNS Prefix of the instance. (default: bdb-instance-2018-05-30)
ENV[AZURE_ADMIN_USERNAME]
(Optional) Only applicable, when STACK_TYPE="cloud" and STACK_TYPE_PROVIDER="azure".
Admin username of the the instance. (default: vagrant)
ENV[AZURE_VM_SIZE]
(Optional) Only applicable, when STACK_TYPE="cloud" and STACK_TYPE_PROVIDER="azure".
Azure VM size. (default: Standard_D2_v2)
ENV[SSH_PRIVATE_KEY_PATH]
Only required when STACK_TYPE="cloud" and STACK_TYPE_PROVIDER="azure". Absolute path of
SSH keypair required to log into the Azure instance.
-h
Show this help and exit.
Run with Docker->
Now if you don't need to change configuraton of bigchaindb & run it on docker with 4 node BigchainDB network then run simply by this command.
sudo bash stack.sh
After successfully exceution of above command the Bigchaindb network has been start
You can check it with command.
docker ps | grep bigchaindb
Run on local->
For local system you must setup some dependency so run this command
vagrant plugin install vagrant-cachier vagrant-vbguest vagrant-hosts vagrant-azure
To run Bigchaindb on local system use this code in
bash stack.sh -h file.
$ export STACK_TYPE=local
# Optional, since 4 is the default size.
$ export STACK_SIZE=4
# Optional, default is 2048
$ export STACK_VM_MEMORY=2048
#Optional, default is 1
$ export STACK_VM_CPUS=1
#Optional, default is ubuntu/xenial64. Supported/tested images: bento/centos-7, fedora/25-cloud-base
$ export STACK_BOX_NAME=ubuntu/xenial64
#Optional, repo to use for the network deployment
# Default: bigchaindb/bigchaindb
$ export STACK_REPO=bigchaindb/bigchaindb
#Optional, codebase to use for the network deployment
# Default: master
$ export STACK_BRANCH=master
#Optional, since 0.22.3 is the default tendermint version
$ export TM_VERSION=0.22.3
#Optional, since 3.6 is the default MongoDB version.
$ export MONGO_VERSION=3.6
$ bash stack.sh
After edit above code you can run simply command
sudo bash stack.sh
After successfully exceution of above command the Bigchaindb network has been start
You can check it with command.
$ ps -ef | grep bigchaindb
This will show port number of bigchaindb that's are running.
There are another method for setup Bigchaindb node with Ansible
For set up Bigchaindb node with ansible we follow this method.
1-> take clone of Bigchaindb project.
$ git clone https://github.com/bigchaindb/bigchaindb.git
For install project related dependency we navigate to this folder of project
$ cd bigchaindb/pkg/scripts/
$ bash bootstrap.sh --operation install
This script install dependency related your OS.
For run on local system
We will change some file of project
First of all we will go this directory
$ cd bigchaindb/pkg/configuration/hosts
Now edit all file of project
# Delete any existing configuration in this file and insert
# Hostname of dev machine
<HOSTNAME> ansible_connection=local
For update configuration we will edit fie
$ cd bigchaindb/pkg/configuration/vars/stack-config.yml
& paste this code in file
---
stack_type: "local"
stack_type: "1"
Now we will go this directory of project
$ cd bigchaindb/pkg/configuration/
& run projcet by this command
$ ansible-playbook bigchaindb-start.yml -i hosts/all --extra-vars "operation=start home_path=$(pwd)"
This will take some time because its setup project related dependency
After successfully run above command
You will check that process with command
$ ps -ef | grep bigchaindb
Refference ->
https://docs.bigchaindb.com/projects/contributing/en/latest/dev-setup-coding-and-contribution-process/index.html