Code Monkey home page Code Monkey logo

zookeeper_load_balance's Introduction

zookeeper_load_balance

Zookeeper 版本分布式负载均衡

项目介绍

  1. 使用flask 作为服务端演示,加多进程开启多个服务
  2. 原理使用 zookeeper的 临时节点,共享服务负载状态
  3. 客户端选择节点负载最小的一个进行连接,目前仅实现该算法

安装 kazoo 可能会出现问题

  File "D:\environment\python3.6\lib\site-packages\kazoo\handlers\utils.py", line 130, in _set_fd_cloexec
    flags = fcntl.fcntl(fd, fcntl.F_GETFD)
AttributeError: module 'fcntl' has no attribute 'F_GETFD'

解决方案

在 kazoo/hanlders/utils.py 上方

try:
    import fcntl
except ImportError:  # pragma: nocover
    HAS_FNCTL = False

改为 

HAS_FNCTL = False

zookeeper优化

  1. zookeeper 需修改配置,放开并发限制
maxClientCnxns=0

1. 0代表不限制
2. 默认为 60 表示单个IP最多60个连接

博客, 项目说明

https://blog.csdn.net/weixin_42290927/article/details/118574217

zookeeper_load_balance's People

Contributors

laurel-rao avatar

Watchers

James Cloos avatar  avatar

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.