Redis
使用场景
- 数据库缓存,减轻服务器压力,提高系统响应。当系统访问量太大,数据库压力增大,使用redis将访问过的内容或者数据存储起来,再次访问的时候先找缓存,缓存命中返回数据,不命中再找数据库,并回填数据。
- session分离。集群或者分布式环境不同web容器管理自己的session,自带的session共享通过网络和IO进行同步,极大地影响性能。
- 实现分布式锁。sexNX
- 实现乐观锁。watch+incr
MyBatis
mybatis相比较传统jdbc
传统数据库配置信息存在硬编码,包括sql语句,设置参数,获取结果集需要手动封装结果集,较为繁琐。
需要频繁创建数据库连接。
阻塞:访问IO的线程是否会阻塞(等待)。
数据的请求方式。
同步会等待资源返回的结果。
异步通过回调的方式获取返回的结果
同步阻塞。传统的socket编程,实现模式为一个连接一个线程,客户端有连接请求时服务器就启动一个线程处理,如果这个连接不做任何事情就会造成不必要的线程开销,可以通过线程池改善(实现多个客户端连接服务器)。
1 |
|
1 | List<String> strList=list.stream.map(T::get).collect(Collectors.toList); |
1 | List<AppModel> list=new ArrayList<>(); |
List<T>
List<Map<String, T>>
Map<String, List<T>>
1 | //先构造Map<String,Person>得到innerType,第一个参数为外层对象HashMap,第二个参数为String,第三个参数为Person |
Filebeat
1 | ./filebeat -e -c filebeat.yml -d "publish" |
https://www.elastic.co/guide/en/beats/filebeat/7.8/filebeat-starting.html
Logstash
1 | ./logstash -f ../config/logstash-sample.conf --config.reload.automatic |
https://www.elastic.co/guide/en/logstash/current/advanced-pipeline.html
格式
1 | 2020-07-21 09:15:38,001 INFO [quartzScheduler_Worker-3] c.g.j.modules.quartz.jobs.SampleJob [SampleJob.java : 20] 定时任务! 时间:2020-07-21 09:15:38 |
curl -XGET 'http://localhost:9200/_cluster/health?pretty=true'
curl 'localhost:9200/_cat/indices?v'
curl -XDELETE http://localhost:9200/index_namee
nohup ./kibana >/dev/null 2>&1 &
nohup ./elasticsearch >/dev/null 2>&1 &
nohup ./logstash -f ../config/logstash-sample.conf --config.reload.automatic >/dev/null 2>&1 &
Update your browser to view this website correctly.&npsb;Update my browser now