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

上海做网站公司推荐wordpress首页置顶推荐问题

上海做网站公司推荐,wordpress首页置顶推荐问题,杭州做网站哪个公司好,wordpress媒体库很乱Table接口#xff1a;负责表数据的基本操作。 Admin类#xff1a;负责管理建表、删表、该表等元数据操作的接口。 1、Put方法 1.1、了解put方法之前#xff0c;必须知道的相关知识。 在HBase中有一个理念#xff1a;所有的数据皆为bytes。因此在HBase中所有的数据最终都…        Table接口负责表数据的基本操作。 Admin类负责管理建表、删表、该表等元数据操作的接口。 1、Put方法 1.1、了解put方法之前必须知道的相关知识。 在HBase中有一个理念所有的数据皆为bytes。因此在HBase中所有的数据最终都会被序列化为bytes[ ]保存。最简单的将字符串转化为bytes[ ]的方法为Bytes.toBytes()。 1.2、Put方法的构造函数 Putbytes[ ]  row PutByteBuffer  row PutPut  putToCopy Putbytes[ ]  row , long  ts 等等 1.3、addColumn方法常用到调用方式 addColumnbyte[ ]  family , byte[ ]  qualifier , byte[ ]  value addColumnbyte[ ]  family , byte[ ]  qualifier , long  ts , byte[ ]  value addColumnbyte[ ]  family , ByteBuffer  qualifier , long  ts , ByteBuffer  value 注Put提供了一个语法糖每一个addColumn返回的都是Put对象自己因此可以把所有的列添加方法连接起来写。 以下为测试代码 public static void main(String[] args) throws IOException {//1.实例化配置文件对象Configuration configuration HBaseConfiguration.create();//2.设置连接接的数据库的IP地址configuration.set(hbase.zookeeper.quorum,master);//3.创建连接对象Connection connection ConnectionFactory.createConnection(configuration);//4.创建Table接口对象Table table connection.getTable(TableName.valueOf(user));//实例化Put对象Put put new Put(Bytes.toBytes(row1));//5.准备新增的数据put.addColumn(Bytes.toBytes(info),Bytes.toBytes(name),666,Bytes.toBytes(jack)).addColumn(Bytes.toBytes(info),Bytes.toBytes(age),Bytes.toBytes(23)).addColumn(Bytes.toBytes(info),Bytes.toBytes(address),Bytes.toBytes(河南开封));//6.执行新增操作table.put(put);//7.控制台打印运行完毕标识语句System.out.println(新增数据执行完毕~); }1.4、Put对象中其他方法 append方法 用于追加字符increment方法  用于数值增加或增减前提该数据为long格式的 2、Get方法 2.1、Get的构造函数 Get  get new Getbyte[ ]  row 2.2、Get对象相关方法 为了提高查询效率。 addFamilybyte[ ]  family 添加要取出来的列族 addColumnbyte[ ]  family , byte[ ]  qualifier添加要取出来的列族和列 setTimeRangelong minStramp long maxStramp设置要取出的版本范围 setMaxVersions设置要取出的版本数默认为1不传入参数直接调用就是把MaxVersions设置为Integer.MAV_VEALUE。 2.3、Result类 byte value把查询结果的第1列提取出来的快捷写法用于你只查了一个列的情况。 boolean isEmpty查询结果是否为空可以用来判断是否查询到数据。 Int size返回查找到的列数量也可以提供size是否大于0判断是否查询到数据 以下为测试代码案例 public static void main(String[] args) throws IOException {Configuration configuration HBaseConfiguration.create();configuration.set(hbase.zookeeper.quorum,master);Connection connection ConnectionFactory.createConnection(configuration);Table table connection.getTable(TableName.valueOf(user));Get get new Get(Bytes.toBytes (row1));Result result table.get(get);System.out.println(Bytes.toString(result.value()));System.out.println(判断查询结果是否为空result.isEmpty());System.out.println(查找到的列数为result.size());System.exit(-1); }3、exists方法 Table接口提供的exists方法用来快速查询某一个数据是否存在的。 4、delet方法 4.1、Delete对象构造器 Delete delete new Deletebyte[ ]  row 4.2、Delete对象相关方法 addFamily(byte[ ] family) 删除指定列族 addFamily(byte[ ] family , long timestamp) 删除指定列族中所以版本号等于或小于给定的版本号的列 addColumn(byte[ ] family , byte[ ] qualifiler) 删除指定列的最新版本 addColumn(byte[ ] family , byte[ ] qualifiler , long timestamp) 删除指定列的特定版本 addColumns(byte[ ] family , byte[ ] qualifiler) 删除指定列的所有版本 addColumns(byte[ ] family , byte[ ] qualifiler , long timestamp) 删除指定列的等于或小于给定版本号的所有版本。 5、checkAndDelete方法 Table接口提供的保证在一个原子操作内对数据完成修改和删除操作。 6、mutation方法 Table接口提供的保证在任意两个操作放在他同一个原子操作内。 RowMutations类 用于整合相关操作 作为mutateRow方法的参数。 代码演示如下 public static void main(String[] args) throws IOException {Configuration configuration HBaseConfiguration.create();configuration.set(hbase.zookeeper.quorum,192.168.28.130);Connection connection ConnectionFactory.createConnection(configuration);Table table connection.getTable(TableName.valueOf(user));//1.删除 行row3 列: ageDelete delete new Delete(Bytes.toBytes(row3));delete.addColumn(Bytes.toBytes(info),Bytes.toBytes(age));//2.修改 name值为chrisPut put1 new Put(Bytes.toBytes(row3));put1.addColumn(Bytes.toBytes(info),Bytes.toBytes(name),Bytes.toBytes(chris));//3.新增 infojob值为engineerPut put2 new Put(Bytes.toBytes(row3));put2.addColumn(Bytes.toBytes(info),Bytes.toBytes(job),Bytes.toBytes(engineer));//新建RowMutations类 并且把以上操作对象添加进去RowMutations rowMutations new RowMutations(Bytes.toBytes(row3));rowMutations.add(delete);rowMutations.add(put1);rowMutations.add(put2);//执行删除/修改/新增操作table.mutateRow(rowMutations);System.out.println(执行完毕~); }7批量操作   bath方法 public static void main(String[] args) throws IOException, InterruptedException {Configuration configuration HBaseConfiguration.create();configuration.set(hbase.zookeeper.quorum,master);Connection connection ConnectionFactory.createConnection(configuration);Table table connection.getTable(TableName.valueOf(user));//1.查询行row2数据Get get new Get(Bytes.toBytes(row2));//2.新增数据 row4 infoage 23Put put new Put(Bytes.toBytes(row4));put.addColumn(Bytes.toBytes(info),Bytes.toBytes(age),Bytes.toBytes(23));//3.删除行row1数据Delete delete new Delete(Bytes.toBytes(row1));//4.批量执行操作ArrayListRow list new ArrayListRow();list.add(get);list.add(put);list.add(delete);Object[] results new Object[list.size()];table.batch(list,results);byte[] value ((Result) results[0]).getValue(Bytes.toBytes(info), Bytes.toBytes(name));System.out.println(Bytes.toString(value)); }8、Scan扫描 public static void main(String[] args) throws IOException {Configuration configuration HBaseConfiguration.create();configuration.set(hbase.zookeeper.quorum,master);Connection connection ConnectionFactory.createConnection(configuration);Table table connection.getTable(TableName.valueOf(user));Scan scan new Scan(Bytes.toBytes(row2));ResultScanner results table.getScanner(scan);Result result results.next();byte[] value result.getValue(Bytes.toBytes(info), Bytes.toBytes(name));System.out.println(Bytes.toString(value)); }
http://www.sczhlp.com/news/238264/

