هذه الصفحة غير متوفرة حاليًا بلغتك المحلية. نحن نعمل جاهدين على إضافة المزيد من اللغات. شاكرين تفهمك ودعمك المستمر لنا.

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
Help Center/ Distributed Message Service for Kafka/ User Guide/ Connecting to an Instance/ Connecting to Kafka Using the Client (SASL Disabled)

Connecting to Kafka Using the Client (SASL Disabled)

Updated on 2025-02-14 GMT+08:00

This section describes how to access a Kafka instance with SASL disabled on an open-source Kafka client. With SASL disabled, there is no authentication required in such a connection and data is transmitted in plaintext, which is friendly to performance.

Notes and Constraints

For instances purchased in July 2020 and later, each Kafka broker allows a maximum of 1000 connections from each IP address by default. For instances purchased before July 2020, each Kafka broker allows a maximum of 200 connections from each IP address by default. Excess connections will be rejected. You can change the limit by referring to Modifying Kafka Instance Configuration Parameters, that is, to modify parameter max.connections.per.ip.

Prerequisites

  • The network between the client and the Kafka instance has been established. For details about the network requirements, see Kafka Network Connection Conditions.
  • Security group rules have been properly configured.

    Before accessing a Kafka instance with SASL disabled on a client, configure proper security group rules for the instance. For details, see Table 2.

  • The Kafka instance addresses have been obtained.
    Obtain the instance connection addresses in the Connection area on the Basic Information page on the Kafka console. The addresses are displayed in two types on the Kafka console. The one is Private Network Access or Public Network Access and the other is Address (Private Network, Plaintext) or Address (Public Network, Plaintext).
    • For private access within a VPC, the Kafka connection addresses are shown as follows.
      Figure 1 Kafka instance addresses for private access within a VPC (Instance Address (Private Network))
      Figure 2 Kafka instance addresses for private access within a VPC (Address (Private Network, Plaintext))
    • For public access, the Kafka connection addresses are shown as follows.
      Figure 3 Kafka instance addresses for public access (Instance Address (Public Network))
      Figure 4 Kafka instance addresses for public access (Address (Public Network, Plaintext))
  • If automatic topic creation is not enabled for the Kafka instance, create a topic before connecting to the instance.
  • Kafka CLI v1.1.0, v2.3.0, v2.7.2, or v3.4.0 is available. Ensure that the Kafka instance and the CLI use the same version.
  • JDK v1.8.111 or later has been installed on the server, and the JAVA_HOME and PATH environment variables have been configured as follows:

    Add the following lines to the .bash_profile file in the home directory as an authorized user. In this command, /opt/java/jdk1.8.0_151 is the JDK installation path. Change it to the path where you install JDK.

    export JAVA_HOME=/opt/java/jdk1.8.0_151 
    export PATH=$JAVA_HOME/bin:$PATH

    Run the source .bash_profile command for the modification to take effect.

Accessing the Instance Using CLI

The following uses Linux as an example.

  1. Decompress the Kafka CLI package.

    Access the directory where the CLI package is stored and run the following command to decompress the package:

    tar -zxf [kafka_tar]

    In the preceding command, [kafka_tar] indicates the name of the CLI package.

    For example:

    tar -zxf kafka_2.12-2.7.2.tgz

  2. Access the /bin directory of the Kafka CLI.

    In Windows, you need to access the /bin/windows directory.

  3. Run the following command to produce messages:

    ./kafka-console-producer.sh --broker-list ${connection-address} --topic ${topic-name}

    Parameter description:

    • {connection-address}: the address obtained in Prerequisites.
    • {topic-name}: the name of the topic created for the Kafka instance. If automatic topic creation has enabled for the Kafka instance, set this parameter to the name of a created topic or a topic that has not been created.

    The following example uses connection addresses 10.xx.xx.45:9094,10.xx.xx.127:9094,10.xx.xx.103:9094. After running the preceding command, you can send a message to the Kafka instance by writing it and pressing Enter. Each line of content is sent as a message.

    [root@ecs-kafka bin]# ./kafka-console-producer.sh --broker-list 10.xx.xx.45:9094,10.xx.xx.127:9094,10.xx.xx.103:9094  --topic topic-demo
    >Hello
    >DMS
    >Kafka!
    >^C[root@ecs-kafka bin]# 

    To stop producing messages, press Ctrl+C to exit.

  4. Run the following command to consume messages:

    ./kafka-console-consumer.sh --bootstrap-server ${connection-address} --topic ${topic-name} --group ${consumer-group-name} --from-beginning

    Parameter description:

    • {connection-address}: the address obtained in Prerequisites.
    • {topic-name}: the name of the topic created for the Kafka instance.
    • {consumer-group-name}: the consumer group name set based on your service requirements. If a consumer group name has been specified in the configuration file, ensure that you use the same name in the command line. Otherwise, consumption may fail. If a consumer group name starts with a special character, such as a number sign (#), the monitoring data cannot be displayed.

    Example:

    [root@ecs-kafka bin]#  ./kafka-console-consumer.sh --bootstrap-server 10.xx.xx.45:9094,10.xx.xx.127:9094,10.xx.xx.103:9094 --topic topic-demo --group order-test --from-beginning
    Kafka!
    DMS
    Hello
    ^CProcessed a total of 3 messages
    [root@ecs-kafka bin]# 

    To stop consuming messages, press Ctrl+C to exit.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback