Giter Site home page Giter Site logo

khan-asfi-reza / db-sharding-with-flask Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 1.0 12 KB

For Database Sharding Demonstration Purpose, this project was built. For database, I have used Postgres and to shard and create multiple instance I have used Docker. Flask is used to demonstrate the application that will be used with the database

Python 98.40% Dockerfile 1.60%
database sharding postgresql flask python

db-sharding-with-flask's Introduction

URL Shortener

Database Sharding Example With Flask

For Database Sharding Demonstration Purpose, this project was built. For database, I have used Postgres and to shard and create multiple instance I have used Docker. Flask is used to demonstrate the application that will be used with the database

Used:

  1. Flask
  2. Postgres
  3. Docker

Installation Step

1. Install Docker, Python

Install Python and Docker in your local machine

Docker || Python

2. Clone This Repo

git init
git clone https://github.com/khan-asfi-reza/db-sharding-with-flask.git

3. Setup Database Using Docker

We will use the following image for our Database Nodes

cd postgres
docker build -t mypostgres .

Now we will create 3 Database Node / Server with 3 different ports

docker run --name node1 -p 5432:5432 -e POSTGRES_PASSWORD='postgres' -d mypostgres
docker run --name node2 -p 5433:5432 -e POSTGRES_PASSWORD='postgres' -d mypostgres
docker run --name node3 -p 5434:5432 -e POSTGRES_PASSWORD='postgres' -d mypostgres

4. Install Requirements

pip install -r requirements.txt

5. Create .env File

Create a .env file

POSTGRES_HOST=YOUR_HOST_NAME
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_DATABASE=postgres

YOUR_HOST_NAME = Your Local IP4 Address

5. Run Flask

run flask

Explanation

What is Database Sharding?

  • Database Sharding is a method for distributing a single dataset across multiple databases, which can then be stored on multiple machines. This allows for larger datasets to be split in smaller chunks and stored in multiple data nodes, increasing the total storage capacity of the system. MongoDB

Why and when Database Sharding?

  • Easy to manage large dataset
  • Build large and scalable system
  • Distributed System

db-sharding-with-flask's People

Contributors

khan-asfi-reza avatar

Watchers

 avatar  avatar

Forkers

webclinic017

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.