debian kafka_如何在Debian 10上安装Apache Kafka

debian kafka

介绍 (Introduction)

Apache Kafka is a popular distributed message broker designed to handle large volumes of real-time data. A Kafka cluster is highly scalable and fault-tolerant, and also has a much higher throughput compared to other message brokers such as ActiveMQ and RabbitMQ. Though it is generally used as a publish/subscribe messaging system, a lot of organizations also use it for log aggregation because it offers persistent storage for published messages.

Apache Kafka是一种流行的分布式消息代理,旨在处理大量实时数据。 与其他消息代理(例如ActiveMQRabbitMQ)相比,Kafka集群具有高度的可伸缩性和容错性,并且吞吐量也更高。 尽管通常将其用作发布/订阅消息传递系统,但许多组织也将其用于日志聚合,因为它为发布的消息提供了持久的存储。

A publish/subscribe messaging system allows one or more producers to publish messages without considering the number of consumers or how they will process the messages. Subscribed clients are notified automatically about updates and the creation of new messages. This system is more efficient and scalable than systems where clients poll periodically to determine if new messages are available.

发布/订阅消息传递系统允许一个或多个生产者发布消息,而无需考虑使用者的数量或他们将如何处理消息。 订阅的客户端会自动收到有关更新和新消息创建的通知。 该系统比客户端定期轮询以确定是否有新消息的系统更有效和可扩展。

In this tutorial, you will install and configure Apache Kafka 2.1.1 securely on a Debian 10 server, then test your setup by producing and consuming a Hello World message. You will then optionally install KafkaT to monitor Kafka and set up a Kafka multi-node cluster.

在本教程中,您将在Debian 10服务器上安全地安装和配置Apache Kafka 2.1.1,然后通过产生和使用Hello World消息来测试设置。 然后,您可以选择安装KafkaT来监视Kafka并设置Kafka多节点集群。

先决条件 (Prerequisites)

To follow along, you will need:

要继续进行,您将需要:

Note: Installations without 4GB of RAM may cause the Kafka service to fail, with the Java virtual machine (JVM) throwing an Out Of Memory exception during startup.

注意:没有4GB RAM的安装可能会导致Kafka服务失败,并且Java虚拟机(JVM)在启动过程中会抛出Out Of Memory异常。

第1步-为Kafka创建用户 (Step 1 — Creating a User for Kafka)

Since Kafka can handle requests over a network, it is a best practice to create a dedicated user for it. This minimizes damage to your Debian machine should the Kafka server be compromised. You will create the dedicated user kafka in this step.

由于Kafka可以通过网络处理请求,因此最佳做法是为其创建专用用户。 如果Kafka服务器受到威胁,这可以最大程度地减少对Debian计算机的损坏。 您将在此步骤中创建专用用户kafka

Logged in as your non-root sudo user, create a user called kafka with the useradd command:

以非root用户sudo用户身份登录,使用useradd命令创建一个名为kafka的用户:

  • sudo useradd kafka -m

    须藤useradd kafka -m

The -m flag ensures that a home directory will be created for the user. This home directory, /home/kafka, will act as your workspace directory for executing commands later on.

-m标志可确保为用户创建一个主目录。 此主目录/home/kafka将充当您的工作区目录,以便稍后执行命令。

Set the password using passwd:

使用passwd设置密码:

  • sudo passwd kafka

    须藤密码卡夫卡

Enter the password you wish to use for this user.

输入您想要用于该用户的密码。

Next, add the kafka user to the sudo group with the adduser command, so that it has the privileges required to install Kafka’s dependencies:

接下来,使用adduser命令将kafka用户添加到sudo组,以使其具有安装Kafka依赖项所需的特权:

  • sudo adduser kafka sudo

    sudo adduser卡夫卡sudo

Your kafka user is now ready. Log into this account using su:

您的kafka用户现已准备就绪。 使用su登录到该帐户:

  • su -l kafka

    苏-卡夫卡 </
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值