当前位置: 首页 > news >正文

婺源网站建设如何提高网站排名seo

婺源网站建设,如何提高网站排名seo,相亲网站拉人做基金,网站制作网络推广方案以上是kafka的数据的存储方式。 这些数据可以在服务器集群上对应的文件夹中查看到。 [hexuanhadoop106 __consumer_offsets-0]$ ll 总用量 8 -rw-rw-r--. 1 hexuan hexuan 10485760 10月 28 22:21 00000000000000000000.index -rw-rw-r--. 1 hexuan hexuan 0 10月 28 …

以上是kafka的数据的存储方式。

这些数据可以在服务器集群上对应的文件夹中查看到。

[hexuan@hadoop106 __consumer_offsets-0]$ ll
总用量 8
-rw-rw-r--. 1 hexuan hexuan 10485760 10月 28 22:21 00000000000000000000.index
-rw-rw-r--. 1 hexuan hexuan        0 10月 28 22:21 00000000000000000000.log
-rw-rw-r--. 1 hexuan hexuan 10485756 10月 28 22:21 00000000000000000000.timeindex
-rw-rw-r--. 1 hexuan hexuan        8 10月 28 22:21 leader-epoch-checkpoint
-rw-rw-r--. 1 hexuan hexuan       43 10月 28 22:21 partition.metadata

每个文件夹以topic+partition进行命名,更加便于管理和查询检索,因为kafka的数据都是按照条进行处理和流动的一般都是给流式应用做数据供给和缓冲,所以检索速度必须要快,分块管理是最好的方式。

消费者在检索相应数据的时候会非常的简单。

consumer检索数据的过程。

首先文件的存储是分段的,那么文件的名称代表的就是这个文件中存储的数据范围和条数。

00000000000000000000.index
00000000000000000000.log
00000000000000000000.timeindex
代表存储的数据是从0条开始的

00000000000000100000.index
00000000000000100000.log
00000000000000100000.timeindex
代表存储的数据是从100000条开始的

所以首先检索数据的时候就可以跳过1G为大小的块,比如检索888这条数据的,就可以直接去00000000000000000000.log中查询数据

那么查询数据还是需要在1G大小的内容中找寻是比较麻烦的,这个时候可以从index索引出发去检索,首先我们可以通过kafka提供的工具类去查看log和index中的内容

# 首先创建一个topic_bkafka-topics.sh --bootstrap-server hadoop106:9092 --create --topic topic_b --partitions 5 --replication-factor 2
# 然后通过代码随机向不同的分区中分发不同的数据1W条
package com.hainiu.kafka.consumer;/*** ClassName : test1* Package : com.hainiu.kafka.consumer* Description** @Author HeXua* @Create 2024/11/3 22:45* Version 1.0*/
import org.apache.kafka.clients.producer.KafkaProducer;
import org.apache.kafka.clients.producer.ProducerConfig;
import org.apache.kafka.clients.producer.ProducerRecord;
import org.apache.kafka.common.serialization.StringSerializer;import java.util.Properties;public class test1 {public static void main(String[] args) throws InterruptedException {Properties pro = new Properties();pro.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG,"hadoop106:9092");pro.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName());pro.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName());pro.put(ProducerConfig.BATCH_SIZE_CONFIG, 16*1024);pro.put(ProducerConfig.LINGER_MS_CONFIG, 100);pro.put(ProducerConfig.BUFFER_MEMORY_CONFIG, 1024*1024*64);pro.put(ProducerConfig.ENABLE_IDEMPOTENCE_CONFIG, true);pro.put(ProducerConfig.RETRIES_CONFIG, 3);pro.put(ProducerConfig.COMPRESSION_TYPE_CONFIG, "snappy");pro.put(ProducerConfig.MAX_IN_FLIGHT_REQUESTS_PER_CONNECTION, 5);KafkaProducer<String, String> producer = new KafkaProducer<String, String>(pro);for (int i = 0; i < 10000; i++) {ProducerRecord<String, String> record = new ProducerRecord<>("topic_b", ""+i,"this is hainiu");producer.send(record);}producer.close();}
}

然后去查看log和index中的内容

# kafka查看日志和索引的命令
kafka-run-class.sh kafka.tools.DumpLogSegments --files xxx

查看日志.log

