127: 标准化 openim go dev,替换 zookeeper 注册中心

Standardize openim go dev

I've been using the Go module from github.com/OpenIMSDK/Open-IM-Server. I've noticed that, as the module has reached version v3.3.0, according to the Go module's versioning semantics, it should have a /v3 suffix in the import path for the module to be correctly recognized. This is essential for tools like pkg.go.dev to map to the correct version number.

Currently, the package at https://pkg.go.dev/github.com/OpenIMSDK/Open-IM-Server isn't recognizing the version correctly due to this missing suffix.

To resolve this, I propose a two-step solution:

  1. Add the /v3 suffix to your module path. This will ensure that the Go toolchain and other related tools understand and recognize the correct version of your module.
  2. I'd like to suggest considering changing the URL to a more succinct and potentially branded version: From: github.com/OpenIMSDK/Open-IM-Server To: openim.cc/open-im-server

By adopting the above changes, the final Go import path would look something like this: openim.cc/open-im-server/v3.

I believe these changes will not only enhance the recognition of the correct version but also provide a cleaner and more streamlined module path for developers.

Replace Zookeeper Dependency in Docker Compose for Modern Kafka

We have recently upgraded to Kafka version 3.5.1 in our Docker Compose setup. Notably, recent versions of Kafka no longer have a dependency on Zookeeper. However, our current Docker Compose file still contains configurations for Zookeeper.

  zookeeper:
   image: bitnami/zookeeper:3.8
   container_name: zookeeper
   ports:
    - "${ZOOKEEPER_PORT}:2181"
   volumes:
     - "/etc/localtime:/etc/localtime"
   environment:
     - ALLOW_ANONYMOUS_LOGIN=yes
     - TZ="Asia/Shanghai"
   restart: always
   networks:
      server:
        ipv4_address: ${ZOOKEEPER_NETWORK_ADDRESS}

  kafka:
    image: 'bitnami/kafka:3.5.1'
    container_name: kafka
    user: root
    restart: always
    ports:
    - "${KAFKA_PORT}:9094"
    volumes:
      - ./scripts/create_topic.sh:/opt/bitnami/kafka/create_topic.sh
      - ${DATA_DIR}/components/kafka:/bitnami/kafka
    command: >
      bash -c "
      /opt/bitnami/scripts/kafka/run.sh & sleep 5; /opt/bitnami/kafka/create_topic.sh; wait
      "
    extra_hosts:
      - "host.docker.internal:host-gateway"
    environment:
       - TZ=Asia/Shanghai
       - KAFKA_CFG_NODE_ID=0
       - KAFKA_CFG_PROCESS_ROLES=controller,broker
       - KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=0@<your_host>:9093
       - KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093,EXTERNAL://:9094
       - KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://kafka:9092,EXTERNAL://${DOCKER_BRIDGE_GATEWAY}:${KAFKA_PORT}
       - KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=CONTROLLER:PLAINTEXT,EXTERNAL:PLAINTEXT,PLAINTEXT:PLAINTEXT
       - KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER
    networks:
      server:
        ipv4_address: ${KAFKA_NETWORK_ADDRESS}

Given this change, we should consider replacing Zookeeper to modernize our Kafka setup and possibly reduce resource overhead. One known alternative is Kraft. However, we are open to suggestions on other alternatives.

Requirements:

  1. Identify potential alternatives to Zookeeper for Kafka.
  2. Compare the pros and cons of each alternative.
  3. Update Docker Compose file to reflect the new setup.

Potential Alternatives:

  1. Kraft:
    • Pros:
      • Native to Kafka: Simplifies Kafka setup and reduces external dependencies.
      • Improved stability and fewer moving parts.
    • Cons:
      • Might require some changes to our current scripts and configuration.
      • Need to validate its stability and performance in our specific use case.

table:

FeaturesNacosEurekaConsulCoreDNSZookeeper
Consistency ProtocolCP+APAPCPCP
Health CheckTCP/HTTP/MYSQL/Client BeatClient BeatTCP/HTTP/gRPC/CmdKeep Alive
Load Balancing StrategyWeight/metadata/SelectorRibbonFabioRoundRobin
Avalanche ProtectionYesYesNoNoNo
Auto DeregisterSupportedSupportedSupportedNot SupportedSupported
ProtocolHTTP/DNSHTTPHTTP/DNSDNSTCP
Listeners SupportSupportedSupportedSupportedNot SupportedSupported
Multi-datacenterSupportedSupportedSupportedNot SupportedNot Supported
Cross Registry SyncSupportedNot SupportedSupportedNot SupportedNot Supported
SpringCloud IntegrationSupportedSupportedSupportedNot SupportedSupported
Dubbo IntegrationSupportedNot SupportedSupportedNot SupportedSupported
K8S IntegrationSupportedNot SupportedSupportedSupportedNot Supported
Programming LanguageJavaJavaGoGoJava
Data Storage BackendMySQLIn-memoryLevelDBFile System

中文:

功能特性NacosEurekaConsulCoreDNSZookeeper
一致性协议CP+APAPCPCP
健康检查TCP/HTTP/MYSQL/Client BeatClient BeatTCP/HTTP/gRPC/CmdKeep Alive
负载均衡策略权重/metadata/SelectorRibbonFabioRoundRobin
雪崩保护
自动注销实例支持支持支持不支持支持
访问协议HTTP/DNSHTTPHTTP/DNSDNSTCP
监听支持支持支持支持不支持支持
多数据中心支持支持支持不支持不支持
跨注册中心同步支持不支持支持不支持不支持
SpringCloud集成支持支持支持不支持支持
Dubbo集成支持不支持支持不支持支持
K8S集成支持不支持支持支持不支持
编程语言JavaJavaGoGoJava
数据存储后端MySQL内存LevelDB文件系统

Note:

  • "一致性协议" is translated to "Consistency Protocol".
  • "健康检查" is translated to "Health Check".
  • "负载均衡策略" is translated to "Load Balancing Strategy".
  • "雪崩保护" is translated to "Avalanche Protection".
  • "自动注销实例" is translated to "Auto Deregister".
  • "访问协议" is translated to "Protocol".
  • "监听支持" is translated to "Listeners Support".
  • "多数据中心" is translated to "Multi-datacenter".
  • "跨注册中心同步" is translated to "Cross Registry Sync".
  • "SpringCloud集成" is translated to "SpringCloud Integration".
  • "Dubbo集成" is translated to "Dubbo Integration".
  • "K8S集成" is translated to "K8S Integration".

Action items:

  1. Conduct a feasibility study on the proposed alternatives.
  2. Test the selected alternative in a sandbox environment.
  3. Update Docker Compose and related configurations.
  4. Document the changes and migration steps.