hbase二级索引Observer

使用必须是线性安全:

package coprocessor;

import java.io.IOException;

import org.apache.hadoop.hbase.CoprocessorEnvironment;
import org.apache.hadoop.hbase.client.HTableInterface;
import org.apache.hadoop.hbase.client.HTablePool;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.coprocessor.BaseRegionObserver;
import org.apache.hadoop.hbase.coprocessor.ObserverContext;
import org.apache.hadoop.hbase.coprocessor.RegionCoprocessorEnvironment;
import org.apache.hadoop.hbase.regionserver.wal.WALEdit;
import org.apache.hadoop.hbase.util.Bytes;

public class AISObserver extends BaseRegionObserver {

	private HTablePool pool = null;
	HTableInterface table1 = null;
	private final byte[] tablename = Bytes.toBytes("zchx_ais_index");
	private final byte[] family = Bytes.toBytes("info");
	private final byte[] q = Bytes.toBytes("index");
	
	public void start(CoprocessorEnvironment env) throws IOException {
//		this.ShipAtable_index = new HTable(env.getConfiguration(), "zchx_ais_index");
		 pool = new HTablePool(env.getConfiguration(), 10);
		 table1 = pool.getTable(tablename);
		 table1.setAutoFlush(false);
	}

	@Override
	public void prePut(ObserverContext<RegionCoprocessorEnvironment> e,
			Put put, WALEdit edit, boolean writeToWAL) throws IOException {
		byte[] row = put.getRow();
		String rowkey = Bytes.toString(row);
		if(rowkey.length()==24){
			StringBuilder sb = new StringBuilder();
			sb.append(rowkey.substring(10, 24));
			String type = rowkey.substring(9,10);
			sb.append(rowkey.substring(0, 9));
			Put secPut = new Put(Bytes.toBytes(sb.toString()));
			secPut.add(family,q,row);
			if(type.equals("a")){
				table1.put(secPut);
			}
			
//			this.table.flushCommits();
			sb = null;
		}
		
	}

	@Override
	public void stop(CoprocessorEnvironment env) throws IOException {
		pool.close();
	}
}

 

基于云平台的ATS系统微服务架构方案研究 在当前智慧地铁的升级转型过程中,城市轨道交通ATS系统面临着稳定性差、运维方 式繁琐和故障应急处理效率低等问题。为此,提出一种基于云平台的ATS系统微服务架构方案; 研究了ATS系统在云平台上的微服务总体架构、ATS应用的微服务划分和设计、容器部署方式 及通信交互模式,可实现系统松耦合和易扩展,达到节约计算资源、提高系统稳定性和运营效 率的目的 阅读详情

相关推荐

【MagicDrive环境配置】新手配俩星期版

1.创建一个新的环境conda create -n newdrive python==3.82.激活该环境conda activate newdrive3.下载MagicDrive源码 git clone --recursive https://github.com/cure-lab/MagicDrive.git,如果出现时间超时八成是网的问题,直接自己下载解压就好3.我的cuda版本是11.7,但11.7导致后续安装有冲突,因此进入。

m0_46261292的博客 2203

HBase利用observer(协处理器)创建二级索引

一、协处理器—Coprocessor (概念拷贝) 1、 起源 Hbase 作为列族数据库最经常被人诟病的特性包括:无法轻易建立“二级索引”,难以执行求和、计数、排序等操作。比如,在旧版本的(&lt;0.92)Hbase 中,统计数据表的总行数,需要使用 Counter 方法,执行一次 MapReduce Job 才能得到。虽然 HBase 在数据存储层中集成 了 MapRed......

IT晓白 1704

盘点军工行业软件研发的那些常用GJB标准

GJB5000、2786、438、141、102、8114等...

文章主要涉及嵌入式软件开发、测试、项目管理等,欢迎交流,共同进步。 9470

HBase 协处理器实现二级索引