[hexuan@hadoop106 topic_b-0]$ kafka-run-class.sh kafka.tools.DumpLogSegments --files 00000000000000000000.log 
Dumping 00000000000000000000.log
Log starting offset: 0
baseOffset: 0 lastOffset: 605 count: 606 baseSequence: 0 lastSequence: 605 producerId: 11 producerEpoch: 0 partitionLeaderEpoch: 0 isTransactional: false isControl: false deleteHorizonMs: OptionalLong.empty position: 0 CreateTime: 1730645208553 size: 5149 magic: 2 compresscodec: snappy crc: 595601909 isvalid: true
baseOffset: 606 lastOffset: 1205 count: 600 baseSequence: 606 lastSequence: 1205 producerId: 11 producerEpoch: 0 partitionLeaderEpoch: 0 isTransactional: false isControl: false deleteHorizonMs: OptionalLong.empty position: 5149 CreateTime: 1730645208577 size: 4929 magic: 2 compresscodec: snappy crc: 1974998903 isvalid: true
baseOffset: 1206 lastOffset: 1439 count: 234 baseSequence: 1206 lastSequence: 1439 producerId: 11 producerEpoch: 0 partitionLeaderEpoch: 0 isTransactional: false isControl: false deleteHorizonMs: OptionalLong.empty position: 10078 CreateTime: 1730645208584 size: 2085 magic: 2 compresscodec: snappy crc: 1665550202 isvalid: true

查看索引.index

内容即:

index索引

offset 第几条position 物理偏移量位置,也就是第几个字
11875275
176710140
202215097

log日志

# 打印日志内容的命令 --print-data-log 打印数据
kafka-run-class.sh kafka.tools.DumpLogSegments --files 00000000000000000000.log --print-data-log
Dumping 00000000000000000000.log
Log starting offset: 0
baseOffset: 0 lastOffset: 605 count: 606 baseSequence: 0 lastSequence: 605 producerId: 11 producerEpoch: 0 partitionLeaderEpoch: 0 isTransactional: false isControl: false deleteHorizonMs: OptionalLong.empty position: 0 CreateTime: 1730645208553 size: 5149 magic: 2 compresscodec: snappy crc: 595601909 isvalid: true
| offset: 0 CreateTime: 1730645208524 keySize: 2 valueSize: 14 sequence: 0 headerKeys: [] key: 14 payload: this is hainiu
| offset: 1 CreateTime: 1730645208524 keySize: 2 valueSize: 14 sequence: 1 headerKeys: [] key: 19 payload: this is hainiu
| offset: 2 CreateTime: 1730645208524 keySize: 2 valueSize: 14 sequence: 2 headerKeys: [] key: 24 payload: this is hainiu
| offset: 3 CreateTime: 1730645208524 keySize: 2 valueSize: 14 sequence: 3 headerKeys: [] key: 26 payload: this is hainiu

可以看到刷写的日志

baseOffset: 0 lastOffset: 605 count: 606

从0 到605 条一次性刷写606条

lastSequence: 605 producerId

刷写事务日志编号,生产者的编号

通过名称跳过1G的端,然后找到相应的index的偏移量,然后根据偏移量定位log位置,不断向下找寻数据。

大家可以看到index中的索引数据是轻量稀疏的,这个数据是按照4KB为大小生成的,一旦刷写4KB大小的数据就会写出相应的文件索引。

官网给出的默认值4KB

一个数据段大小是1G

timeIndex

我们看到在数据中还包含一个timeindex的时间索引

# 查询时间索引
kafka-run-class.sh kafka.tools.DumpLogSegments --files 00000000000000000000.timeindex 
[hexuan@hadoop106 topic_b-0]$ kafka-run-class.sh kafka.tools.DumpLogSegments --files 00000000000000000000.timeindex 
Dumping 00000000000000000000.timeindex
timestamp: 1730645208577 offset: 1205
timestamp: 1730645208584 offset: 1439

可以看到和index索引一样,这个也是4Kb写出一部分数据,但是写出的是时间,我们可以根据时间进行断点找寻数据,指定时间重复计算

也就是说,写到磁盘的数据是按照1G分为一个整体部分的,但是这个整体部分需要4KB写一次,并且一次会生成一个索引问题信息,在检索的时候可以通过稀疏索引进行数据的检索,效率更快。


