Git Product home page Git Product logo

etcdkvstore's Introduction

High Level Design Diagram

Demo

Components of the distributed k-v store Demo

Week1: Setting Up and Understanding etcd

Todo

  • etcd Installation
  • Single-Node Cluster Setup Guide
  • Write functions to List all keys using etcd client library.
  • Get the value for a specific key provided by the user.
  • Put a key-value pair into etcd, allowing users to specify both key and value.

This guide provides a comprehensive overview of installing etcd, configuring your system to run it, and setting up a single-node etcd cluster on a Linux system.

Downloading etcd

To download a specific version of etcd from the official GitHub repository:

  1. Identify the version you want to download from etcd releases.
  2. Use the following commands to download and extract etcd to a temporary location:
ETCD_VER=<version> # Example: v3.4.31
DOWNLOAD_URL=https://github.com/etcd-io/etcd/releases/download
curl -L ${DOWNLOAD_URL}/${ETCD_VER}/etcd-${ETCD_VER}-linux-amd64.tar.gz -o /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz
tar xzvf /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz -C /tmp/etcd-download-test --strip-components=1

This is how it should appear by the end of installation:

Demo

Making etcd Accessible System-wide

After downloading and extracting etcd, you may encounter a message indicating etcd command is not found. This is because the binary is not in your system's PATH. To resolve this:

Moving etcd Binaries

  1. Move etcd and etcdctl to a more permanent location, /usr/local/bin:
sudo mv /tmp/etcd-download-test/etcd /usr/local/bin/
sudo mv /tmp/etcd-download-test/etcdctl /usr/local/bin/

Updating the PATH Variable

For bash users, add /usr/local/bin to your PATH by editing ~/.bashrc:

echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc

For zsh users, modify ~/.zshrc instead:

echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc

Setting Up a Single-Node Cluster

Follow the steps outlined in the etcd documentation for setting up a single-node cluster:

  1. Start the etcd server:
etcd
  1. Interact with etcd using etcdctl:
etcdctl put mykey myvalue
etcdctl get mykey

Getting and Setting K-V pair in local system:

Demo

For detailed instructions, refer to the etcd Quickstart Guide.

Running the script.py

To run the script.py file and interact with the etcd cluster, perform the following steps:

  • Ensure the etcd service is running.
  • Install the etcd3 Python package if not already installed:
  pip install etcd3

If you encounter errors related to the protobuf library, downgrade the protobuf package to version 3.20.x or lower:

pip install protobuf==3.20.0

or you can set the protocol buffers env. variable:

set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python
  • Run script.py
python script.py

Output:

Demo

Week2: Adding Features and Error Handling

Todo

  • Write function to delete keys.
  • Write function to implement range scan.
  • Error handling for the functions
  • Design a CLI.

Run script.py

python script.py

CLI:

Demo

Week3: Testing

Todo

  • Write unit tests for program's functionalities
  • Multi-Node cluster set up

Run script.py

python script.py

Running Unit Tests

Demo

Multi Node Cluster Setup Running.

Demo

Multi Node Cluster Before Deleting Leader.

Demo

Multi Node Cluster After Deleting Leader.

Demo

Note

  • This guide focuses on development and testing environments. For production setups, consult the official etcd documentation for security, clustering, and configuration best practices.

etcdkvstore's People

Contributors

sohoxic avatar an-4lchemist avatar

Watchers

 avatar

Forkers

an-4lchemist

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.