kafka集群傳統部署(raft模式)—— 筑夢之路

kafka二進制包:https://dlcdn.apache.org/kafka/3.7.0/kafka_2.13-3.7.0.tgz

集群規劃

主機名IP地址節點ID角色分配
kafka1192.168.100.1001broker,controller
kafka2192.168.100.1012broker,controller
kafka3192.168.100.1023broker,controller

編輯配置文件

config/kraft/server.properties

# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.#
# This configuration file is intended for use in KRaft mode, where
# Apache ZooKeeper is not present.  See config/kraft/README.md for details.
############################## Server Basics ############################## The role of this server. Setting this puts us in KRaft mode
# 標識該節點所承擔的角色,在KRaft模式下需要設置這個值
process.roles=broker,controller# The node id associated with this instance's roles
# 節點的ID,和節點所承擔的角色相關聯,唯一 每個服務器不一樣
node.id=1# The connect string for the controller quorum
# controller quorum 連接的集群地址字符串。和配置zk連接差不多,只是格式不一樣 每個服務器一樣
controller.quorum.voters=1@192.168.100.100:9093,2@192.168.100.101:9093,3@192.168.100.102:9093############################# Socket Server Settings ############################## The address the socket server listens on. It will get the value returned from
# java.net.InetAddress.getCanonicalHostName() if not configured.
#   FORMAT:
#     listeners = listener_name://host_name:port
#   EXAMPLE:
#     listeners = PLAINTEXT://your.host.name:9092
## 本機ip+端口 每個服務器不一樣
listeners=PLAINTEXT://192.168.100.100:9092,CONTROLLER://192.168.100.100:9093
inter.broker.listener.name=PLAINTEXT# Hostname and port the broker will advertise to producers and consumers. If not set,
# it uses the value for "listeners" if configured.  Otherwise, it will use the value
# returned from java.net.InetAddress.getCanonicalHostName().
## 本機ip+端口 每個服務器不一樣
advertised.listeners=PLAINTEXT://192.168.100.100:9092# Listener, host name, and port for the controller to advertise to the brokers. If
# this server is a controller, this listener must be configured.
controller.listener.names=CONTROLLER# Maps listener names to security protocols, the default is for them to be the same. See the config documentation for more details
listener.security.protocol.map=CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT,SSL:SSL,SASL_PLAINTEXT:SASL_PLAINTEXT,SASL_SSL:SASL_SSL# The number of threads that the server uses for receiving requests from the network and sending responses to the network
num.network.threads=3# The number of threads that the server uses for processing requests, which may include disk I/O
num.io.threads=8# The send buffer (SO_SNDBUF) used by the socket server
socket.send.buffer.bytes=102400# The receive buffer (SO_RCVBUF) used by the socket server
socket.receive.buffer.bytes=102400# The maximum size of a request that the socket server will accept (protection against OOM)
socket.request.max.bytes=104857600############################# Log Basics ############################## A comma separated list of directories under which to store log files
# 數據日志目錄
log.dirs=/tmp/kraft-combined-logs# The default number of log partitions per topic. More partitions allow greater
# parallelism for consumption, but this will also result in more files across
# the brokers.
num.partitions=1# The number of threads per data directory to be used for log recovery at startup and flushing at shutdown.
# This value is recommended to be increased for installations with data dirs located in RAID array.
num.recovery.threads.per.data.dir=1############################# Internal Topic Settings  #############################
# The replication factor for the group metadata internal topics "__consumer_offsets" and "__transaction_state"
# For anything other than development testing, a value greater than 1 is recommended to ensure availability such as 3.
offsets.topic.replication.factor=1
transaction.state.log.replication.factor=1
transaction.state.log.min.isr=1############################# Log Flush Policy ############################## Messages are immediately written to the filesystem but by default we only fsync() to sync
# the OS cache lazily. The following configurations control the flush of data to disk.
# There are a few important trade-offs here:
#    1. Durability: Unflushed data may be lost if you are not using replication.
#    2. Latency: Very large flush intervals may lead to latency spikes when the flush does occur as there will be a lot of data to flush.
#    3. Throughput: The flush is generally the most expensive operation, and a small flush interval may lead to excessive seeks.
# The settings below allow one to configure the flush policy to flush data after a period of time or
# every N messages (or both). This can be done globally and overridden on a per-topic basis.# The number of messages to accept before forcing a flush of data to disk
#log.flush.interval.messages=10000# The maximum amount of time a message can sit in a log before we force a flush
#log.flush.interval.ms=1000############################# Log Retention Policy ############################## The following configurations control the disposal of log segments. The policy can
# be set to delete segments after a period of time, or after a given size has accumulated.
# A segment will be deleted whenever *either* of these criteria are met. Deletion always happens
# from the end of the log.# The minimum age of a log file to be eligible for deletion due to age
log.retention.hours=168# A size-based retention policy for logs. Segments are pruned from the log unless the remaining
# segments drop below log.retention.bytes. Functions independently of log.retention.hours.
#log.retention.bytes=1073741824# The maximum size of a log segment file. When this size is reached a new log segment will be created.
log.segment.bytes=1073741824# The interval at which log segments are checked to see if they can be deleted according
# to the retention policies
log.retention.check.interval.ms=300000

