Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API 网关:dashboard 使用 RabbitMQ 作为 celery 的 broker (>=1.12.1 版本) #275

Open
alex-smile opened this issue Sep 27, 2023 · 0 comments

Comments

@alex-smile
Copy link
Contributor

alex-smile commented Sep 27, 2023

Description

网关管理端 dashboard 模块,需要用到 celery 后台任务,其默认使用 redis 作为 celery broker,但是此方案有一些缺点:

    1. 多个部署实例如果共用了 redis,可能导致 celery 任务被错误调度
    1. 不太可靠,没有机制保证消息的消费,消费者消费失败时候,消息体丢失
    1. 无法保证顺序,redis 无法保证任务执行的顺序,可能会导致任务之间的依赖关系出现问题

对于开发环境,可使用默认的 redis,比较简单;但对于生产环境,推荐使用 RabbitMQ。网关在 >= 1.12.1 版本,支持配置外部的 RabbitMQ,values.yaml 中配置样例如下;可以为每个环境创建单独的 vhost,保障部署环境数据的隔离。

## 外部 Rabbitmq 配置
##
externalRabbitmq:
  ## 默认 Rabbitmq 连接信息
  ## 如未完成配置,则使用 redis 作为 celery broker
  ##
  default:
    ## 连接地址
    ##
    host: "rabbitmq.example.com"
    ## 连接端口
    ##
    port: 5672
    ## 用户名
    ##
    username: "bk_apigateway"
    ## 明文方式的密码
    ##
    password: ""
    ## virtual host
    ##
    vhost: "bk_apigateway"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant