Druid

Druid DBUtils ORM 封裝

笑着哭i 提交于 2019-12-05 16:33:32
package com.msi.druid; import java.io.IOException; import java.io.InputStream; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.List; import java.util.Properties; import javax.sql.DataSource; import org.apache.commons.dbutils.QueryRunner; import org.apache.commons.dbutils.handlers.BeanListHandler; import com.alibaba.druid.pool.DruidDataSource; import com.alibaba.druid.pool.DruidDataSourceFactory; import com.alibaba.druid.pool.DruidPooledConnection; import com.msi.model.User; public class DBHelper { private static DBHelper dbHlper = null;

对hibernate 3.3 rc扩展

此生再无相见时 提交于 2019-12-05 16:28:26
最近维护老项目,需要用到druid监控,但是druid最低兼容hibernate 4,没办法,自己动手丰衣足食。 基于com.alibaba.druid.support.hibernate.DruidConnectionProvider改的,实现ConnectionProvider接口 因为要使用druid数据源,改动如下 /* * Copyright 1999-2018 Alibaba Group Holding Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES

SpringBoot创建定时任务

梦想与她 提交于 2019-12-05 14:19:52
SpringBoot创建定时任务暂分为以下4种类型: 根据自身需要灵活使用,欢迎纠错指正补充 一、基于注解(@Scheduled) 这种方式很简单,直接上代码 package com.example.demo2.scheduled; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.Scheduled; import java.time.LocalDateTime; /** * @program: demo2 * @description: 静态定时任务类,基于@Scheduled注解 * 基于注解@Scheduled默认为单线程,开启多个任务时,任务的执行时机会受上一个任务执行时间的影响。 * @author: guoxu * @create: 2019-12-04 11:17 */ @Configuration //1.主要用于标记配置类,兼备Component的效果。 @EnableScheduling //2.开启定时任务 public class

druid vs Elasticsearch

我的梦境 提交于 2019-12-05 10:54:08
I'm new to druid. I've already read "druid VS Elasticsearch", but I still don't know what druid is good at. Below is my problem: I have a solr cluster with 70 nodes. I have a very big table in solr which has 1 billion rows, and each row has 100 fields. The user will use different combinations range query of fields (20 combinations at least in one query) to count the distinct number of customer id, but the solr's distinct count algorithm is very slow and uses a lot of memory, so if the query result is more than 200 thousand, the solr's query node will crash. Does druid has better performance

spring-boot和mybatis的整合

∥☆過路亽.° 提交于 2019-12-05 07:58:38
在idea里创建一个spring-boot工程 选依赖的时候把web里的web勾上,sql里的mysql和mybatis也勾上 ,这样就会自动帮我们生成依赖 在其中我们需要给mysql的依赖加上版本,不然它会自动去用最新版的(目前mysql最新版已经到了八以上了),我们现在用五点几的就好,有错误也能在网上找到解决方法,采用最新版的如果出现错误,那么解决起来也麻烦 然后在加上druid依赖, 如果是要用到多数据源,就得用 druid-spring-boot-starter 然后在build里设置下配置文件的扫描路径,pom.xml具体依赖如下 <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.1.5.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent> <groupId>com.liy</groupId> <artifactId>mybatisProject</artifactId> <version>0.0.1-SNAPSHOT</version> <name>mybatisProject<

spring boot-mybatis-quartz-druid-swagger2-整合

北城余情 提交于 2019-12-05 07:58:24
说明:主要演示如何整合,简单的任务调用。 环境准备: jdk:1.7 maven:3.2.3 开发工具:IDEA 源码地址: gitosc: https://git.oschina.net/zhengweishan/spring-boot_demo github: https://github.com/wesley5201314/spring-boot-demo 项目结构: 备注: 每个包的作用大家一看就明白了,这里主要说明下application.properties:这里主要配置针对于不同的环境用那个配置文件,这里我只提供了开发,测试的环境属性文件。配置如下: spring.profiles.active = dev 项目启动: //启动入口 @SpringBootApplication @ServletComponentScan //扫描Servlet @MapperScan("com.springboot.demo.dao") //扫描dao public class App { public static void main(String[] args) { SpringApplication.run(App.class, args); } } 启动之后访问: durid : http://localhost:8080/druid/index.html 如图: 配置代码:

springboot集成JdbcTemplate+druid

馋奶兔 提交于 2019-12-05 06:54:53
application.yml datasource: username: root password: root url: jdbc:mysql://localhost:3306/early_warning?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 driver-class-name: com.mysql.cj.jdbc.Driver type: com.alibaba.druid.pool.DruidDataSource druid: initial-size: 8 min-idle: 1 max-active: 20 max-wait: 60000 time-between-eviction-runsMillis: 60000 min-evictable-idle-timeMillis: 300000 validation-query: select 'x' FROM DUAL test-while-idle: true test-on-borrow: false test-on-return: false pool-prepared-statements: true max-open-prepared

applicationContext.xml配置druid连接池

此生再无相见时 提交于 2019-12-05 06:38:55
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd http://www

[转帖]OLAP引擎这么多,为什么苏宁选择用Druid?

限于喜欢 提交于 2019-12-05 05:51:02
OLAP引擎这么多,为什么苏宁选择用Druid? 原创 51CTO 2018-12-21 11:24:12 【51CTO.com原创稿件】随着公司业务增长迅速,数据量越来越大,数据的种类也越来越丰富,分析人员对数据处理的响应延时要求也越来越高,传统的大数据处理工具已经无法满足业务的需求。 https://www.toutiao.com/a6637282053438046734/?tt_from=weixin&utm_campaign=client_share&wxshare_count=1&timestamp=1545368509&app=news_article&utm_source=weixin&iid=52835443443&utm_medium=toutiao_android&group_id=6637282053438046734 请处理一下. 特别是 OLAP 分析场景,需要对各种维度和度量进行上卷、下钻、切片和切块分析,并要求分析结果能够实时返回。 因此我们调研和对比了一些目前主流的 OLAP 分析工具,针对聚合计算的实时分析,我们引入了开源分析工具 Druid。 Druid 介绍 说起 Druid,大家首先想到的是阿里的 Druid 数据库连接池,而本文介绍的 Druid 是一个在大数据场景下的解决方案,是需要在复杂的海量数据下进行交互式实时数据展现的 BI

[转帖]Druid介绍及入门

蹲街弑〆低调 提交于 2019-12-05 05:51:01
Druid介绍及入门 2018-09-19 19:38:36 拿着核武器的程序员 阅读数 22552 更多 分类专栏: Druid 版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。 本文链接: https://blog.csdn.net/qq_27466827/article/details/82777112 1.什么是Druid? Druid是一个高效的数据查询系统,主要解决的是对于大量的基于时序的数据进行聚合查询。数据可以实时摄入,进入到Druid后立即可查,同时数据是几乎是不可变。通常是基于时序的事实事件,事实发生后进入Druid,外部系统就可以对该事实进行查询。 Druid采用的架构: shared-nothing架构与lambda架构 Druid设计三个原则: 1.快速查询(Fast Query) : 部分数据聚合(Partial Aggregate) + 内存化(In-Memory) + 索引(Index) 2.水平拓展能力(Horizontal Scalability):分布式数据(Distributed data)+并行化查询(Parallelizable Query) 3.实时分析(Realtime Analytics):Immutable Past , Append-Only Future 2