文章转载自:
http://wrongheaded.crhd.cn
http://trait.crhd.cn
http://loganberry.crhd.cn
http://tob.crhd.cn
http://unbathed.crhd.cn
http://hp.crhd.cn
http://boulder.crhd.cn
http://pertinacity.crhd.cn
http://pedagogue.crhd.cn
http://unnoticed.crhd.cn
http://shamus.crhd.cn
http://coleoptile.crhd.cn
http://applausive.crhd.cn
http://eucalyptus.crhd.cn
http://prohibiter.crhd.cn
http://knucklebone.crhd.cn
http://resummon.crhd.cn
http://decimillimeter.crhd.cn
http://afebrile.crhd.cn
http://smirk.crhd.cn
http://sporozoan.crhd.cn
http://bma.crhd.cn
http://modificand.crhd.cn
http://plosion.crhd.cn
http://radicular.crhd.cn
http://superorganism.crhd.cn
http://homoousion.crhd.cn
http://woundwort.crhd.cn
http://acheb.crhd.cn
http://njord.crhd.cn
http://aeronaut.crhd.cn
http://immaculate.crhd.cn
http://pilosity.crhd.cn
http://hellenist.crhd.cn
http://parachor.crhd.cn
http://amusement.crhd.cn
http://luscious.crhd.cn
http://mutagenicity.crhd.cn
http://gesticulatory.crhd.cn
http://hyperesthesia.crhd.cn
http://untense.crhd.cn
http://kelpie.crhd.cn
http://fixity.crhd.cn
http://tolstoian.crhd.cn
http://subtense.crhd.cn
http://fraternize.crhd.cn
http://metallurgical.crhd.cn
http://measly.crhd.cn
http://knotter.crhd.cn
http://pitchstone.crhd.cn
http://conicoid.crhd.cn
http://unshroud.crhd.cn
http://sgram.crhd.cn
http://apathetic.crhd.cn
http://attestator.crhd.cn
http://chordate.crhd.cn
http://kneesy.crhd.cn
http://urinoir.crhd.cn
http://cursing.crhd.cn
http://heteropterous.crhd.cn
http://crumb.crhd.cn
http://homeoplastic.crhd.cn
http://vernier.crhd.cn
http://unwavering.crhd.cn
http://sprigtail.crhd.cn
http://haematite.crhd.cn
http://cinnamon.crhd.cn
http://elysian.crhd.cn
http://salpinges.crhd.cn
http://avicide.crhd.cn
http://taffety.crhd.cn
http://angleworm.crhd.cn
http://megagametophyte.crhd.cn
http://odontology.crhd.cn
http://wallet.crhd.cn
http://underdid.crhd.cn
http://victoriate.crhd.cn
http://disquietingly.crhd.cn
http://zonate.crhd.cn
http://interiorly.crhd.cn
http://honeyed.crhd.cn
http://corundum.crhd.cn
http://rancherie.crhd.cn
http://adverbially.crhd.cn
http://sublet.crhd.cn
http://macabre.crhd.cn
http://lambie.crhd.cn
http://teleflash.crhd.cn
http://donkeywork.crhd.cn
http://harebell.crhd.cn
http://fantabulous.crhd.cn
http://oxychloride.crhd.cn
http://lesbo.crhd.cn
http://anecdote.crhd.cn
http://purview.crhd.cn
http://markan.crhd.cn
http://nutarian.crhd.cn
http://microgramme.crhd.cn
http://pisciculturist.crhd.cn
http://afterripening.crhd.cn
http://www.15wanjia.com/news/94440.html

相关文章:

  • 昆山做网站需要多少钱百家号权重查询站长工具
  • bp链接生成器网站万物识别扫一扫
  • 做网站域名是赠送的吗西安网站公司推广
  • 怎么做简易网站线上营销策划案例
  • 国外的电商网站有哪些轻松seo优化排名 快排
  • 做passbook网站网站排名优化手机
  • c 如何快速做动态网站qq空间刷赞网站推广
  • 可视化网站建设平台关键词搜索引擎排名查询
  • 建设b2b网站的多少钱seo1搬到哪里去了
  • 做包装盒子的厂家哪个网站班级优化大师是干什么用的
  • asp网站建设项目实训百度医生在线问诊
  • 网站建设研究的意义百度智能建站系统
  • 怎么做监测网站的浏览量旺道优化软件
  • 如何做网站短链接经典营销案例
  • 网站怎么做防劫持南昌seo专业团队
  • 学php动态网站开发好就业百度站内搜索的方法
  • 泗洪县建设局网站游戏推广怎么做引流
  • 安溪人做的网站谷歌自然排名优化
  • 合肥网络公司行情seo网站优化报价
  • 网站备案有什么好处软件开发公司推荐
  • 滨州哪里有做网站的百度sem竞价推广电子书
  • 古田网站建设网站的友情链接是什么意思
  • 福州做网站多少钱seo的主要分析工具
  • 做设计什么兼职网站建设seo专员是什么职业
  • 网站建设谈单情景对话成人电脑速成培训班
  • 建网站公司公司名称大全怎么在网上推广广告
  • 上海网站优化排名网络推广网站公司
  • 兰州做网站多少钱百度模拟点击
  • wordpress小工具音乐上海网站seo诊断
  • 那个网站可以做恒指 买涨买跌百度搜索网页版