process.roles :

  • 如果process.roles = broker, 服務器在KRaft模式中充當 broker。
  • 如果process.roles = controller, 服務器在KRaft模式下充當 controller。
  • 如果process.roles = broker,controller,服務器在KRaft模式中同時充當 broker controller。
  • 如果process.roles 沒有設置。那么集群就假定是運行在ZooKeeper模式下。

同時充當Broker和Controller的節點稱為“組合”節點。

controller.quorum.voters

  • 系統中的所有節點都必須設置 controller.quorum.voters 配置。
  • 這個配置標識有哪些節點是 Quorum 的投票者節點。所有想成為控制器的節點都需要包含在這個配置里面。這類似于在使用ZooKeeper時,使用ZooKeeper.connect配置時必須包含所有的ZooKeeper服務器。
  • 然而,與ZooKeeper配置不同的是,controller.quorum.voters 配置需要包含每個節點的id。格式為: id1@host1:port1,id2@host2:port2。

生成集群唯一ID

bin/kafka-storage.sh random-uuid

格式化存儲目錄

如果是單節點模式運行,你需要在機器上執行如下命令。 如果是多個節點,則應該在每個節點上都分別運行format命令,以便格式化每臺機器上的。請確保為每個集群使用相同的集群ID。

bin/kafka-storage.sh format -t [上面生成的ID] -c ./config/kraft/server.properties

啟動服務端

在每個節點上執行啟動命令

bin/kafka-server-start.sh ./config/kraft/server.properties 

?關閉服務端

bin/kafka-server-stop.sh stop

參考資料:https://juejin.cn/post/7030974149115772964

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/diannao/12407.shtml
繁體地址,請注明出處:http://hk.pswp.cn/diannao/12407.shtml
英文地址,請注明出處:http://en.pswp.cn/diannao/12407.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

代碼隨想錄算法訓練營第36天|● 738.單調遞增的數字 ● 968.監控二叉樹

