简介
NoSQL表示菲关系型数据库,不需要用SQL语句查询。不需要固定表格模式存储。
NoSQL数据库分以下几类
1、Key/value存储,有Redis,Tokyo Cabinet。
特点:无数据结构,二进制形式存储数据或者字符串,数据加载速度快。
使用场景:高并发,日志信息。
2、列存储系统库,有HBase、Cassandra
特点:查找速度快啊,容易进行分布式扩展。
使用:分布式文件系统
3、文档型数据库,有MongoDB、CouchDB
特点:与Key/value类似,没有预先表结构,数据格式相对灵活。
使用:web应用
4、图形数据库,有Neo4J、DEX
使用:构建关系图谱、例如社交网络,推荐系统
整合redis
linux安装
https://blog.youkuaiyun.com/slss01/article/details/88920845
windows安装
https://www.cnblogs.com/jylee/p/9844965.html
整合springboot
1、创建项目添加依赖
引入redis并且将默认工具lettuce排除,工具配置换成jedis
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
<exclusions>
<exclusion>
<groupId>io.lettuce</groupId>
<artifactId>lettuce-core</artifactId>
</exclusion>
</exclusions>
</dependency>
2、配置redis(application.properties)
spring.redis.database=0
spring.redis.host=192.168.66.130
spring.redis.port=6379
spring.redis.password=123@456
spring.redis.lettuce.pool.max-active=
spring.redis.lettuce.pool.max-idle=
spring.redis.lettuce.pool.max-wait=
spring.redis.lettuce.pool.min-idle=
spring.redis.lettuce.shutdown-timeout=
#连接池最大连接数
spring.redis.jedis.pool.max-active=8
#连接池中的最大空闲连接
spring.redis.jedis.pool.max-idle=8
#连接池最大阻塞等待时间(使用负值表示没有限制)
spring.redis.jedis.pool.max-wait=-1ms
#连接池中的最小空闲连接
spring.redis.jedis.pool.min-idle=0
controller.java
package org.sang;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* Created by sang on 2018/7/18.
*/
@RestController
public class BookController {
@Autowired
RedisTemplate redisTemplate;
@Autowired
StringRedisTemplate stringRedisTemplate;
@GetMapping("/test1")
public void test1