相关文章:

  • 网站后台管理系统权限旅游网站建设实训报告
  • 做婚礼邀请函网站网站开发资金
  • 做佩戴护身符的厂家网站wordpress上传附件到FTP
  • 北京网站建设公司优势网站怎么才能上线
  • 做网站商城需要什么山东网站备案注销申请表
  • 无锡免费做网站做网站 图片侵权
  • 大型门户网站建设定制品牌建设有效提升城市竞争力例子
  • 接做网站单子wap手机网站描述正确的是
  • 交河做网站价格360搜索引擎的特点
  • 海淀网站建设枣庄苏州专业做优化公司
  • seo网站排名电子商务网站开发设计报告
  • 个人网站用什么软件关键词排名优化易下拉排名
  • app使用什么做的网站吗英文的wordpress如何修改语言
  • 设计素材网站0批处理启动wordpress
  • Everything下载安装教程:中文免费版下载 + 图文安装步骤(2025最新版)
  • 2025年小型风力发电机厂家权威推荐榜单:水平轴风机发电机/风光储一体化系统/垂直轴风机发电机源头厂家精选
  • 做360网站优化快淘宝网页版手机登录
  • 一个做flash的网站网站的根目录怎么找
  • php网站开发if的代码网站做等保备案
  • 那里有学做网站的国内网如何看国外网站
  • 自己做网站挂广告怎么赚钱吗wordpress 制作单页
  • 创建电子商务网站的7个步骤好看个人网页模板
  • 快速建站费用江苏省建设工程信息一体化平台
  • 口碑好的网站建设公司wordpress搬家全站 404
  • 崂山区建设管理局网站怎么了黑河南高端网站建设公司
  • 怎么看网站开发的发展青浦工厂网站建设
  • 移动端网站的重要性高效的设计公司
  • 网站开发商可以代刷好评吗出库入库管理软件app
  • 国外做logo的网站电子商务平台自身提供的数据工具
  • oppo官方网站台州建设信息网站