首页 文章 精选 留言 我的

精选列表

搜索[微服务架构],共10000篇文章
优秀的个人博客,低调大师

开发基于 Hbase的 应用 链接 Hbase 服务器 demo

一个网站的数据的增加是非常迅速的。。 要保存这些数据 在 mysql 数据库里面 是最好的办法。 如果这些数据 超过了一定的规模。比如 上 亿的历史数据。。查询起来可就比较麻烦了。。 而且如果要进行 统计分析。。分析用户的行为啥的。。还需要这些日志。 就连 用户的访问记录保留也是很有用的。。就像豆瓣的喜欢和垃圾桶功能也很重要。 通过这个就可以推算出你喜欢哪首歌曲。 别的就不废话了。相信你对大数据存储也很头疼。 下面介绍使用的技术。 首先你要有一个 hadoop的环境。 要使用 64bit的centos 6 使用cloudera 的hadoop 和hbase 通过 yum 一并安装了。 具体安装配置 已经是很简化的了。。最简单的了。。 http://toeo.iteye.com/blog/1243592 然后你需要知道 我们 链接 hbase 就像链接 jpa 一样的。有这样的框架。 总之吧 hbase 的字段 都映射成 POJO 是很好的事情。 使用datanucleus 进行封装对象: 地址:http://www.datanucleus.org/ 如果要是可以把程序调通。写 hbase 程序就像和 写 JPA的程序一样了。 开始创建工程: 从官网下载一个 demo http://sourceforge.net/projects/datanucleus/files/datanucleus-samples/ DataNucleus 最新版本是 3.0.4 同时DataNucleus 还支持其他 云数据的链接。比如 Google的 bigTable 。 大名鼎鼎的 google Appengine 也是使用 DataNucleus 中间件链接的。 所以不用怀疑可靠性。 首要要解决的就是jar包的依赖问题。 demo 里面居然把hbase 的groupId 写错了 应该是: <dependency> <groupId>org.apache.hbase</groupId> <artifactId>hbase</artifactId> <version>0.90.4</version> </dependency> 修修改改jar 总是是对了。。然后就是漫长的jar包下载。 要使用datanucleus 必须安装 eclipse 插件: 因为需要在编译的时候 自动 enhanced 当然你也可以 手动enhanced 比较麻烦 安装 eclipse 插件: http://www.datanucleus.org/downloads/eclipse-update/ 安装成功重启 启用enhanced 在 build 的时候 就可以看到enhanced 的过程了。。 enhanced 2 个 class。 如果不安装 则代码 运行不了: 报错: Persisting Account+Login Exception in thread "main" org.datanucleus.api.jdo.exceptions.ClassNotPersistenceCapableException: The class "org.datanucleus.samples.jdo.hbase.Account" is not persistable. This means that it either hasnt been enhanced, or that the enhanced version of the file is not in the CLASSPATH (or is hidden by an unenhanced version), or the Meta-Data/annotations for the class are not found. at org.datanucleus.api.jdo.NucleusJDOHelper.getJDOExceptionForNucleusException(NucleusJDOHelper.java:351) at org.datanucleus.api.jdo.JDOPersistenceManager.jdoMakePersistent(JDOPersistenceManager.java:745) at org.datanucleus.api.jdo.JDOPersistenceManager.makePersistent(JDOPersistenceManager.java:765) at org.datanucleus.samples.jdo.hbase.Main.main(Main.java:46) NestedThrowablesStackTrace: The class "org.datanucleus.samples.jdo.hbase.Account" is not persistable. This means that it either hasnt been enhanced, or that the enhanced version of the file is not in the CLASSPATH (or is hidden by an unenhanced version), or the Meta-Data/annotations for the class are not found. org.datanucleus.exceptions.ClassNotPersistableException: The class "org.datanucleus.samples.jdo.hbase.Account" is not persistable. This means that it either hasnt been enhanced, or that the enhanced version of the file is not in the CLASSPATH (or is hidden by an unenhanced version), or the Meta-Data/annotations for the class are not found. at org.datanucleus.ObjectManagerImpl.assertClassPersistable(ObjectManagerImpl.java:5330) at org.datanucleus.ObjectManagerImpl.persistObjectInternal(ObjectManagerImpl.java:1704) at org.datanucleus.ObjectManagerImpl.persistObjectWork(ObjectManagerImpl.java:1647) at org.datanucleus.ObjectManagerImpl.persistObject(ObjectManagerImpl.java:1512) at org.datanucleus.api.jdo.JDOPersistenceManager.jdoMakePersistent(JDOPersistenceManager.java:740) at org.datanucleus.api.jdo.JDOPersistenceManager.makePersistent(JDOPersistenceManager.java:765) at org.datanucleus.samples.jdo.hbase.Main.main(Main.java:46) 确认 hbase 已经启动:zookeeper 已经启动: 否则会报链接错误: 11/12/23 16:36:15 WARN zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect java.net.SocketException: Address family not supported by protocol family: connect at sun.nio.ch.Net.connect(Native Method) at sun.nio.ch.SocketChannelImpl.connect(Unknown Source) at org.apache.zookeeper.ClientCnxn$SendThread.startConnect(ClientCnxn.java:1050) at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1077) 11/12/23 16:36:15 INFO zookeeper.ClientCnxn: Opening socket connection to server localhost/127.0.0.1:2181 11/12/23 16:36:16 WARN zookeeper.ClientCnxn: Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect java.net.ConnectException: Connection refused: no further information at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) 编译的时候添加 : <dependency> <groupId>org.datanucleus</groupId> <artifactId>datanucleus-enhancer</artifactId> <version>3.0.1</version> </dependency> 否则会报找不到 jar: java.lang.NoClassDefFoundError: org/datanucleus/enhancer/DataNucleusEnhancer 查看zookeeper 启动: 附件代码:暂时没有跑通。因为hbase 安装在虚拟机上面 以后陆续补上。也可能是hbase 没有配置对。

