Giter Site home page Giter Site logo

roma-glushko / migdalor Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 1.0 96 KB

๐Ÿ”† A Kubernetes native peer discovery and cluster membership management library for your modern Python microservices

Home Page: https://pypi.org/project/migdalor/

License: MIT License

Makefile 10.57% Python 89.43%
kubernetes memebership-management peer-discovery python python-asyncio

migdalor's Introduction

Migdalor - a Kubernetes native cluster management for modern Python

Migdalor

Migdalor is a cluster membership library for modern asyncio Python distributed systems running in Kubernetes.

Migdalor doesn't require a separate broker (e.g. Redis, etcd, Zookeeper, Chubby, etc) to work, but leverage Kubernetes out-of-the-box capabilities to solve the peer discovery problem.

Features

  • ๐Ÿ Modern Asyncio Pythonic API
  • ๐Ÿ”ฆ Brokerless Kubernetes native peer discovery based on headless services
  • ๐Ÿ”ญ Hooks into membership change events
  • ๐Ÿ› ๏ธ Ability to manage membership manually

Installation

pip install midgalor
# or
# poetry add midgalor
# pdm add midgalor

Usage

import migdalor

cluster = migdalor.Cluster(
    node_address=(node_address),  # the current node address (e.g. 127.0.0.1:8001)
    discovery=migdalor.KubernetesServiceDiscovery(service_address=cluster_address), # Kubernetes headless service address (e.g. cluster:8000)
    ## Callbacks on different events
    # nodes_added_handlers=[...] 
    # nodes_removed_handlers=[...],
    ## Membership update rate
    # update_every_secs=10,
)

await cluster.start()

# You can also add or remove nodes manually if you support that in your protocol
await cluster.add([("127.0.0.1", 8001)])
# await cluster.remove([("127.0.0.1", 8001)])

await cluster.stop()

Midgalor comes with some comprehensive example to help you get started:

  • The Party Cluster - An example of using Migdalor to implement peer discovery in Kubernetes cluster

migdalor's People

Contributors

roma-glushko avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

webclinic017

migdalor's Issues

Implement IP caching on DNS failures

Allow to cache membership info on DNS failures and implement some simple recovery strategy (e.g. shorten the next update time significantly to retry discovery that way and then grow that delay exponentially).

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.