HBase在0.92之后引入了coprocessors,提供了一系列的钩子,让我们能够轻易实现访问控制和二级索引的特性。下面简单介绍下两种coprocessors,第一种是Observers,它实际类似于触发器,第二种是Endpoint,它类似与存储过程。由于这里只用到了Observers,所以只介绍Observers,想要更详细的介绍请查阅(https://blogs.apache....

weixin_30399871的博客 272

锐捷交换机配置SSH

锐捷交换机配置ssh 一、组网需求 通过ssh功能可以远程登录管理设备 二、配置步骤 全局开启ssh服务,并且指定ssh版本 Ruijie>enable Ruijie#configure terminal Ruijie(config)#enable service ssh-server ------>开启SSH服务,默认关闭 Ruijie(config)#ip ssh version 2 ------>默认1.99版本,设置为版本2 添加登

Loners_fan的博客 1万+

解决Windows 10更新失败错误代码0x80070643

在Windows 10操作系统的更新过程中,用户时常会遇到各类错误代码,这些代码通常成为顺利完成更新的绊脚石。其中,错误代码0x80070643是一个较为常见的更新失败提示,它可能导致系统更新停滞不前。面对这一挑战,本文将详细介绍如何有效解决这一错误,帮助用户顺利完成Windows 10的更新。

nntxthml的博客 1829

Hbase的协处理器(Coprocessor的两种实现observer 和 endpoint,加载卸载方式,二级索引)

1、协处理器—Coprocessor 1、 起源 HBase 作为列族数据库最经常被人诟病的特性包括:无法轻易建立“二级索引”,难以执行求和、计数、排序等操作。比如,在旧版本的(&amp;lt;0.92) HBase 中,统计数据表的总行数,需要使用 Counter 方法,执行一次 MapReduce Job 才能得到。 虽然 HBase 在数据存储层中集成了 MapReduce,能够有效用于数据表的分布...

qichangjian的博客 1688

【YOLOv8改进 - 注意力机制】GAM(Global Attention Mechanism):全局注意力机制,减少信息损失并放大全局维度交互特征

为了提高各种计算机视觉任务的性能,研究了多种注意力机制。然而,现有方法忽视了保留通道和空间两个方面信息的重要性,以增强跨维度的交互。因此,我们提出了一种全局注意力机制,通过减少信息损失和放大全局交互表示来提升深度神经网络的性能。我们引入了带有多层感知器的3D排列用于通道注意力,同时结合了卷积空间注意力子模块。在CIFAR-100和ImageNet-1K上的图像分类任务评估中,表明我们的方法在ResNet和轻量级MobileNet上稳定地优于几种最新的注意力机制。

专注于图像领域,主要研究内容包括计算机视觉和深度学习,特别是在图像分类、目标检测和图像生成等方面有深入的研究和实践经验。 1158

HBase的协处理器(Coprocessor)、HBase如何使用二级索引、observer协处理器、 endpoint协处理器、Hbase 协处理器加载方式

HBase 在 0.92 之后引入了协处理器(coprocessors),实现一些激动人心的新特性:能够轻易建立二次索引、复杂过滤器(谓词下推)以及访问控制等

qq_40585384的博客 4463

手把手教你学simulink(31.31)--双向DCDC电源场景示例:设计并实现一个基于变频控制的双向降压变换

设计并实现一个基于 Simulink 的双向降压变换器,能够在充电模式(从高压侧向低压侧传输能量)和放电模式(从低压侧向高压侧传输能量)之间切换,确保输出电压稳定,并根据负载变化自动调整工作模式。

MHD0815的博客 344

数学建模学习(120):使用Python实现基于AHP的供应商选择分析

使用Python实现基于AHP的供应商选择分析

全栈川川 914

Hbase_Hbase中二级索引的基本介绍以及协处理器

标题二级索引的基本介绍协处理器1.出现2.协处理器有两种: observer 和 endpoint3.协处理器加载方式4.协处理器Observer应用实战 二级索引的基本介绍 出现原因: 由于HBase的查询比较弱,如果需要实现类似于 select name,salary,count(1),max(salary) from user group by name,salary order by salary 等这样的复杂性的统计需求,基本上不可能,或者说比较困难,所以我们在使用HBase的时候,

weixin_44449054的博客 347

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

hbase的协处理器

一、产生背景 Hbase作为列族数据库最经常被人诟病的特性包括:无法轻易建立“二级索引”,难以执行求和、计数、排序等操作。比如,在旧版本的(<0.92)Hbase 中,统计数据表的总行数,需要使用 Counter 方法,执行一次 MapReduce Job 才能得到。虽然 HBase在数据存储层中集成了 MapReduce,能够有效用于数据表的分布式计算。然而在很多情况下,做一些简单的相加...

墨殇 5070

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

HBase 二级索引与Coprocessor协处理器

Coprocessor简介 (1)实现目的 HBase无法轻易建立“二级索引”; 执行求和、计数、排序等操作比较困难,必须通过MapReduce/Spark实现,对于简单的统计或聚合计算时,可能会因为网络与IO开销大而带来性能问题。 (2)灵感来源 灵感来源于Bigtable的协处理器,包含如下特性: 每个表服务器的任意子...

weixin_30505751的博客 127

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

构建HBase二级索引和工具----学习笔记

HBase只针对行键索引,访问HBase表中的行只用三种方式;(原生产品中)行键访问;行键区间访问;全表扫描;其他产品:Hindex二级索引HBase+RedisHBase+solrCoprocessor构建二级索引;Coprocessor提供了两个实现:endpoint和observer,endpoint相当于关系型数据库的存储过程,而observer则相当于触发器observer允许我们在记录...

PeixinYe的博客 864

【HBase高级】4. HBase协处理器(Coprocessor)

本文先对Bulk load 银行转账记录海量冷数据存储案例做个结尾,而后介绍第三部分:HBase协处理器(Coprocessor)。

优快云GuoYuying的博客 822

hbase二级索引

概述 HBase 是一款基于 Hadoop 的 key-value 数据库,它提供了对 HDFS 上数据的高效随机读写服务,完美地填补了 Hadoop MapReduce 仅适于批处理的缺陷,正在被越来越多的用户使用。作为 HBase 的一项重要特性,Coprocessor 在 HBase 0.92 版本中被加入,并广受欢迎 利用协处理器,用户可以编写运行在 HBase Server 端的代

#include<?> 2307

Hbase(三) hbase协处理器与二级索引

一、协处理器—Coprocessor        1、 起源Hbase 作为列族数据库最经常被人诟病的特性包括:无法轻易建立“二级索引”,难以执 行求和、计数、排序等操作。比如,在旧版本的(&lt;0.92)Hbase 中,统计数据表的总行数,需 要使用 Counter 方法,执行一次 MapReduce Job 才能得到。虽然 HBase 在数据存储层中集成了 MapReduce,能够有效...

牛逸凡的博客 591

HBase协处理器及二级索引

前言 在使用 HBase 时,如果你的数据量达到了数十亿行或数百万列,此时能否在查询中返回大量数据将受制于网络的带宽,即便网络状况允许,但是客户端的计算处理也未必能够满足要求。在这种情况下,协处理器(Coprocessors)应运而生。它允许你将业务计算代码放入在 RegionServer 的协处理器中,将处理好的数据再返回给客户端,这可以极大地降低需要传输的数据量,从而获得性能上的提升。同时协处理器也允许用户扩展实现 HBase 目前所不具备的功能,如权限校验、二级索引、完整性约束等。 1 协处理器-

LINBE_blazers的博客 1041

Hbase 协处理器 Coprocessor 及二级索引案例

Hbase 协处理器 Coprocessor 及二级索引案例1、协处理器—Coprocessor1.1、起源1.2、介绍2、协处理加载方式3、二级索引(ObserverCoprocessor 案例) 1、协处理器—Coprocessor 1.1、起源 (1)Hbase 作为列簇数据库最经常被人诟病的特性包括: 无法轻易建立 “二级索引”,难以执行求和、计数、排序等操作。比如,在旧版本的 (<0.92)Hbase 中,统计数据表的总行数,需要使用 Counter 方法,执行一次 MapReduce Jo

weixin_44387652的博客 720

Hbase--协处理器coprocessors

Hbase–协处理器coprocessors 文章目录Hbase--协处理器coprocessors一:协处理器1.什么是协处理器?2.协处理器的类型3.Observer1)类型2) 适用场景3)执行流程4.Endpoint1)介绍2)应用场景以及分析5.总结二:协处理器的实践应用1.Endpoint的应用准备工作:具体步骤:第一步:使用Protobuf生成序列化类2.Observer 的应用创建...

ITgagaga的博客 399

一篇看懂hbase协处理器

目录 1.hbase高级编程 1. 1. 协处理器—Coprocessor 1. 2. Observer 1. 3. Endpoint 1. 4. 协处理加载方式 1. 4. 1. 静态加载 1. 4. 2. 静态卸载 1. 4. 3. 动态加载 1. 4. 4. 协处理器卸载 2. ...

qq_36297093的博客 798
上一篇: Hive 中内部表与外部表的区别与创建方法
下一篇: 使用spring @Scheduled注解执行定时任务
weixir123
博客等级 码龄16年 1粉丝 207原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值