优秀的个人博客,低调大师

AI Agent 决策架构演进:从 ReAct 到 MCP、Hermes,把底层机制讲透

如果你在 2022 年之前问一个大模型"帮我查一下上海明天的天气,然后订一张去那里的机票",它会非常自信地编出一段看起来合理但实际全是幻觉的回答。不是因为它笨,而是因为它的整个世界观里只有"生成下一个 token",没有任何机制让它去和外部世界发生交互、验证自己的假设、或者纠正自己的错误。

优秀的个人博客,低调大师

DeepSeek大模型:从"效率颠覆者"到"规模追赶者"的架构演进

2026年9月,一条来自The Information的消息引发AI圈震动:DeepSeek正在训练一个约2万亿参数的新模型,并计划将参数规模推至8万亿。这一消息之所以令人意外,是因为DeepSeek在过去两年留给行业最深的印象恰恰是"不烧钱"——2024年底发布的V3模型,以6710亿总参数、557.6万美元训练成本,向整个行业证明了"前沿模型不需要无限堆GPU"。

资源下载

更多资源
Mario

Mario

马里奥是站在游戏界顶峰的超人气多面角色。马里奥靠吃蘑菇成长,特征是大鼻子、头戴帽子、身穿背带裤,还留着胡子。与他的双胞胎兄弟路易基一起,长年担任任天堂的招牌角色。

Nacos

Nacos

Nacos /nɑ:kəʊs/ 是 Dynamic Naming and Configuration Service 的首字母简称,一个易于构建 AI Agent 应用的动态服务发现、配置管理和AI智能体管理平台。Nacos 致力于帮助您发现、配置和管理微服务及AI智能体应用。Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现、服务配置、服务元数据、流量管理。Nacos 帮助您更敏捷和容易地构建、交付和管理微服务平台。

Spring

Spring

Spring框架(Spring Framework)是由Rod Johnson于2002年提出的开源Java企业级应用框架,旨在通过使用JavaBean替代传统EJB实现方式降低企业级编程开发的复杂性。该框架基于简单性、可测试性和松耦合性设计理念,提供核心容器、应用上下文、数据访问集成等模块,支持整合Hibernate、Struts等第三方框架,其适用范围不仅限于服务器端开发,绝大多数Java应用均可从中受益。

WebStorm

WebStorm

WebStorm 是jetbrains公司旗下一款JavaScript 开发工具。目前已经被广大中国JS开发者誉为“Web前端开发神器”、“最强大的HTML5编辑器”、“最智能的JavaScript IDE”等。与IntelliJ IDEA同源,继承了IntelliJ IDEA强大的JS部分的功能。

用户登录
用户注册