Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Multi-kafka for high availability

Đang mở
#308 5 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
25/100
Loại issue
Lỗi
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
kafka, python

Hướng nghiên cứu

Start by running the provided asyncio example with two from_kafka_batched sources and an a.union(b) sink, then stop one Kafka cluster to reproduce the freeze. Trace the asynchronous Kafka source and union behavior to identify where progress stops. Done means the combined stream continues handling the available cluster when the other cluster is stopped, with coverage for the failure case.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

We are setting up Kafka in multiple data centers to achieve high availability. I expected that Streamz could do a union between both of these clusters. Everything works as expected, but when I stop one of the Kafka clusters, the stream freezes. I'm thinking there is a callback somewhere that is blocking operations?

import asyncio

import confluent_kafka as ck
from streamz import from_kafka_batched


async def produce(broker, cluster_id, topic):
    p = ck.Producer({'bootstrap.servers': broker})

    for i in range(100000):
        p.poll(0)
        p.produce(topic, 'cluster-{} value-{}'.format(cluster_id, i))
        p.flush(timeout=0.5)
        await asyncio.sleep(1)


async def main():
    topic = 'test-topic'
    args1 = {'bootstrap.servers': 'localhost:9092', 'group.id': 'test-group'}
    args2 = {'bootstrap.servers': 'localhost:9093', 'group.id': 'test-group'}
    a = from_kafka_batched(topic, args1, npartitions=1, start=True,
                           asynchronous=True)
    b = from_kafka_batched(topic, args2, npartitions=1, start=True,
                           asynchronous=True)

    a.union(b).sink(print)

    asyncio.create_task(produce('localhost:9092', 1, topic))
    asyncio.create_task(produce('localhost:9093', 2, topic))

    while True:
        await asyncio.sleep(1)


if __name__ == '__main__':
    asyncio.run(main())
Ngôn ngữ chính
Python
Star
1.3k
Fork
149
Merge trung bình
17 giờ 39 phút
Pull request đã merge (30 ngày)
1

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của python-streamz/streamz

Tất cả issue của python-streamz/streamz

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.