用过vue-cli的小伙伴会很轻松的搭建出一个包含vue骨架的前端开发组件,而后install所须要的模块,后台常见springcloud框架也是如此,可是少了所须要的好多模块,须要引入pom,还要兼容各类版本问题。前端
- 常见cloud模块 全家桶 注册中心 熔断 降级 网关等等
- 集成常见java集成
- springboot 集成
kafka
- springboot 集成
es
实现全文检索- springboot 初步实现
zookeeper
注册发现- springboot 集成
mongodb
- springboot 集成
redis
- springboot 集成常见
mq
- 基于netty的
websocket
拓展 常见基于json
、protobuf
通信拓展、粘包拆包等功能 推送和im
即时通信功能实现- sso单点登陆
- 常见功能 限流、 利用
aop
分布式锁的实现、redission
分布式锁的应用等- 基于
client
模式的分库+分表核心jar包实现 以及分库产生的跨库事物等- 单机分布式事物框架整合
atomikos
处理多数据源分布式事物- 还有其余业务功能待整合 分表以后数据聚合 报表模块 权限管理 等等
1. match match_phrase term
match 全文模糊匹配 分词 适用于text 例如 i am ding 分词设置 i am ding三个词 当match时候 i happy 也能搜到 happy world也能搜到
match_phrase 短语匹配 i am happy 分词成i am happy 当搜索 am happy 搜到 由于短语匹配
term 精确匹配 i am happy 分词成i am happy 当搜索 am happy 搜不到 由于没有分词设置
2.bool 查询 高级查询
must / mustnot/filter等太简单 本身查询便可
复制代码
package com.lei.smart;
import com.lei.smart.mapper.UserMapper;
import com.lei.smart.mapper.WebchatSchoolMapper;
import com.lei.smart.pojo.User;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.redisson.Redisson;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.awt.peer.LabelPeer;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.*;
@RunWith(SpringRunner.class)
@SpringBootTest
@Slf4j
public class WebchatServiceTests {
@Autowired
UserMapper userMapper;
@Test
public void contextLoads() {
Config config = new Config();
config.useSentinelServers().addSentinelAddress("****,*****,****")
.setMasterName("mymaster");
// CountDownLatch countDownLatch =new CountDownLatch(1);
RedissonClient redissonClient = Redisson.create(config);
ExecutorService executorService = Executors.newFixedThreadPool(100);
CyclicBarrier cyclicBarrier = new CyclicBarrier(100);
for (int i = 0; i < 100; i++) {
executorService.submit(new Runnable() {
@Override
public void run() {
try {
// cyclicBarrier.
log.info(Thread.currentThread().getName() + ">>>>> block");
cyclicBarrier.await();
log.info(Thread.currentThread().getName() + ">>>>> open");
} catch (InterruptedException e) {
e.printStackTrace();
} catch (BrokenBarrierException e) {
e.printStackTrace();
}
// log.info("加锁前");
RLock lock = redissonClient.getLock("test10");
// log.info("加锁后");
try {
// log.info("尝试获取到分布式锁<<<<<");
boolean b = lock.tryLock(500, 2000, TimeUnit.MILLISECONDS);
log.info("获取到分布式锁<<<<<{}", b);
if (b) {
User userSelect = userMapper.selectByPrimaryKey(1l);
if (userSelect == null) {
log.info(Thread.currentThread().getName() + ">>>>> is null");
User user = new User();
user.setId(1l);
user.setName("dingjainlei");
userMapper.insert(user);
} else {
log.info(Thread.currentThread().getName() + ">>>>> is not null");
}
}
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
lock.unlock();
log.info("解锁");
// redissonClient.shutdown();
}
}
});
}
}
}
复制代码
通常是先去数据库查询,若是不存在,则进行插入。若是存在,则不进行操做vue
使用CyclicBarrier 100个线程同时等待await=0的时候同时并发请求查询数据库id=1存不存在
redission 使用tryLock 尝试获取锁 设置超时 自动释放锁时间 防止死锁 ,保证分布式环境下 高并发插入重复问题
复制代码
下载到本地以后,在msyql中建立数据库lei,一次启动便可java
在使用中有任何问题,欢迎反馈给我,能够用如下联系方式跟我交流mysql
邮件(m13687672481@163.com)nginx
QQ: 1251272104web
微信: kenan13687672481redis
下载到本地以后,在msyql中建立数据库lei,一次启动便可算法
var author = {spring
nickName : "工藤新一",
复制代码
}sql