惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Privacy & Cybersecurity Law Blog
Engineering at Meta
Engineering at Meta
Forbes - Security
Forbes - Security
MongoDB | Blog
MongoDB | Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
A
About on SuperTechFans
量子位
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
雷峰网
雷峰网
腾讯CDC
P
Proofpoint News Feed
S
Schneier on Security
S
Secure Thoughts
V
Visual Studio Blog
Help Net Security
Help Net Security
The Hacker News
The Hacker News
C
Cyber Attacks, Cyber Crime and Cyber Security
P
Privacy International News Feed
SecWiki News
SecWiki News
S
SegmentFault 最新的问题
T
Threatpost
小众软件
小众软件
MyScale Blog
MyScale Blog
F
Fortinet All Blogs
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
P
Proofpoint News Feed
T
Tailwind CSS Blog
I
Intezer
C
CERT Recently Published Vulnerability Notes
U
Unit 42
V
V2EX
Cyberwarzone
Cyberwarzone
Recorded Future
Recorded Future
O
OpenAI News
Project Zero
Project Zero
有赞技术团队
有赞技术团队
Google DeepMind News
Google DeepMind News
Last Week in AI
Last Week in AI
Hugging Face - Blog
Hugging Face - Blog
Know Your Adversary
Know Your Adversary
C
Cybersecurity and Infrastructure Security Agency CISA
Scott Helme
Scott Helme
V2EX - 技术
V2EX - 技术
博客园 - 叶小钗
S
Securelist
A
Arctic Wolf
The Cloudflare Blog
W
WeLiveSecurity
T
Threat Research - Cisco Blogs
博客园 - Franky

Chenxu's Blog

RAG检索优化:从 68% 到 82.2% 学习深度学习 北邮计算机研究生选课指北 学习机器学习 上海篇 提出一个好问题 写代码的环境 选购一台合适的设备 计算机的第零课 序言 内蒙古篇 山东篇 一篇对transformers的疑惑 浅析GPUStack 浅谈后端项目分层 浙江篇 河南篇 一些三端协同的开发工具记录 浅谈编程语言中的 GC 在 Windows 上安装 Rust 美化博客 消息队列 MyBatis 现代交换原理2024年题目 回忆版 北邮计科本科课程指北 ClkLog埋点用户分析系统研究报告 大数据梧桐实验分享 国产向量数据库研究实践 —— 基于 Milvus 的电影推荐系统 服务器环境配置 大数据HDFS实验分享 SSE多服务之间推送数据 数据库系统原理 操作系统 编译原理 手把手教你gozero从开发到部署 (番外篇): 介绍 gtodolist 前端项目 天津篇 北京篇 手把手教你gozero从开发到部署 (5): gtodolist 之任务的删除 前端相关问题 vue3 + element-plus学习 git相关命令 人工智能原理 使用 MongoTemplate 时开启事务 MySQL Redis 力扣刷题笔记之动态规划 记录一次 VSCode 出现的各种奇怪的问题 手把手教你gozero从开发到部署 (4): 在 model 中自己编写函数实现数据库分页查询 记录平时用到的 windows 右键管理 记录平时使用的 linux 的指令 安装 gstore 并使用 java api 手把手教你gozero从开发到部署 (3): gtodolist 之任务的创建和修改 手把手教你gozero从开发到部署 (番外篇): 记录第一次部署 CI/CD 的流程 记录完成 gtodolist 中遇到的 bug 手把手教你gozero从开发到部署 (2): gtodolist 之 user 模块开发 手把手教你gozero从开发到部署 (1): gtodolist 项目说明和环境准备 快速入门 gozero 框架 vue部署在nginx上的相关问题 记一次安装scrapy的报错 将博客部署至服务器 Java CS143: Compliers 《MySQL必知必会》读书笔记(2) 初识 GORM 初识 gin 框架 Spring 《MySQL必知必会》读书笔记(1) 本地搭建博客 🤝友链 🙋🏻‍♂️关于 Browser and Device Check
大数据HBase实验分享
Chenxu · 2024-05-12 · via Chenxu's Blog

环境配置完成后执行指令启动 ZooKeeper 和 HBase

start-all.sh # 启动 hadoop
zkServer.sh start # 启动 zookeeper
start-hbase.sh # 启动 hbase

hbase shell # 进入hbase shell

基础的操作指令

list # 列出所有表
create 'test','cf1' # 创建表

scan 'test' # 查看表内容
put 'test','test001','cf1:keyword','aaa' # 添加内容
get 'test','test001' # 查看值
put 'test','test001','cf1:keyword','bbb' # 修改内容
deleteall 'test','test001' # 删除标内行键为test001的所有值

disable 'test'
drop 'test' # 删除表, 删除前需要 disable

实验代码运行结果

hbase 中的内容:

hadoop jar exp3.jar com.gcx2021211184.hbase.inputSource.Main
hadoop fs -cat /tmp/gcx-2021211184/part*

最后读取到的结果:

运行后各进程含义

主节点:

HMaster: 与 ZooKeeper 保持通信状态, 通过 zookeeper 知道 HRegionServer 的位置及 HRegionServer 的存活状态, 管理集群.

QuorumPeerMain: ZooKeeper 的一个重要组件, ZooKeeper 服务器的主要入口点, 负责启动和管理 ZooKeeper 服务.

从节点:

HRegionServer: 维护 HMaster 分配给它的 10G 的 HRegion, HBase 最核心的模块.

HBase 架构

客户端不与 HMaster 直接交互, 需要通过 ZooKeeper 进行交互.

读写流程

读操作

  1. 首先从 ZooKeeper 找到 meta 表的 Region 位置, 然后读取 hbase:meta 表中的数据, hbase:meta 表中存储了用户表的 region 信息;
  2. 根据要查询的 namespace、表名和 rowkey 信息,找到写入数据对应的 Region 信息;
  3. 找到这个 Region 对应的 RegionServer, 然后发送请求;
  4. 查找对应的 Region;
  5. 先从 MemStore 查找数据, 如果没有, 再从 BlockCache 上读取;
  6. 如果 BlockCache 中也没有找到, 再到 StoreFile(HFile) 上进行读取.

写操作

  1. 首先从 ZooKeeper 找到 hbase:meta 表的 Region 位置, 然后读取 hbase:meta 表中的数据, hbase:meta 表中存储了用户表的 Region 信息;
  2. 根据 namespace、表名和 rowkey 信息找到写入数据对应的 Region 信息;
  3. 找到这个 Region 对应的 RegionServer, 然后发送请求;
  4. 把数据分别写到 HLog(WriteAheadLog) 和 MemStore 各一份;
  5. MemStore 达到阈值后把数据刷到磁盘, 生成 StoreFile 文件;
  6. 删除 HLog 中的历史数据。

CAP 与 BASE

经典的 CAP 理论:

  • Consistency: Every read receives the most recent write or an error.
  • Availability : Every request receives a (non-error) response – without the guarantee that it contains the most recent write.
  • Partition tolerance : The system continues to operate despite an arbitrary number of messages being dropped (or delayed) by the network between nodes.

对可用性和一致性的权衡: BASE 理论:

  • Basically Available (基本可用): 对完全可用和完全不可用的一种折中, 当系统用户量超出系统设计范围外, 可以通过熔断降级, 流量削峰等操作来保证系统核心功能正常.
  • Eventually consistent (最终一致性): 允许数据有短暂的不一致状态存在, 即: 软状态. 但数据最终一定是一致的.
  • Soft state (软状态): 软状态故名思意就是可以变动的状态, 与满足 ACID 的数据状态不同, 软状态强调的是数据状态处于一种短暂的临时状态.