springboot连接hbase和redis

spring data redis 官方文档https://docs.spring.io/spring-data/redis/docs/2.2.7.RELEASE/reference/html/#reference
window下启动redis
1.进入redis目录下,cmd,输入redis-server redis.windows.conf
在这里插入图片描述
2.再开一个cmd输入redis-cli进入redis的shell界面
3添加redis依赖

<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>

4两种方法一个是将redis作为其中一个数据库,第二个是将redis注释为spring的缓冲。
![在这里插入图片描述](https://img-blog.csdnimg.cn/20200503210328453.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80MTY3MzA5Mg==,size_16,color_FFFFFF,t_70

hbase笔记
一 安装thrift
1安装依赖
sudo yum install automake libtool flex bison pkgconfig gcc-c++ boost-devel libevent-devel zlib-devel python-devel ruby-devel openssl-devel
2下载thrift
sudo yum install automake libtool flex bison pkgconfig gcc-c++ boost-devel libevent-devel zlib-devel python-devel ruby-devel openssl-devel
3安装

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
好的,下面是连接 HBase 的 Spring Boot 详细步骤示例: 1. 添加 HBase 依赖 在 pom.xml 中添加以下依赖: ``` <dependency> <groupId>org.apache.hbase</groupId> <artifactId>hbase-client</artifactId> <version>${hbase-version}</version> </dependency> <dependency> <groupId>org.apache.hbase</groupId> <artifactId>hbase-server</artifactId> <version>${hbase-version}</version> </dependency> ``` 其中 ${hbase-version} 是 HBase 的版本号。 2. 配置 HBase 连接信息 在 application.properties 中添加以下配置信息: ``` hbase.zookeeper.quorum=zk_host1,zk_host2,zk_host3 hbase.zookeeper.property.clientPort=2181 ``` 其中,hbase.zookeeper.quorum 是 ZooKeeper 的地址列表,hbase.zookeeper.property.clientPort 是 ZooKeeper 的端口号。 3. 创建 HBase 连接 使用 HBaseConfiguration.create() 方法创建 HBase 连接: ``` Configuration config = HBaseConfiguration.create(); ``` 4. 创建 HBase 连接池 使用 HConnectionManager.createConnection(config) 方法创建 HBase 连接池: ``` Connection connection = ConnectionFactory.createConnection(config); ``` 5. 获取 HBase 表 使用 connection.getTable(TableName.valueOf("tableName")) 方法获取 HBase 表: ``` Table table = connection.getTable(TableName.valueOf("tableName")); ``` 其中,tableName 是 HBase 表的名称。 6. 操作 HBase 表 可以使用 Table 接口提供的方法操作 HBase 表,例如: ``` Put put = new Put(Bytes.toBytes("rowKey")); put.addColumn(Bytes.toBytes("columnFamily"), Bytes.toBytes("columnName"), Bytes.toBytes("columnValue")); table.put(put); ``` 其中,rowKey、columnFamily、columnName、columnValue 分别是 HBase 表中的行键、列族、列名和列值。 7. 关闭连接 使用 close() 方法关闭连接: ``` table.close(); connection.close(); ``` 以上就是连接 HBase 的 Spring Boot 详细步骤示例,希望对你有所帮助!

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值