738. 單調遞增的數字 發現第一位變小了其他的迅速變9 class Solution:def monotoneIncreasingDigits(self, n: int) -> int:strnlist(str(n))for i in range(len(strn)-1,0,-1):if strn[i-1]>strn[i]:strn[i-1]str(int(strn[i-1])-1)for j in range(i,len(strn)):strn[…

超級簡單的地圖操作工具開發可疑應急,地圖畫點,畫線,畫區域,獲取地圖經緯度等

使用echars的地圖畫點,畫線,畫區域,獲取地圖經緯度等 解壓密碼:10086007 地圖也是用臨時的bmap.js和china.js純離線二選一 一共就這么多文件 畫點,畫線,畫區域 點擊地圖獲取經緯度-打印到控制臺,這樣就能渲染航跡,多變形,結合其他算法算圓等等操作 下載資源:https://download…

JSON-server 服務的搭建

1、全局安裝: pnpm i -g json-server2、創建db.json文件 {"posts": [{"id": 1,"title": "json-server","author": "typicode"}],"comments":[{"id": 1,"body": "…

什么情況下會造成索引失效?

2.3.4. 索引失效 對索引使用左或者左右模糊匹配 使用左或者左右模糊匹配的時候,也就是 like %xx 或者 like %xx% 這兩種方式都會造成索引失效。但是如果前綴是確定的那么就可以使用到索引,例如 name like 許%。 因為索引 B 樹是按照「索引值」有序排列…

SpringBoot 中 zip 文件解壓工具類

SpringBoot 中 zip 文件解壓工具類 zip 文件解壓&#xff08;不支持密碼&#xff09; 相關 Maven 依賴 <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> <version>3.6</version>…

練習題(2024/5/14)

1四數相加 II 給你四個整數數組 nums1、nums2、nums3 和 nums4 &#xff0c;數組長度都是 n &#xff0c;請你計算有多少個元組 (i, j, k, l) 能滿足&#xff1a; 0 < i, j, k, l < nnums1[i] nums2[j] nums3[k] nums4[l] 0 示例 1&#xff1a; 輸入&#xff1a;n…

代碼隨想錄訓練營Day28:貪心算法06

1.738單調遞增的數字 貪心策略&#xff1a;如果strNum[i]<strNum[i-1]那么strNum[i] 9,strNum[i-1]--;//比如87對應的最大的單調遞增的就是79. 具體實現&#xff1a; 對于遇到小于的情況&#xff1a;如果strNum[i]<strNum[i-1]那么strNum[i] 9,strNum[i-1]--;遍歷順…

linux phpstudy 重啟命令

[rootLinuxWeb phpstudy]# ./system/phpstudyctl restart 查看命令 1) phpstudy -start 啟動小皮面板 2) phpstudy -stop 停止小皮面板 3) phpstudy -restart 重啟小皮面板 4) phpstudy -status 查詢面板狀態 5) phpstudy -in…

OFDM802.11a的FPGA實現(十五)短訓練序列:STS(含Matlab和verilog代碼)

原文鏈接&#xff08;相關文章合集&#xff09;&#xff1a;OFDM 802.11a的xilinx FPGA實現 1.前言 在之前已經完成了data域數據的處理&#xff0c;在構建整個802.11a OFDM數據幀的時候&#xff0c;還剩下前導碼和signal域的數據幀&#xff0c;這兩部分的內容。 PLCP的前導部分…

Nodejs筆記2

模塊化 模塊化初體驗 模塊暴露數據 導入模塊 fs 寫絕對路徑 require寫相對路徑不會受到影響 ./../不能省略 js 和json文件后綴可以省略 如果存在 命名相同的js和json文件&#xff0c;優先導入js文件 導入文件夾時的情況 require導入模塊的基本流程 commonJS模塊…

其它高階數據結構①_并查集(概念+代碼+兩道OJ)

目錄 1. 并查集的概念 2. 并查集的實現 3. 并查集的應用 3.1 力扣LCR 116. 省份數量 解析代碼1 解析代碼2 3.2 力扣990. 等式方程的可滿足性 解析代碼 本篇完。 寫在前面&#xff1a; 此高階數據結構系列&#xff0c;雖然放在⑤數據結構與算法專欄&#xff0c;但還是作…

【數據可視化01】matplotlib實例介紹4之六邊形分箱圖

目錄 一、引言二、實例介紹 一、引言 hexbin是一個二維直方圖&#xff0c;其中箱子是六邊形&#xff0c;顏色表示每個箱子內的數據點數。 二、實例介紹 import matplotlib.pyplot as plt import numpy as np# Fixing random state for reproducibility np.random.seed(19680…

服務器利用率的神器腳本

在服務器管理的過程中&#xff0c;了解服務器的各項性能指標是至關重要的。無論是CPU的負載情況&#xff0c;內存使用情況&#xff0c;還是硬盤的存儲空間以及TCP連接狀態&#xff0c;這些都是我們判斷服務器健康狀態和性能的重要依據。然而&#xff0c;手動一項項去檢查這些指…

【MySQL】Mysql——安裝指南(Linux)

MySQL8.0.26-Linux版安裝 1. 準備一臺Linux服務器 云服務器或者虛擬機都可以; Linux的版本為 CentOS7; 2. 下載Linux版MySQL安裝包 3. 上傳MySQL安裝包 4. 創建目錄,并解壓 mkdir mysqltar -xvf mysql-8.0.26-1.el7.x86_64.rpm-bundle.tar -C mysql5. 安裝mysql的安裝包 …

pip鏡像源

1.1 清華大學 https://pypi.tuna.tsinghua.edu.cn/simple 1.2 阿里云 https://mirrors.aliyun.com/pypi/simple/ 1.3 網易 https://mirrors.163.com/pypi/simple/ 1.4 豆瓣 https://pypi.douban.com/simple/ 1.5 百度云 https://mirror.baidu.com/pypi/simple/ 1.6 中科大 ht…

uniapp vue 獲取天氣數據

獲取當前地址&#xff0c;通過高德天氣數據&#xff0c;來展示天氣溫度風度等數據 //獲取天氣 getWeather(){// 獲取天氣預報uni.request({url: https://restapi.amap.com/v3/weather/weatherInfo, data: {city: 長沙,// extensions:all,key: xxxxxxxxxx//自己的高德密鑰key},…

2024OD機試卷-轉盤壽司 (java\python\c++)

題目:轉盤壽司 題目描述 壽司店周年慶,正在舉辦 優惠活動 回饋新老客戶。 壽司轉盤上總共有 n 盤壽司,prices[i] 是第 i 盤壽司的價格, 如果客戶選擇了第 i 盤壽司,壽司店免費贈送客戶距離第 i 盤壽司最近的下一盤壽司 j,前提是 prices[j] < prices[i],如果沒有滿足…

RAG 面向 LLM: 基于檢索增強的大語言模型調研

摘要 作為 AI 領域最先進的技術之一,檢索增強生成(RAG)技術可以提供可靠和最新的外部知識,為眾多任務提供巨大的便利。特別是在 AI 生成內容(AIGC)時代,RAG 中檢索強大的提供額外知識的能力使得檢索增強生成能夠輔助現有生成式 AI 生產高質量輸出。最近,大語言模型(LLM)在語言…

Zoho CRM企業成長的智能引擎,智能化銷售自動化

數字化時代&#xff0c;客戶體驗已成為企業競爭的核心要素。卓豪Zoho CRM&#xff0c;作為全球領先的SaaS云端客戶關系管理平臺&#xff0c;正引領著一場企業運營模式的變革&#xff0c;助力超過25萬家企業跨越180多個國家&#xff0c;實現客戶互動與業務增長的無縫對接。讓我們…

廣汽原車控制系統CAN協議控制汽車基本信息獲取及數據應用

在現代汽車工業的迅速發展中&#xff0c;車輛控制系統的智能化和網絡化已成為提升汽車性能的關鍵。廣汽作為中國汽車行業的佼佼者&#xff0c;其在原車通信網絡方面也取得了顯著的成就。特別是廣汽原車CAN&#xff08;Controller Area Network&#xff09;協議的應用&#xff0…