- languages used
- c++ 17
- skylark
- protobuf
- libraries
- mongo-c-driver 1.17.0 beta
- mongo-cxx-driver 3.5.0
- gsoncxx
- cxxopts
- loguru
- build tools
- bazel 3.0.0
- cmake 3.17.1
- database
- mongodb 4.2
- Install Bazel
sudo apt install curl
curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add -
echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
sudo apt update && sudo apt install bazel
- Install CMake
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | sudo apt-key add -
sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ bionic main'
sudo apt update
sudo apt install cmake -y
- Install the dependencies 🍰
INFO: installs mongo-c-driver, mongo-cxx-driver and mongodb
sudo sh install_dependencies.sh
- Test your installation 🧪
$ g++ --std=c++11 test.cpp $(pkg-config --cflags --libs libmongocxx) -Wl,-rpath,/usr/local/lib
$ ./a.out
- Build 🚀
sudo sh build.sh
- create a replica set in mongo
$ mongod --dbpath /data/db --replSet "rs0"
- open a mongo shell and initiate the replica set
rs.initiate()
- start the server
$ bazel run //server:zirconium_server --
- start the client
$ bazel run //:zirconium_client -- --username=meow --pin=123456 --deposit=10
- Run Mongod
$ mongod --dbpath /data/db --replSet "rs0"
- Run Mongo Client
$ mongo
- Create a replica set
rs.initiate()
- Open Mongo Compass and connect to our database
Use this URI
mongodb://localhost:27017/?replicaSet=rs0&readPreference=primary&appname=MongoDB%20Compass&ssl=false
- Load the data from test_data.json
ADD DATA -> Import File
- Start the server
$ ./bazel-bin/server/zirconium_server --config server/server.config
- Now run test_transactions.sh
Make sure to install parallel
by sudo apt install parallel
$ seq 10 | parallel -j 10 --workdir $PWD ./test/test_transactions.sh {}