├── bd-kafka
├── src
│ ├── main
│ │ ├── resources
│ │ │ ├── zookeeper.properties
│ │ │ ├── producer.properties
│ │ │ └── consumer.properties
│ │ └── java
│ │ │ └── org
│ │ │ └── bd
│ │ │ └── kafka
│ │ │ ├── ATest03.java
│ │ │ ├── ProducerRunner.java
│ │ │ ├── ConsumerRunner.java
│ │ │ ├── ATest02.java
│ │ │ ├── ATest.java
│ │ │ ├── utils
│ │ │ └── PropertiesUtil.java
│ │ │ └── ProducerClient.java
│ └── test
│ │ └── java
│ │ └── org
│ │ └── bd
│ │ └── kafka
│ │ └── AppTest.java
└── pom.xml
├── bd-mapreduce
├── src
│ ├── main
│ │ └── resources
│ │ │ ├── math.txt
│ │ │ ├── chinese.txt
│ │ │ └── english.txt
│ └── test
│ │ └── java
│ │ └── org
│ │ └── bd
│ │ └── mapreduce
│ │ └── AppTest.java
└── pom.xml
├── bd-zk
├── src
│ ├── main
│ │ ├── resources
│ │ │ └── zookeeper.properties
│ │ └── java
│ │ │ └── org
│ │ │ └── bd
│ │ │ └── zk
│ │ │ ├── callback
│ │ │ ├── Test.java
│ │ │ ├── ZkLinkAsyncCallback.java
│ │ │ └── A.java
│ │ │ ├── ZkPaths.java
│ │ │ ├── ZkException.java
│ │ │ ├── AtestClient.java
│ │ │ ├── watcher
│ │ │ └── ZkLinkWatcher.java
│ │ │ └── utils
│ │ │ └── PropertiesUtil.java
│ └── test
│ │ └── java
│ │ └── org
│ │ └── bd
│ │ └── zk
│ │ └── AppTest.java
└── pom.xml
├── bd-hdfs
├── src
│ ├── main
│ │ ├── resources
│ │ │ └── hdfs.properties
│ │ └── java
│ │ │ └── org
│ │ │ └── bd
│ │ │ └── hdfs
│ │ │ ├── utils
│ │ │ ├── Consts.java
│ │ │ ├── SysVarsUtils.java
│ │ │ └── PropertiesUtil.java
│ │ │ ├── HdfsClientException.java
│ │ │ └── Test.java
│ └── test
│ │ └── java
│ │ └── org
│ │ └── bd
│ │ └── hdfs
│ │ └── AppTest.java
└── pom.xml
├── bd-kylin
├── src
│ ├── main
│ │ ├── resources
│ │ │ └── kylin.properties
│ │ └── java
│ │ │ └── org
│ │ │ └── bd
│ │ │ └── kylin
│ │ │ ├── cube
│ │ │ ├── Notify_list.java
│ │ │ ├── Dimensions.java
│ │ │ ├── Rowkey.java
│ │ │ ├── Hbase_mapping.java
│ │ │ ├── Aggregation_groups.java
│ │ │ └── Measures.java
│ │ │ ├── utils
│ │ │ ├── Consts.java
│ │ │ ├── SysVarsUtils.java
│ │ │ └── PropertiesUtil.java
│ │ │ ├── CubeBuildTypeEnum.java
│ │ │ ├── CubeException.java
│ │ │ ├── rest
│ │ │ ├── ProjectRest.java
│ │ │ ├── response
│ │ │ │ ├── ProjectRestResponse.java
│ │ │ │ └── QueryRestResponse.java
│ │ │ ├── TableRest.java
│ │ │ ├── QueryRest.java
│ │ │ └── ModelRest.java
│ │ │ ├── model
│ │ │ ├── Dimensions.java
│ │ │ ├── Partition_desc.java
│ │ │ ├── Lookups.java
│ │ │ └── ModelJson.java
│ │ │ ├── response
│ │ │ ├── Realizations.java
│ │ │ ├── CubeResponse.java
│ │ │ └── HBaseResponse.java
│ │ │ ├── JobTimeFilterEnum.java
│ │ │ ├── JobStatusEnum.java
│ │ │ └── request
│ │ │ ├── JobBuildRequest.java
│ │ │ ├── SQLRequest.java
│ │ │ ├── ModelRequest.java
│ │ │ ├── JobListRequest.java
│ │ │ └── CubeRequest.java
│ └── test
│ │ └── java
│ │ └── org
│ │ └── bd
│ │ └── kylin
│ │ └── AppTest.java
└── pom.xml
├── bd-spark
└── src
│ ├── main
│ ├── java
│ │ └── org
│ │ │ └── bd
│ │ │ └── spark
│ │ │ ├── mllib
│ │ │ └── T.java
│ │ │ ├── enums
│ │ │ ├── Consts.java
│ │ │ ├── DbmsType.java
│ │ │ └── FormatType.java
│ │ │ ├── utils
│ │ │ ├── SysVarsUtils.java
│ │ │ └── JdbcDriveUtil.java
│ │ │ └── SessionDrive.java
│ └── resources
│ │ ├── jdbc.properties
│ │ └── spark.properties
│ └── test
│ └── java
│ └── org
│ └── bd
│ └── spark
│ ├── kafka
│ ├── ConsumerTest.java
│ ├── ProducerTest.java
│ ├── UserKafkaProducer.java
│ └── UserKafkaConsumer.java
│ ├── stream
│ ├── AppStreamingTest.java
│ ├── TextFileStreamTest.java
│ └── SocketStreamTest.java
│ ├── write
│ ├── WriteTextTest.java
│ ├── WriteCsvTest.java
│ ├── WriteJsonTest.java
│ ├── WriteParquetTest.java
│ ├── WriteMysqlTest.java
│ └── AppWriteTest.java
│ └── read
│ ├── ReadJsonTest.java
│ ├── ReadParquetTest.java
│ ├── ReadCsvTest.java
│ ├── ReadTextTest.java
│ ├── AppReadTest.java
│ ├── ReadMysqlTest.java
│ └── ReadHiveTest.java
├── bd-hive-udf
├── src
│ ├── main
│ │ ├── java
│ │ │ └── org
│ │ │ │ └── bd
│ │ │ │ └── hive
│ │ │ │ ├── udaf
│ │ │ │ ├── HiveAvg.java
│ │ │ │ └── Att.java
│ │ │ │ └── udf
│ │ │ │ ├── UpperCase.java
│ │ │ │ └── LowerCase.java
│ │ └── resources
│ │ │ └── package.xml
│ └── test
│ │ └── java
│ │ └── org
│ │ └── bd
│ │ └── hive
│ │ └── udf
│ │ └── AppTest.java
└── pom.xml
├── bd-flink
└── src
│ ├── main
│ ├── java
│ │ └── org
│ │ │ └── bd
│ │ │ └── flink
│ │ │ ├── idgenerate
│ │ │ ├── IdGeneratorType.java
│ │ │ ├── ESIdGenerator.java
│ │ │ ├── AutoIdGenerator.java
│ │ │ ├── IdGeneratorBuilder.java
│ │ │ └── MD5XdrIdGenerator.java
│ │ │ ├── XDREnrichedMessage.java
│ │ │ ├── XDRRawMessage.java
│ │ │ ├── JsonToXDRRawMessage.java
│ │ │ └── XDREnrichedMessageSinkFunction.java
│ └── resources
│ │ └── log4j.properties
│ └── test
│ └── java
│ └── org
│ └── bd
│ └── flink
│ └── AppTest.java
├── bd-hbase
├── src
│ ├── main
│ │ ├── resources
│ │ │ └── hbase.properties
│ │ └── java
│ │ │ └── org
│ │ │ └── bd
│ │ │ └── hbase
│ │ │ ├── utils
│ │ │ ├── Consts.java
│ │ │ ├── SysVarsUtils.java
│ │ │ ├── HBaseUtils.java
│ │ │ └── PropertiesUtil.java
│ │ │ ├── Test.java
│ │ │ └── HBaseConfig.java
│ └── test
│ │ └── java
│ │ └── org
│ │ └── bd
│ │ └── hbase
│ │ └── AppTest.java
└── pom.xml
├── bd-elasticsearch
├── src
│ └── main
│ │ └── resources
│ │ └── log4j2.properties
└── pom.xml
├── bd-hive
├── src
│ ├── main
│ │ ├── resources
│ │ │ └── hive.properties
│ │ └── java
│ │ │ └── org
│ │ │ └── bd
│ │ │ └── hive
│ │ │ ├── HiveException.java
│ │ │ ├── utils
│ │ │ ├── Consts.java
│ │ │ ├── SysVarsUtils.java
│ │ │ └── PropertiesUtil.java
│ │ │ └── DbCloseUtils.java
│ └── test
│ │ └── java
│ │ └── org
│ │ └── bd
│ │ └── hive
│ │ └── AppTest.java
└── pom.xml
├── bd-datax
├── src
│ ├── main
│ │ └── java
│ │ │ └── org
│ │ │ └── bd
│ │ │ └── datax
│ │ │ ├── bean
│ │ │ ├── Read.java
│ │ │ ├── Write.java
│ │ │ ├── Script.java
│ │ │ ├── Job.java
│ │ │ ├── Content.java
│ │ │ ├── Transformer.java
│ │ │ ├── SettingBean.java
│ │ │ ├── Setting.java
│ │ │ └── TransformerBean.java
│ │ │ ├── DataxSourceType.java
│ │ │ ├── DataxException.java
│ │ │ ├── DataxBean.java
│ │ │ ├── DataxPara.java
│ │ │ ├── mysql
│ │ │ ├── MysqlPara.java
│ │ │ └── MysqlRead.java
│ │ │ ├── sqlserver
│ │ │ ├── SqlServerPara.java
│ │ │ └── SqlServerWrite.java
│ │ │ ├── oracle
│ │ │ └── OraclePara.java
│ │ │ ├── hdfs
│ │ │ └── HdfsPara.java
│ │ │ └── ftp
│ │ │ └── FtpPara.java
│ └── test
│ │ └── java
│ │ └── org
│ │ └── bd
│ │ └── datax
│ │ └── AppTest.java
└── pom.xml
├── bd-impala
└── src
│ ├── main
│ ├── resources
│ │ └── impala.properties
│ └── java
│ │ └── org
│ │ └── bd
│ │ └── impala
│ │ ├── ImpalaException.java
│ │ └── utils
│ │ ├── SysVarsUtils.java
│ │ ├── Consts.java
│ │ ├── ImpaIaTableColumn.java
│ │ └── PropertiesUtil.java
│ └── test
│ └── java
│ └── org
│ └── bd
│ └── impala
│ └── AppTest.java
├── README.md
├── bd-yarn
├── src
│ └── main
│ │ └── java
│ │ └── org
│ │ └── bd
│ │ └── yarn
│ │ ├── exception
│ │ └── YarnException.java
│ │ └── utils
│ │ └── YarnUtil.java
└── pom.xml
├── bd-solr
├── src
│ └── test
│ │ └── java
│ │ └── org
│ │ └── bd
│ │ └── solr
│ │ └── AppTest.java
└── pom.xml
└── pom.xml
/bd-kafka/src/main/resources/zookeeper.properties:
--------------------------------------------------------------------------------
1 | zookeeper.connect=localhost:2181
--------------------------------------------------------------------------------
/bd-mapreduce/src/main/resources/math.txt:
--------------------------------------------------------------------------------
1 | Zhao 38
2 | Qian 45
3 | Sun 23
4 | Li 43
--------------------------------------------------------------------------------
/bd-mapreduce/src/main/resources/chinese.txt:
--------------------------------------------------------------------------------
1 | Zhao 98
2 | Qian 9
3 | Sun 67
4 | Li 23
--------------------------------------------------------------------------------
/bd-mapreduce/src/main/resources/english.txt:
--------------------------------------------------------------------------------
1 | Zhao 93
2 | Qian 42
3 | Sun 87
4 | Li 54
--------------------------------------------------------------------------------
/bd-zk/src/main/resources/zookeeper.properties:
--------------------------------------------------------------------------------
1 | zookeeper.connect=localhost:2181
2 | sessionTimeout=10000
--------------------------------------------------------------------------------
/bd-hdfs/src/main/resources/hdfs.properties:
--------------------------------------------------------------------------------
1 | fs.defaultFS = hdfs://lab-southeastasia-jupyter-vm-hdp-01:8020/
2 |
--------------------------------------------------------------------------------
/bd-kylin/src/main/resources/kylin.properties:
--------------------------------------------------------------------------------
1 | kylin.path = http://10.10.10.23:7070/kylin/api
2 | kylin.project = demo
--------------------------------------------------------------------------------
/bd-spark/src/main/java/org/bd/spark/mllib/T.java:
--------------------------------------------------------------------------------
1 | package org.bd.spark.mllib;
2 |
3 | public class T {
4 |
5 | }
6 |
--------------------------------------------------------------------------------
/bd-hive-udf/src/main/java/org/bd/hive/udaf/HiveAvg.java:
--------------------------------------------------------------------------------
1 | package org.bd.hive.udaf;
2 |
3 |
4 | public class HiveAvg {
5 |
6 | }
7 |
--------------------------------------------------------------------------------
/bd-flink/src/main/java/org/bd/flink/idgenerate/IdGeneratorType.java:
--------------------------------------------------------------------------------
1 | package org.bd.flink.idgenerate;
2 |
3 | public enum IdGeneratorType {
4 | AUTO ,
5 | MD5,
6 | PREFIX;
7 | }
8 |
--------------------------------------------------------------------------------
/bd-hbase/src/main/resources/hbase.properties:
--------------------------------------------------------------------------------
1 | hbase.zookeeper.quorum = 10.10.10.22,10.10.10.23,10.10.10.24
2 | hbase.zookeeper.property.clientPort = 2181
3 | hbase.master = 10.10.10.22:600000
--------------------------------------------------------------------------------
/bd-elasticsearch/src/main/resources/log4j2.properties:
--------------------------------------------------------------------------------
1 | appender.console.type = Console
2 | appender.console.name = console
3 | appender.console.layout.type = PatternLayout
4 |
5 | rootLogger.level = info
6 | rootLogger.appenderRef.console.ref = console
--------------------------------------------------------------------------------
/bd-flink/src/main/java/org/bd/flink/idgenerate/ESIdGenerator.java:
--------------------------------------------------------------------------------
1 | package org.bd.flink.idgenerate;
2 |
3 | import java.io.Serializable;
4 |
5 | public interface ESIdGenerator extends Serializable {
6 | String generate(final String msg, final int idLength);
7 | }
8 |
--------------------------------------------------------------------------------
/bd-flink/src/main/java/org/bd/flink/idgenerate/AutoIdGenerator.java:
--------------------------------------------------------------------------------
1 | package org.bd.flink.idgenerate;
2 |
3 | public class AutoIdGenerator implements ESIdGenerator {
4 | @Override
5 | public String generate(String msg, int idLength) {
6 | return null;
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/bd-hive/src/main/resources/hive.properties:
--------------------------------------------------------------------------------
1 | hive.driver=org.apache.hive.jdbc.HiveDriver
2 | hive.url=jdbc:hive2://10.10.10.23:10000
3 | hive.user=
4 | hive.password=
5 | initialsize=5
6 | maxactive=50
7 | minEvictableIdleTimeMillis=30000
8 | removeAbandonedTimeout=1080
9 | timeBetweenEvictionRunsMillis=30000
--------------------------------------------------------------------------------
/bd-datax/src/main/java/org/bd/datax/bean/Read.java:
--------------------------------------------------------------------------------
1 | package org.bd.datax.bean;
2 |
3 | /**
4 | * 版权信息: big data module
5 | * 功能描述: datax读取抽象类
6 | * 版本历史:
7 | * @author wpk | 2017年9月20日 下午9:47:38 |创建
8 | */
9 | public abstract class Read {
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/bd-datax/src/main/java/org/bd/datax/bean/Write.java:
--------------------------------------------------------------------------------
1 | package org.bd.datax.bean;
2 |
3 | /**
4 | * 版权信息: big data module
5 | * 功能描述: datax写入抽象类
6 | * 版本历史:
7 | * @author wpk | 2017年9月20日 下午9:47:46 |创建
8 | */
9 | public abstract class Write {
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/bd-kylin/src/main/java/org/bd/kylin/cube/Notify_list.java:
--------------------------------------------------------------------------------
1 | package org.bd.kylin.cube;
2 |
3 | /**
4 | * 版权信息: big data module
5 | * 功能描述: 通知渠道配置
6 | * 版本历史:
7 | * @author wpk | 2017年9月14日 下午12:2:26 |创建
8 | */
9 | public class Notify_list {
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/bd-spark/src/test/java/org/bd/spark/kafka/ConsumerTest.java:
--------------------------------------------------------------------------------
1 | package org.bd.spark.kafka;
2 |
3 | public class ConsumerTest {
4 |
5 | public static void main(String[] args) {
6 | UserKafkaConsumer consumerThread = new UserKafkaConsumer("topic1");
7 | consumerThread.start();
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/bd-spark/src/test/java/org/bd/spark/kafka/ProducerTest.java:
--------------------------------------------------------------------------------
1 | package org.bd.spark.kafka;
2 |
3 | public class ProducerTest {
4 |
5 | public static void main(String[] args) {
6 | UserKafkaProducer producerThread = new UserKafkaProducer("topic1");
7 | producerThread.start();
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/bd-impala/src/main/resources/impala.properties:
--------------------------------------------------------------------------------
1 | impala.driver=org.apache.hive.jdbc.HiveDriver
2 | impala.url=jdbc:hive2://192.168.1.73:21050/default;auth=noSasl
3 | impala_user=
4 | impala.password=
5 | initialsize=5
6 | maxactive=50
7 | minEvictableIdleTimeMillis=30000
8 | removeAbandonedTimeout=1080
9 | timeBetweenEvictionRunsMillis=30000
--------------------------------------------------------------------------------
/bd-spark/src/main/resources/jdbc.properties:
--------------------------------------------------------------------------------
1 | mysql.jdbc.driver=com.mysql.jdbc.Driver
2 | mysql.jdbc.url=jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf8
3 | mysql.jdbc.user=root
4 | mysql.jdbc.password=root
5 |
6 | spark.jdbc.driver=org.apache.hive.jdbc.HiveDriver
7 | spark.jdbc.url=jdbc:hive2://192.168.1.71:10000
8 | spark.jdbc.user=
9 | spark.jdbc.password=
10 |
--------------------------------------------------------------------------------
/bd-kylin/src/main/java/org/bd/kylin/utils/Consts.java:
--------------------------------------------------------------------------------
1 | package org.bd.kylin.utils;
2 |
3 |
4 | /**
5 | * 版权信息: big data module
6 | * 功能描述: 常量类
7 | * 版本历史:
8 | * @author wpk | 2017年8月23日 上午11:18:51 |创建
9 | */
10 | public class Consts {
11 |
12 | //属性配置文件名称
13 | public static final String KYLIN_PROPERTIES = "kylin.properties";
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/bd-flink/src/test/java/org/bd/flink/AppTest.java:
--------------------------------------------------------------------------------
1 | package org.bd.flink;
2 |
3 | import static org.junit.Assert.assertTrue;
4 |
5 | import org.junit.Test;
6 |
7 | /**
8 | * Unit test for simple App.
9 | */
10 | public class AppTest
11 | {
12 | /**
13 | * Rigorous Test :-)
14 | */
15 | @Test
16 | public void shouldAnswerWithTrue()
17 | {
18 | assertTrue( true );
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # bd-utils
2 | 大数据工具封装
3 |
4 | 该项目主要涉及到的组件有
5 |
6 | datax(数据采集工具接口封装)
7 |
8 | hbase(非关系型数据库的接口封装)
9 |
10 | hdfs(hdfs文件系统接口封装)
11 |
12 | hive(hive查询接口封装)
13 |
14 | hive-udf(hive自定义函数例子,及打包上传运行)
15 |
16 | impala(impala查询接口封装)
17 |
18 | kafka(消息中间件的接口封装)
19 |
20 | kylin(数据预处理的接口封装)
21 |
22 | mapreduce(mapreduce例子,及打包上传运行)
23 |
24 | solr(全文搜索客户端接口封装)
25 |
26 | spark(包括sparkSQL,sparkStreaming接口封装)
27 |
28 | zookeeper(客户端接口封装)
29 |
--------------------------------------------------------------------------------
/bd-datax/src/main/java/org/bd/datax/bean/Script.java:
--------------------------------------------------------------------------------
1 | package org.bd.datax.bean;
2 |
3 | /**
4 | * 版权信息: big data module
5 | * 功能描述: datax脚本
6 | * 版本历史:
7 | * @author wpk | 2017年10月16日 下午4:18:21 |创建
8 | */
9 | public class Script {
10 |
11 | private Job job;
12 |
13 | public Job getJob() {
14 | return job;
15 | }
16 |
17 | public void setJob(Job job) {
18 | this.job = job;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/bd-flink/src/main/java/org/bd/flink/XDREnrichedMessage.java:
--------------------------------------------------------------------------------
1 | package org.bd.flink;
2 |
3 | import lombok.*;
4 |
5 | import java.io.Serializable;
6 |
7 | @Data
8 | @Builder
9 | @NoArgsConstructor
10 | @AllArgsConstructor
11 | public class XDREnrichedMessage implements Serializable {
12 | private String apn;
13 | private String cell_id;
14 | private String country;
15 | private String enterprise_name;
16 | private String timestamp_event;
17 | }
18 |
--------------------------------------------------------------------------------
/bd-kylin/src/main/java/org/bd/kylin/CubeBuildTypeEnum.java:
--------------------------------------------------------------------------------
1 | package org.bd.kylin;
2 |
3 | /**
4 | * 版权信息: big data module
5 | * 功能描述:
6 | * 版本历史:
7 | * @author wpk | 2017年11月21日 上午11:43:42 |创建
8 | */
9 | public enum CubeBuildTypeEnum {
10 | /**
11 | * 重建节段或者增量节段
12 | */
13 | BUILD,
14 | /**
15 | * 合并节段
16 | */
17 | MERGE,
18 |
19 | /**
20 | * 刷新节段
21 | */
22 | REFRESH
23 | }
24 |
--------------------------------------------------------------------------------
/bd-flink/src/main/java/org/bd/flink/XDRRawMessage.java:
--------------------------------------------------------------------------------
1 | package org.bd.flink;
2 |
3 | import lombok.*;
4 |
5 | @NoArgsConstructor
6 | @AllArgsConstructor
7 | @Getter
8 | @Setter
9 | @Builder
10 | public class XDRRawMessage {
11 | private String apn; //1
12 | private String cell_id; //2
13 | private String country; //3
14 | private String enterprise_name; //4
15 | private String timestamp_event; //30
16 | }
17 |
--------------------------------------------------------------------------------
/bd-flink/src/main/java/org/bd/flink/idgenerate/IdGeneratorBuilder.java:
--------------------------------------------------------------------------------
1 | package org.bd.flink.idgenerate;
2 |
3 | public class IdGeneratorBuilder {
4 | static public ESIdGenerator build(IdGeneratorType generatorType) {
5 | switch (generatorType) {
6 | case AUTO:
7 | return new AutoIdGenerator();
8 | case MD5:
9 | return MD5XdrIdGenerator.builder().build();
10 | }
11 | return null;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/bd-hdfs/src/main/java/org/bd/hdfs/utils/Consts.java:
--------------------------------------------------------------------------------
1 | package org.bd.hdfs.utils;
2 |
3 |
4 | /**
5 | * 版权信息: big data module
6 | * 功能描述: 常量类
7 | * 版本历史:
8 | * @author wpk | 2017年11月15日 上午10:24:21 |创建
9 | */
10 | public class Consts {
11 |
12 | //impala驱动类
13 | public static final String FS_DEFAULTFS = "fs.defaultFS";
14 |
15 | //属性配置文件名称
16 | public static final String HDFS_PROPERTIES = "hdfs.properties";
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/bd-kafka/src/main/java/org/bd/kafka/ATest03.java:
--------------------------------------------------------------------------------
1 | package org.bd.kafka;
2 |
3 | import java.util.UUID;
4 | import java.util.concurrent.ExecutionException;
5 |
6 | import org.apache.kafka.clients.consumer.ConsumerRecords;
7 |
8 | import net.sf.json.JSONArray;
9 | import net.sf.json.JSONObject;
10 |
11 | public class ATest03 {
12 |
13 | public static void main(String[] arg){
14 | final ConsumerClient cc = new ConsumerClient("rta_xdr");
15 | ConsumerRecords cr = cc.getRecords();
16 |
17 | System.out.println(cr);
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/bd-datax/src/main/java/org/bd/datax/DataxSourceType.java:
--------------------------------------------------------------------------------
1 | package org.bd.datax;
2 |
3 | /**
4 | * 版权信息: big data module
5 | * 功能描述: 读写类型
6 | * 版本历史:
7 | * @author wpk | 2017年8月7日 下午3:22:45 |创建
8 | */
9 | public class DataxSourceType {
10 |
11 | public final static String ORACLE = "1";
12 | public final static String SQLSERVER = "2";
13 | public final static String MYSQL = "3";
14 | public final static String HDFS = "4";
15 | public final static String FTP = "5";
16 | public final static String HBASE = "6";
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/bd-zk/src/main/java/org/bd/zk/callback/Test.java:
--------------------------------------------------------------------------------
1 | package org.bd.zk.callback;
2 |
3 | import java.io.Serializable;
4 |
5 | public class Test implements Serializable{
6 |
7 | /**
8 | *
9 | */
10 | private static final long serialVersionUID = 1L;
11 | private int id;
12 | private String name;
13 | public int getId() {
14 | return id;
15 | }
16 | public void setId(int id) {
17 | this.id = id;
18 | }
19 | public String getName() {
20 | return name;
21 | }
22 | public void setName(String name) {
23 | this.name = name;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/bd-spark/src/test/java/org/bd/spark/stream/AppStreamingTest.java:
--------------------------------------------------------------------------------
1 | package org.bd.spark.stream;
2 |
3 |
4 | public class AppStreamingTest {
5 |
6 | public static void main(String[] args) {
7 | try {
8 | System.setProperty("hadoop.home.dir", "F:\\hadoop-common-2.2.0-bin-master");
9 |
10 | SocketStreamTest.socketStreaming();//socket流式处理
11 |
12 | TextFileStreamTest.TextFileStreaming();//监控指定目录下流式处理
13 |
14 | // KafkaStreamTest.kafkaStreaming();//kafka流式处理
15 | } catch (Exception e) {
16 | e.printStackTrace();
17 | }
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/bd-kylin/src/main/java/org/bd/kylin/CubeException.java:
--------------------------------------------------------------------------------
1 | package org.bd.kylin;
2 |
3 | public class CubeException extends RuntimeException {
4 |
5 | private static final long serialVersionUID = 1L;
6 |
7 | public CubeException() {
8 | super();
9 | }
10 |
11 | public CubeException(String message) {
12 | super(message);
13 | }
14 |
15 | public CubeException(String message, Throwable cause) {
16 | super(message, cause);
17 | }
18 |
19 | public CubeException(Throwable cause) {
20 | super(cause);
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/bd-yarn/src/main/java/org/bd/yarn/exception/YarnException.java:
--------------------------------------------------------------------------------
1 | package org.bd.yarn.exception;
2 |
3 | public class YarnException extends RuntimeException {
4 |
5 | private static final long serialVersionUID = -1520131049273172806L;
6 |
7 | public YarnException() {
8 | super();
9 | }
10 |
11 | public YarnException(String message) {
12 | super(message);
13 | }
14 |
15 | public YarnException(String message, Throwable cause) {
16 | super(message, cause);
17 | }
18 |
19 | public YarnException(Throwable cause) {
20 | super(cause);
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/bd-hdfs/src/main/java/org/bd/hdfs/HdfsClientException.java:
--------------------------------------------------------------------------------
1 | package org.bd.hdfs;
2 |
3 | public class HdfsClientException extends RuntimeException {
4 |
5 | private static final long serialVersionUID = 1L;
6 |
7 | public HdfsClientException() {
8 | super();
9 | }
10 |
11 | public HdfsClientException(String message) {
12 | super(message);
13 | }
14 |
15 | public HdfsClientException(String message, Throwable cause) {
16 | super(message, cause);
17 | }
18 |
19 | public HdfsClientException(Throwable cause) {
20 | super(cause);
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/bd-zk/src/main/java/org/bd/zk/callback/ZkLinkAsyncCallback.java:
--------------------------------------------------------------------------------
1 | package org.bd.zk.callback;
2 |
3 | import org.apache.zookeeper.AsyncCallback;
4 |
5 | /**
6 | * 版权信息: big data module
7 | * 功能描述: zookeeper连接异步回调
8 | * 版本历史:
9 | * @author wpk | 2017年12月4日 下午5:52:50 |创建
10 | */
11 | public class ZkLinkAsyncCallback implements AsyncCallback.StringCallback{
12 |
13 | @Override
14 | public void processResult(int rc, String path, Object ctx, String name) {
15 | System.out.println("Create path result: [" + rc + ", " + path + ", " + ctx + ", real path name: " + name);
16 | }
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/bd-hbase/src/main/java/org/bd/hbase/utils/Consts.java:
--------------------------------------------------------------------------------
1 | package org.bd.hbase.utils;
2 |
3 | /**
4 | * 版权信息: big data module
5 | * 功能描述: 常量类
6 | * 版本历史:
7 | * @author wpk | 2017年10月31日 下午2:27:48 |创建
8 | */
9 | public class Consts {
10 |
11 | public static final String HBASE_ZOOKEEPER_QUORUM = "hbase.zookeeper.quorum";
12 | public static final String HBASE_ZOOKEEPER_PROPERTY_CLIENTPORT = "hbase.zookeeper.property.clientPort";
13 | public static final String HBASE_MASTER = "hbase.master";
14 |
15 | //属性配置文件名称
16 | public static final String HBASE_PROPERTIES = "hbase.properties";
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/bd-hive-udf/src/main/java/org/bd/hive/udf/UpperCase.java:
--------------------------------------------------------------------------------
1 | package org.bd.hive.udf;
2 |
3 | import org.apache.hadoop.hive.ql.exec.UDF;
4 |
5 | /**
6 | * 版权信息: big data module
7 | * 功能描述: 字符串转大写类
8 | * 版本历史:
9 | * @author wpk | 2017年9月4日 下午9:02:22 |创建
10 | */
11 | public class UpperCase extends UDF {
12 |
13 | /**
14 | * 描述: 接受单行输入,并产生单行输出
15 | * @author wpk | 2017年9月4日 下午9:06:27 |创建
16 | * @param s
17 | * @return String
18 | */
19 | public String evaluate(String s) {
20 | if (s == null) {
21 | return null;
22 | }
23 | return s.toUpperCase();
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/bd-kylin/src/main/java/org/bd/kylin/rest/ProjectRest.java:
--------------------------------------------------------------------------------
1 | package org.bd.kylin.rest;
2 |
3 | import org.bd.kylin.RestRequstHandle;
4 |
5 | /**
6 | * 版权信息: big data module
7 | * 功能描述: kylin项目接口
8 | * 版本历史:
9 | * @author wpk | 2017年11月21日 下午2:37:07 |创建
10 | */
11 | public class ProjectRest extends RestRequstHandle{
12 |
13 | /**
14 | * 描述: 获取项目信息
15 | * @author wpk | 2017年11月21日 下午2:38:51 |创建
16 | * @return String
17 | */
18 | public static String getProjects(){
19 | String para = "projects";
20 | String result = request(para, RequestMethod.GET);
21 | return result;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/bd-hive-udf/src/main/java/org/bd/hive/udf/LowerCase.java:
--------------------------------------------------------------------------------
1 | package org.bd.hive.udf;
2 |
3 | import org.apache.hadoop.hive.ql.exec.UDF;
4 |
5 | /**
6 | * 版权信息: big data module
7 | * 功能描述: 字符串转小写类
8 | * 版本历史:
9 | * @author wpk | 2017年9月4日 下午9:04:19 |创建
10 | */
11 | public class LowerCase extends UDF {
12 |
13 | /**
14 | * 描述: 接受单行输入,并产生单行输出
15 | * @author wpk | 2017年9月4日 下午9:06:10 |创建
16 | * @param s
17 | * @return String
18 | */
19 | public String evaluate(String s) {
20 | if (s == null) {
21 | return null;
22 | }
23 | return s.toLowerCase();
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/bd-flink/src/main/java/org/bd/flink/JsonToXDRRawMessage.java:
--------------------------------------------------------------------------------
1 | package org.bd.flink;
2 |
3 | import lombok.Builder;
4 | import org.apache.flink.api.common.functions.MapFunction;
5 | import org.apache.flink.shaded.jackson2.com.fasterxml.jackson.databind.ObjectMapper;
6 |
7 | @Builder
8 | public class JsonToXDRRawMessage implements MapFunction {
9 | private transient ObjectMapper mapper;
10 |
11 | @Override
12 | public XDRRawMessage map(String s) throws Exception {
13 | if (mapper == null) {
14 | mapper = new ObjectMapper();
15 | }
16 |
17 | return mapper.readValue(s, XDRRawMessage.class);
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/bd-spark/src/main/resources/spark.properties:
--------------------------------------------------------------------------------
1 | spark.driver=org.apache.hive.jdbc.HiveDriver
2 | spark.url=jdbc:hive2://192.168.1.71:10000
3 | spark.user=
4 | spark.password=
5 |
6 |
7 | #\u8FDE\u63A5\u6C60\u521D\u59CB\u5316\u5927\u5C0F
8 | initialsize=5
9 | #\u8FDE\u63A5\u6C60\u6700\u5927\u8FDE\u63A5\u6570
10 | maxactive=50
11 | #30s\u6700\u5C0F\u751F\u5B58\u65F6\u95F430 * 1000
12 | minEvictableIdleTimeMillis=30000
13 | #\u8FDE\u63A5\u5E9F\u5F03\u8D85\u8FC71\u5C0F\u65F6\u672A\u5173\u95ED\uFF0C\u5C31\u4F1A\u88AB\u5F3A\u884C\u56DE\u6536
14 | removeAbandonedTimeout=1080
15 | #30\u79D2\u68C0\u6D4B\u4E00\u6B21\u9700\u8981\u5F3A\u884C\u56DE\u6536\u7684\u8FDE\u63A5
16 | timeBetweenEvictionRunsMillis=30000
--------------------------------------------------------------------------------
/bd-zk/src/main/java/org/bd/zk/ZkPaths.java:
--------------------------------------------------------------------------------
1 | package org.bd.zk;
2 |
3 | import java.util.List;
4 |
5 | /**
6 | * 版权信息: big data module
7 | * 功能描述: zookeeper树状路径(组合模式)
8 | * 版本历史:
9 | * @author wpk | 2017年12月4日 下午3:40:19 |创建
10 | */
11 | public class ZkPaths {
12 |
13 | private String name;
14 | private List children;
15 |
16 | public String getName() {
17 | return name;
18 | }
19 | public void setName(String name) {
20 | this.name = name;
21 | }
22 | public List getChildren() {
23 | return children;
24 | }
25 | public void setChildren(List children) {
26 | this.children = children;
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/bd-kylin/src/main/java/org/bd/kylin/model/Dimensions.java:
--------------------------------------------------------------------------------
1 | package org.bd.kylin.model;
2 |
3 | import java.util.List;
4 |
5 | /**
6 | * 版权信息: big data module
7 | * 功能描述: 维度
8 | * 版本历史:
9 | * @author wpk | 2017年9月14日 下午3:33:38 |创建
10 | */
11 | public class Dimensions {
12 |
13 | private String table;
14 | private List columns;
15 |
16 | public String getTable() {
17 | return table;
18 | }
19 | public void setTable(String table) {
20 | this.table = table;
21 | }
22 | public List getColumns() {
23 | return columns;
24 | }
25 | public void setColumns(List columns) {
26 | this.columns = columns;
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/bd-datax/src/main/java/org/bd/datax/bean/Job.java:
--------------------------------------------------------------------------------
1 | package org.bd.datax.bean;
2 |
3 | import java.util.List;
4 |
5 | /**
6 | * 版权信息: big data module
7 | * 功能描述: datax作业配置
8 | * 版本历史:
9 | * @author wpk | 2017年9月20日 下午9:07:52 |创建
10 | */
11 | public class Job {
12 |
13 | private Setting setting;
14 | private List content;
15 |
16 | public Setting getSetting() {
17 | return setting;
18 | }
19 | public void setSetting(Setting setting) {
20 | this.setting = setting;
21 | }
22 | public List getContent() {
23 | return content;
24 | }
25 | public void setContent(List content) {
26 | this.content = content;
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/bd-spark/src/main/java/org/bd/spark/enums/Consts.java:
--------------------------------------------------------------------------------
1 | package org.bd.spark.enums;
2 |
3 | /**
4 | * 版权信息: big data module
5 | * 功能描述: 常量类
6 | * 版本历史:
7 | * @author wpk | 2017年7月20日上午11:41:38 |创建
8 | */
9 | public class Consts {
10 |
11 | /** spark驱动类*/
12 | public static final String spark_driver = "spark.driver";
13 | /** spark连接地址*/
14 | public static final String spark_url = "spark.url";
15 | /** spark连接用户*/
16 | public static final String spark_user = "spark.user";
17 | /** spark连接密码*/
18 | public static final String spark_password = "spark.password";
19 |
20 | /** 属性配置文件名称*/
21 | public static final String spark_properties = "spark.properties";
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/bd-kylin/src/main/java/org/bd/kylin/response/Realizations.java:
--------------------------------------------------------------------------------
1 | package org.bd.kylin.response;
2 |
3 | /**
4 | * 版权信息: big data module
5 | * 功能描述:
6 | * 版本历史:
7 | * @author wpk | 2017年11月21日 下午3:35:24 |创建
8 | */
9 | public class Realizations {
10 |
11 | private String type;
12 | private String realization;
13 |
14 | public String getType() {
15 | return type;
16 | }
17 | public void setType(String type) {
18 | this.type = type;
19 | }
20 | public String getRealization() {
21 | return realization;
22 | }
23 | public void setRealization(String realization) {
24 | this.realization = realization;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/bd-zk/src/main/java/org/bd/zk/ZkException.java:
--------------------------------------------------------------------------------
1 | package org.bd.zk;
2 |
3 | /**
4 | * 版权信息: big data module
5 | * 功能描述: zookeeper运行异常捕获类
6 | * 版本历史:
7 | * @author wpk | 2017年12月4日 下午9:15:25 |创建
8 | */
9 | public class ZkException extends RuntimeException {
10 |
11 | private static final long serialVersionUID = 1L;
12 |
13 | public ZkException() {
14 | super();
15 | }
16 |
17 | public ZkException(String message) {
18 | super(message);
19 | }
20 |
21 | public ZkException(String message, Throwable cause) {
22 | super(message, cause);
23 | }
24 |
25 | public ZkException(Throwable cause) {
26 | super(cause);
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/bd-hive/src/main/java/org/bd/hive/HiveException.java:
--------------------------------------------------------------------------------
1 | package org.bd.hive;
2 |
3 | /**
4 | * 版权信息: big data module
5 | * 功能描述: hive运行异常捕获类
6 | * 版本历史:
7 | * @author wpk | 2017年10月31日 下午2:48:35 |创建
8 | */
9 | public class HiveException extends RuntimeException {
10 |
11 | private static final long serialVersionUID = 1L;
12 |
13 | public HiveException() {
14 | super();
15 | }
16 |
17 | public HiveException(String message) {
18 | super(message);
19 | }
20 |
21 | public HiveException(String message, Throwable cause) {
22 | super(message, cause);
23 | }
24 |
25 | public HiveException(Throwable cause) {
26 | super(cause);
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/bd-spark/src/test/java/org/bd/spark/write/WriteTextTest.java:
--------------------------------------------------------------------------------
1 | package org.bd.spark.write;
2 |
3 | import org.apache.spark.sql.Dataset;
4 | import org.apache.spark.sql.Row;
5 | import org.bd.spark.WriteComm;
6 |
7 | /**
8 | * 版权信息: big data module
9 | * 功能描述: 写入text文件
10 | * 版本历史:
11 | * @author wpk | 2018年1月16日 上午11:40:55 |创建
12 | */
13 | public class WriteTextTest {
14 |
15 | public static void writeTxt(Dataset ds) throws Exception{
16 | Dataset txt = WriteComm.getInstance().writeToTxt(ds,"C:/Users/Administrator/Desktop/sparkFile/role.txt");
17 | txt.show();
18 | }
19 |
20 | public static void main(String[] args) {
21 | // TODO Auto-generated method stub
22 |
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/bd-datax/src/main/java/org/bd/datax/DataxException.java:
--------------------------------------------------------------------------------
1 | package org.bd.datax;
2 |
3 | /**
4 | * 版权信息: big data module
5 | * 功能描述: datax异常类
6 | * 版本历史:
7 | * @author wpk | 2017年10月13日 下午4:44:46 |创建
8 | */
9 | public class DataxException extends RuntimeException {
10 |
11 | private static final long serialVersionUID = -1520131049273172806L;
12 |
13 | public DataxException() {
14 | super();
15 | }
16 |
17 | public DataxException(String message) {
18 | super(message);
19 | }
20 |
21 | public DataxException(String message, Throwable cause) {
22 | super(message, cause);
23 | }
24 |
25 | public DataxException(Throwable cause) {
26 | super(cause);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/bd-impala/src/main/java/org/bd/impala/ImpalaException.java:
--------------------------------------------------------------------------------
1 | package org.bd.impala;
2 |
3 | /**
4 | * 版权信息: big data module
5 | * 功能描述: hive运行异常捕获类
6 | * 版本历史:
7 | * @author wpk | 2017年10月31日 下午2:48:35 |创建
8 | */
9 | public class ImpalaException extends RuntimeException {
10 |
11 | private static final long serialVersionUID = 1L;
12 |
13 | public ImpalaException() {
14 | super();
15 | }
16 |
17 | public ImpalaException(String message) {
18 | super(message);
19 | }
20 |
21 | public ImpalaException(String message, Throwable cause) {
22 | super(message, cause);
23 | }
24 |
25 | public ImpalaException(Throwable cause) {
26 | super(cause);
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/bd-kafka/src/main/resources/producer.properties:
--------------------------------------------------------------------------------
1 | #
2 | #zookeeper.connect=localhost:2181
3 | # 序列号类,默认kafka.serializer.DefaultEncoder
4 | #serializer.class=kafka.serializer.StringEncoder
5 | # 启动时producer查询brokers的列表,可以是集群中所有brokers的一个子集。
6 | # 注意,这个参数只是用来获取topic的元信息用,producer会从元信息中挑选合适的broker并与之建立socket连接。
7 | # 格式是:host1:port1,host2:port2。
8 | #metadata.broker.list=localhost:9092
9 |
10 | ################################新版本####################################################
11 | bootstrap.servers=localhost:9092
12 |
13 | acks=all
14 |
15 | retries=0
16 |
17 | batch.size=16384
18 |
19 | linger.ms=1
20 |
21 | buffer.memory=33554432
22 |
23 | value.serializer=org.apache.kafka.common.serialization.StringSerializer
24 |
25 | key.serializer=org.apache.kafka.common.serialization.StringSerializer
--------------------------------------------------------------------------------
/bd-hive/src/test/java/org/bd/hive/AppTest.java:
--------------------------------------------------------------------------------
1 | package org.bd.hive;
2 |
3 | import java.sql.ResultSet;
4 | import java.sql.ResultSetMetaData;
5 | import java.util.ArrayList;
6 | import java.util.List;
7 |
8 |
9 | /**
10 | * Unit test for simple App.
11 | */
12 | public class AppTest {
13 |
14 | public static void main( String[] arg ) throws Exception {
15 | IHiveClient ihc = new HiveClient();
16 | ResultSet rs = ihc.executeQuery("show partitions wpk_test.test11");
17 | ResultSetMetaData metaData = rs.getMetaData();
18 | int count = metaData.getColumnCount();
19 | List list = new ArrayList();
20 | for(int i=0;i版权信息: big data module
10 | * 功能描述: datax参数对象
11 | * 版本历史:
12 | * @author wpk | 2017年10月13日 下午10:22:17 |创建
13 | */
14 | @SuppressWarnings("rawtypes")
15 | public interface DataxBean {
16 |
17 | /**
18 | * 描述: 获取读取对象
19 | * @author wpk | 2017年10月13日 下午10:24:24 |创建
20 | * @param map
21 | * @return Read
22 | */
23 | public Read readBean(Map map);
24 |
25 | /**
26 | * 描述: 获取写入对象
27 | * @author wpk | 2017年10月13日 下午10:25:20 |创建
28 | * @param map
29 | * @return Write
30 | */
31 | public Write writeBean(Map map);
32 | }
33 |
--------------------------------------------------------------------------------
/bd-kafka/src/main/resources/consumer.properties:
--------------------------------------------------------------------------------
1 | #组,每个组只支持一个消费者,如果存在多个消费者,则只有一个消费到信息,其它消费者将不能消费到信息
2 | group.id=group5
3 | #参数earliest表示获取所有信息,但要确保每个组都是最新的组;默认是latest,表示获取最新信息
4 | auto.offset.reset=earliest
5 | #通过指定一个或多个代理的列表来使用配置bootstrap.server来实现对集群的连接
6 | bootstrap.servers=localhost:9092
7 | #默认为true,true表示偏移量是由配置自动;false表示偏移量由开发者自己去控制
8 | enable.auto.commit=false
9 | #每n秒提交一次
10 | auto.commit.interval.ms=1000
11 | #通过使用心跳机制,代理将自动检测测试组中的失败流程。消费者会定期自动ping集群,让集群知道它还活着。请注意,使用者是单线程的,因此只有在调用了poll(long)时才可以发送周期性心跳。只要消费者能够做到这一点,它就被认为是活的,并保留从分配给它的分区中消费的权利。如果它停止了呼叫(长时间)的心跳,超过了session . timeout。然后,它将被认为是死的,它的分区将被分配给另一个进程。
12 | session.timeout.ms=30000
13 |
14 | key.deserializer=org.apache.kafka.common.serialization.StringDeserializer
15 |
16 | value.deserializer=org.apache.kafka.common.serialization.StringDeserializer
17 |
--------------------------------------------------------------------------------
/bd-spark/src/test/java/org/bd/spark/write/WriteCsvTest.java:
--------------------------------------------------------------------------------
1 | package org.bd.spark.write;
2 |
3 | import org.apache.spark.sql.Dataset;
4 | import org.apache.spark.sql.Row;
5 | import org.bd.spark.WriteComm;
6 | import org.bd.spark.enums.FormatType;
7 |
8 | /**
9 | * 版权信息: big data module
10 | * 功能描述: 写入csv文件
11 | * 版本历史:
12 | * @author wpk | 2018年1月16日 上午11:39:20 |创建
13 | */
14 | public class WriteCsvTest {
15 |
16 | public static void writeCsv(Dataset ds) throws Exception{
17 | Dataset parquet = WriteComm.getInstance().writeToFile(ds, FormatType.CSV, "C:/Users/Administrator/Desktop/sparkFile/role.csv");
18 | parquet.show();
19 | }
20 |
21 | public static void main(String[] args) {
22 | // TODO Auto-generated method stub
23 |
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/bd-spark/src/test/java/org/bd/spark/write/WriteJsonTest.java:
--------------------------------------------------------------------------------
1 | package org.bd.spark.write;
2 |
3 | import org.apache.spark.sql.Dataset;
4 | import org.apache.spark.sql.Row;
5 | import org.bd.spark.WriteComm;
6 | import org.bd.spark.enums.FormatType;
7 |
8 | /**
9 | * 版权信息: big data module
10 | * 功能描述: 写入json文件
11 | * 版本历史:
12 | * @author wpk | 2018年1月16日 上午11:38:03 |创建
13 | */
14 | public class WriteJsonTest {
15 |
16 | public static void writeJson(Dataset ds) throws Exception{
17 | Dataset parquet = WriteComm.getInstance().writeToFile(ds, FormatType.JSON, "C:/Users/Administrator/Desktop/sparkFile/role.json");
18 | parquet.show();
19 | }
20 |
21 | public static void main(String[] args) {
22 | // TODO Auto-generated method stub
23 |
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/bd-zk/src/test/java/org/bd/zk/AppTest.java:
--------------------------------------------------------------------------------
1 | package org.bd.zk;
2 |
3 | import junit.framework.Test;
4 | import junit.framework.TestCase;
5 | import junit.framework.TestSuite;
6 |
7 | /**
8 | * Unit test for simple App.
9 | */
10 | public class AppTest
11 | extends TestCase
12 | {
13 | /**
14 | * Create the test case
15 | *
16 | * @param testName name of the test case
17 | */
18 | public AppTest( String testName )
19 | {
20 | super( testName );
21 | }
22 |
23 | /**
24 | * @return the suite of tests being tested
25 | */
26 | public static Test suite()
27 | {
28 | return new TestSuite( AppTest.class );
29 | }
30 |
31 | /**
32 | * Rigourous Test :-)
33 | */
34 | public void testApp()
35 | {
36 | assertTrue( true );
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/bd-hdfs/src/test/java/org/bd/hdfs/AppTest.java:
--------------------------------------------------------------------------------
1 | package org.bd.hdfs;
2 |
3 | import junit.framework.Test;
4 | import junit.framework.TestCase;
5 | import junit.framework.TestSuite;
6 |
7 | /**
8 | * Unit test for simple App.
9 | */
10 | public class AppTest
11 | extends TestCase
12 | {
13 | /**
14 | * Create the test case
15 | *
16 | * @param testName name of the test case
17 | */
18 | public AppTest( String testName )
19 | {
20 | super( testName );
21 | }
22 |
23 | /**
24 | * @return the suite of tests being tested
25 | */
26 | public static Test suite()
27 | {
28 | return new TestSuite( AppTest.class );
29 | }
30 |
31 | /**
32 | * Rigourous Test :-)
33 | */
34 | public void testApp()
35 | {
36 | assertTrue( true );
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/bd-solr/src/test/java/org/bd/solr/AppTest.java:
--------------------------------------------------------------------------------
1 | package org.bd.solr;
2 |
3 | import junit.framework.Test;
4 | import junit.framework.TestCase;
5 | import junit.framework.TestSuite;
6 |
7 | /**
8 | * Unit test for simple App.
9 | */
10 | public class AppTest
11 | extends TestCase
12 | {
13 | /**
14 | * Create the test case
15 | *
16 | * @param testName name of the test case
17 | */
18 | public AppTest( String testName )
19 | {
20 | super( testName );
21 | }
22 |
23 | /**
24 | * @return the suite of tests being tested
25 | */
26 | public static Test suite()
27 | {
28 | return new TestSuite( AppTest.class );
29 | }
30 |
31 | /**
32 | * Rigourous Test :-)
33 | */
34 | public void testApp()
35 | {
36 | assertTrue( true );
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/bd-spark/src/test/java/org/bd/spark/write/WriteParquetTest.java:
--------------------------------------------------------------------------------
1 | package org.bd.spark.write;
2 |
3 | import org.apache.spark.sql.Dataset;
4 | import org.apache.spark.sql.Row;
5 | import org.bd.spark.WriteComm;
6 | import org.bd.spark.enums.FormatType;
7 |
8 | /**
9 | * 版权信息: big data module
10 | * 功能描述: 写入parquet文件
11 | * 版本历史:
12 | * @author wpk | 2018年1月16日 上午11:42:34 |创建
13 | */
14 | public class WriteParquetTest {
15 |
16 | public static void writeParquet(Dataset ds) throws Exception{
17 | Dataset parquet = WriteComm.getInstance().writeToFile(ds, FormatType.PARQUET, "C:/Users/Administrator/Desktop/sparkFile/role.parquet");
18 | parquet.show();
19 | }
20 |
21 |
22 | public static void main(String[] args) {
23 | // TODO Auto-generated method stub
24 |
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/bd-datax/src/test/java/org/bd/datax/AppTest.java:
--------------------------------------------------------------------------------
1 | package org.bd.datax;
2 |
3 | import junit.framework.Test;
4 | import junit.framework.TestCase;
5 | import junit.framework.TestSuite;
6 |
7 | /**
8 | * Unit test for simple App.
9 | */
10 | public class AppTest
11 | extends TestCase
12 | {
13 | /**
14 | * Create the test case
15 | *
16 | * @param testName name of the test case
17 | */
18 | public AppTest( String testName )
19 | {
20 | super( testName );
21 | }
22 |
23 | /**
24 | * @return the suite of tests being tested
25 | */
26 | public static Test suite()
27 | {
28 | return new TestSuite( AppTest.class );
29 | }
30 |
31 | /**
32 | * Rigourous Test :-)
33 | */
34 | public void testApp()
35 | {
36 | assertTrue( true );
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/bd-hbase/src/test/java/org/bd/hbase/AppTest.java:
--------------------------------------------------------------------------------
1 | package org.bd.hbase;
2 |
3 | import junit.framework.Test;
4 | import junit.framework.TestCase;
5 | import junit.framework.TestSuite;
6 |
7 | /**
8 | * Unit test for simple App.
9 | */
10 | public class AppTest
11 | extends TestCase
12 | {
13 | /**
14 | * Create the test case
15 | *
16 | * @param testName name of the test case
17 | */
18 | public AppTest( String testName )
19 | {
20 | super( testName );
21 | }
22 |
23 | /**
24 | * @return the suite of tests being tested
25 | */
26 | public static Test suite()
27 | {
28 | return new TestSuite( AppTest.class );
29 | }
30 |
31 | /**
32 | * Rigourous Test :-)
33 | */
34 | public void testApp()
35 | {
36 | assertTrue( true );
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/bd-impala/src/test/java/org/bd/impala/AppTest.java:
--------------------------------------------------------------------------------
1 | package org.bd.impala;
2 |
3 | import junit.framework.Test;
4 | import junit.framework.TestCase;
5 | import junit.framework.TestSuite;
6 |
7 | /**
8 | * Unit test for simple App.
9 | */
10 | public class AppTest
11 | extends TestCase
12 | {
13 | /**
14 | * Create the test case
15 | *
16 | * @param testName name of the test case
17 | */
18 | public AppTest( String testName )
19 | {
20 | super( testName );
21 | }
22 |
23 | /**
24 | * @return the suite of tests being tested
25 | */
26 | public static Test suite()
27 | {
28 | return new TestSuite( AppTest.class );
29 | }
30 |
31 | /**
32 | * Rigourous Test :-)
33 | */
34 | public void testApp()
35 | {
36 | assertTrue( true );
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/bd-kafka/src/test/java/org/bd/kafka/AppTest.java:
--------------------------------------------------------------------------------
1 | package org.bd.kafka;
2 |
3 | import junit.framework.Test;
4 | import junit.framework.TestCase;
5 | import junit.framework.TestSuite;
6 |
7 | /**
8 | * Unit test for simple App.
9 | */
10 | public class AppTest
11 | extends TestCase
12 | {
13 | /**
14 | * Create the test case
15 | *
16 | * @param testName name of the test case
17 | */
18 | public AppTest( String testName )
19 | {
20 | super( testName );
21 | }
22 |
23 | /**
24 | * @return the suite of tests being tested
25 | */
26 | public static Test suite()
27 | {
28 | return new TestSuite( AppTest.class );
29 | }
30 |
31 | /**
32 | * Rigourous Test :-)
33 | */
34 | public void testApp()
35 | {
36 | assertTrue( true );
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/bd-kylin/src/test/java/org/bd/kylin/AppTest.java:
--------------------------------------------------------------------------------
1 | package org.bd.kylin;
2 |
3 | import junit.framework.Test;
4 | import junit.framework.TestCase;
5 | import junit.framework.TestSuite;
6 |
7 | /**
8 | * Unit test for simple App.
9 | */
10 | public class AppTest
11 | extends TestCase
12 | {
13 | /**
14 | * Create the test case
15 | *
16 | * @param testName name of the test case
17 | */
18 | public AppTest( String testName )
19 | {
20 | super( testName );
21 | }
22 |
23 | /**
24 | * @return the suite of tests being tested
25 | */
26 | public static Test suite()
27 | {
28 | return new TestSuite( AppTest.class );
29 | }
30 |
31 | /**
32 | * Rigourous Test :-)
33 | */
34 | public void testApp()
35 | {
36 | assertTrue( true );
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/bd-hive-udf/src/test/java/org/bd/hive/udf/AppTest.java:
--------------------------------------------------------------------------------
1 | package org.bd.hive.udf;
2 |
3 | import junit.framework.Test;
4 | import junit.framework.TestCase;
5 | import junit.framework.TestSuite;
6 |
7 | /**
8 | * Unit test for simple App.
9 | */
10 | public class AppTest
11 | extends TestCase
12 | {
13 | /**
14 | * Create the test case
15 | *
16 | * @param testName name of the test case
17 | */
18 | public AppTest( String testName )
19 | {
20 | super( testName );
21 | }
22 |
23 | /**
24 | * @return the suite of tests being tested
25 | */
26 | public static Test suite()
27 | {
28 | return new TestSuite( AppTest.class );
29 | }
30 |
31 | /**
32 | * Rigourous Test :-)
33 | */
34 | public void testApp()
35 | {
36 | assertTrue( true );
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/bd-spark/src/test/java/org/bd/spark/read/ReadJsonTest.java:
--------------------------------------------------------------------------------
1 | package org.bd.spark.read;
2 |
3 | import org.apache.spark.sql.Dataset;
4 | import org.apache.spark.sql.Row;
5 | import org.apache.spark.sql.SparkSession;
6 | import org.bd.spark.ReadComm;
7 | import org.bd.spark.enums.FormatType;
8 |
9 | /**
10 | * 版权信息: big data module
11 | * 功能描述: 从json读取数据
12 | * 版本历史:
13 | * @author wpk | 2018年1月16日 上午11:20:56 |创建
14 | */
15 | public class ReadJsonTest {
16 |
17 | public static void readJson(SparkSession spark) throws Exception{
18 | Dataset json = ReadComm.getInstance().
19 | readSource(spark, FormatType.JSON, "D:/wpk/devToll/workspace/nkzjProject1/idata-spark/test-file/employees.json");
20 | json.show();
21 | }
22 |
23 | public static void main(String[] arg){
24 |
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/bd-mapreduce/src/test/java/org/bd/mapreduce/AppTest.java:
--------------------------------------------------------------------------------
1 | package org.bd.mapreduce;
2 |
3 | import junit.framework.Test;
4 | import junit.framework.TestCase;
5 | import junit.framework.TestSuite;
6 |
7 | /**
8 | * Unit test for simple App.
9 | */
10 | public class AppTest
11 | extends TestCase
12 | {
13 | /**
14 | * Create the test case
15 | *
16 | * @param testName name of the test case
17 | */
18 | public AppTest( String testName )
19 | {
20 | super( testName );
21 | }
22 |
23 | /**
24 | * @return the suite of tests being tested
25 | */
26 | public static Test suite()
27 | {
28 | return new TestSuite( AppTest.class );
29 | }
30 |
31 | /**
32 | * Rigourous Test :-)
33 | */
34 | public void testApp()
35 | {
36 | assertTrue( true );
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/bd-kylin/src/main/java/org/bd/kylin/JobTimeFilterEnum.java:
--------------------------------------------------------------------------------
1 | package org.bd.kylin;
2 |
3 | /**
4 | * 版权信息: big data module
5 | * 功能描述: 作业的时间过滤对象
6 | * 版本历史:
7 | * @author wpk | 2017年11月21日 上午10:25:39 |创建
8 | */
9 | public enum JobTimeFilterEnum {
10 |
11 | LAST_ONE_DAY(0), LAST_ONE_WEEK(1), LAST_ONE_MONTH(2), LAST_ONE_YEAR(3), ALL(4);
12 |
13 | private final int code;
14 |
15 | private JobTimeFilterEnum(int code) {
16 | this.code = code;
17 | }
18 |
19 | public static JobTimeFilterEnum getByCode(int code) {
20 | for (JobTimeFilterEnum timeFilter : values()) {
21 | if (timeFilter.getCode() == code) {
22 | return timeFilter;
23 | }
24 | }
25 |
26 | return null;
27 | }
28 |
29 | public int getCode() {
30 | return code;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/bd-spark/src/main/java/org/bd/spark/enums/DbmsType.java:
--------------------------------------------------------------------------------
1 | package org.bd.spark.enums;
2 |
3 | /**
4 | * 版权信息: big data module
5 | * 功能描述: 数据库类型
6 | * 版本历史:
7 | * @author wpk | 2017年7月25日下午3:06:44 |创建
8 | */
9 | public enum DbmsType {
10 |
11 | /** mysq数据库*/
12 | MYSQL{public String value(){return "mysql";}},
13 | /** oracle数据库*/
14 | ORACLE{public String value(){return "oracle";}},
15 | /** spark的jdbc连接服务*/
16 | SPARK{public String value(){return "spark";}};
17 |
18 | public abstract String value();
19 |
20 | /**
21 | * 描述:获取枚举类的对象
22 | * @author wpk | 2017年7月25日下午6:23:23 |创建
23 | * @param value
24 | * @return
25 | */
26 | public static DbmsType getByValue(String value){
27 | for(DbmsType ot : values()){
28 | if((ot.value()).equals(value))
29 | return ot;
30 | }
31 | return null;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/bd-spark/src/main/java/org/bd/spark/enums/FormatType.java:
--------------------------------------------------------------------------------
1 | package org.bd.spark.enums;
2 |
3 | /**
4 | * 版权信息: big data module
5 | * 功能描述: 读\写资源格式
6 | * 版本历史:
7 | * @author wpk | 2017年7月25日上午11:19:10 |创建
8 | */
9 | public enum FormatType {
10 |
11 | /** txt文件类型*/
12 | TEXT("1", "text"),
13 | /** json文件类型*/
14 | JSON("2", "json"),
15 | /** csv文件类型*/
16 | CSV("3", "csv"),
17 | /** parquet文件类型*/
18 | PARQUET("4", "parquet"),
19 | /** 数据库类型*/
20 | JDBC("5", "jdbc");
21 |
22 | private final String state;
23 | private final String value;
24 |
25 | private FormatType(String state, String value){
26 | this.state = state;
27 | this.value = value;
28 | }
29 |
30 | public String getState() {
31 | return this.state;
32 | }
33 |
34 | public String getValue() {
35 | return this.value;
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/bd-spark/src/test/java/org/bd/spark/read/ReadParquetTest.java:
--------------------------------------------------------------------------------
1 | package org.bd.spark.read;
2 |
3 | import org.apache.spark.sql.Dataset;
4 | import org.apache.spark.sql.Row;
5 | import org.apache.spark.sql.SparkSession;
6 | import org.bd.spark.ReadComm;
7 | import org.bd.spark.enums.FormatType;
8 |
9 | /**
10 | * 版权信息: big data module
11 | * 功能描述: 从parquet读取数据
12 | * 版本历史:
13 | * @author wpk | 2018年1月16日 上午11:26:11 |创建
14 | */
15 | public class ReadParquetTest {
16 |
17 | public static void readParquet(SparkSession spark) throws Exception{
18 | Dataset parquet = ReadComm.getInstance().
19 | readSource(spark, FormatType.PARQUET, "D:/wpk/devToll/workspace/nkzjProject1/idata-spark/test-file/users.parquet");
20 | parquet.show();
21 | }
22 |
23 | public static void main(String[] args) {
24 | // TODO Auto-generated method stub
25 |
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/bd-datax/src/main/java/org/bd/datax/bean/Content.java:
--------------------------------------------------------------------------------
1 | package org.bd.datax.bean;
2 |
3 | import java.util.List;
4 |
5 | /**
6 | * 版权信息: big data module
7 | * 功能描述: datax内容设置类
8 | * 版本历史:
9 | * @author wpk | 2017年9月20日 下午9:18:32 |创建
10 | */
11 | public class Content {
12 |
13 | private Read reader;
14 | private List transformer;
15 | private Write writer;
16 |
17 | public Read getReader() {
18 | return reader;
19 | }
20 | public void setReader(Read reader) {
21 | this.reader = reader;
22 | }
23 | public List getTransformer() {
24 | return transformer;
25 | }
26 | public void setTransformer(List transformer) {
27 | this.transformer = transformer;
28 | }
29 | public Write getWriter() {
30 | return writer;
31 | }
32 | public void setWriter(Write writer) {
33 | this.writer = writer;
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/bd-zk/src/main/java/org/bd/zk/AtestClient.java:
--------------------------------------------------------------------------------
1 | package org.bd.zk;
2 |
3 | import java.io.IOException;
4 |
5 | import org.apache.zookeeper.KeeperException;
6 | import org.apache.zookeeper.ZooKeeper;
7 | import org.apache.zookeeper.data.Stat;
8 |
9 | public class AtestClient {
10 |
11 | public static void main(String[] arg) throws IOException, KeeperException, InterruptedException{
12 | ZkClient zkClient = new ZkClient();
13 | ZooKeeper zk = zkClient.getZk();
14 | System.out.println("获取节点数据:"+zk.getData("/wpk", false, new Stat()));
15 | System.out.println("获取节点设置后的状态信息:"+zk.setData("/wpk", "nihao123".getBytes(), -1));
16 |
17 | zkClient.registerPersistentWatcher("/wpk");
18 |
19 | /*ZooKeeper zk = new ZooKeeper("localhost:2181", 30000, new Watcher(){
20 | @Override
21 | public void process(WatchedEvent event){
22 | System.out.println("Receive watched event :" + event);
23 | }
24 | });*/
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/bd-zk/src/main/java/org/bd/zk/callback/A.java:
--------------------------------------------------------------------------------
1 | package org.bd.zk.callback;
2 |
3 | import org.I0Itec.zkclient.IZkDataListener;
4 | import org.I0Itec.zkclient.ZkClient;
5 |
6 |
7 | public class A {
8 |
9 | public static void main(String[] args) {
10 | // TODO Auto-generated method stub
11 | ZkClient zk = new ZkClient("localhost:2181", 30000);
12 | zk.subscribeDataChanges("/wpk", new IZkDataListener(){
13 | @Override
14 | public void handleDataChange(String dataPath, Object data) throws Exception {
15 | System.out.println("数据变更");
16 | }
17 | @Override
18 | public void handleDataDeleted(String dataPath) throws Exception {
19 | System.out.println("数据删除");
20 | }
21 |
22 | });
23 | Test t = new Test();
24 | t.setId(1);
25 | t.setName("张鹏");
26 | zk.writeData("/wpk", t);
27 | Test sd = zk.readData("/wpk");
28 | System.out.println(sd.getId()+"\t"+sd.getName());
29 | }
30 |
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/bd-hive-udf/src/main/resources/package.xml:
--------------------------------------------------------------------------------
1 |
3 | package
4 |
5 | jar
6 |
7 | true
8 |
18 |
19 |
20 | lib
21 | runtime
22 |
23 |
24 |
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 | com.bd
5 | wpk-manage
6 | 0.0.1-SNAPSHOT
7 | pom
8 |
9 | bd-datax
10 | bd-elasticsearch
11 | bd-flink
12 | bd-hbase
13 | bd-hdfs
14 | bd-hive
15 | bd-hive-udf
16 | bd-impala
17 | bd-kafka
18 | bd-kylin
19 | bd-mapreduce
20 | bd-solr
21 | bd-spark
22 | bd-yarn
23 | bd-zk
24 |
25 |
--------------------------------------------------------------------------------
/bd-kylin/src/main/java/org/bd/kylin/cube/Dimensions.java:
--------------------------------------------------------------------------------
1 | package org.bd.kylin.cube;
2 |
3 | /**
4 | * 版权信息: big data module
5 | * 功能描述: 维度
6 | * 版本历史:
7 | * @author wpk | 2017年9月14日 下午12:13:42 |创建
8 | */
9 | public class Dimensions {
10 |
11 | private String table;
12 | private String column;
13 | private String name;
14 | private String derived = null;
15 |
16 | public String getTable() {
17 | return table;
18 | }
19 | public void setTable(String table) {
20 | this.table = table;
21 | }
22 | public String getColumn() {
23 | return column;
24 | }
25 | public void setColumn(String column) {
26 | this.column = column;
27 | }
28 | public String getName() {
29 | return name;
30 | }
31 | public void setName(String name) {
32 | this.name = name;
33 | }
34 | public String getDerived() {
35 | return derived;
36 | }
37 | public void setDerived(String derived) {
38 | this.derived = derived;
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/bd-yarn/src/main/java/org/bd/yarn/utils/YarnUtil.java:
--------------------------------------------------------------------------------
1 | package org.bd.yarn.utils;
2 |
3 | import java.io.IOException;
4 |
5 | import org.apache.hadoop.conf.Configuration;
6 | import org.apache.hadoop.yarn.client.api.YarnClient;
7 |
8 | /**
9 | * 版权信息: big data module
10 | * 功能描述: yarn工具类
11 | * 版本历史:
12 | * @author wpk | 2018年9月1日 下午4:20:37 |创建
13 | */
14 | public class YarnUtil {
15 |
16 | private YarnClient client;
17 | private Configuration conf;
18 |
19 | public YarnClient getClient(){
20 | if(client == null){
21 | Configuration conf = new Configuration();
22 | client = YarnClient.createYarnClient();
23 | client.init(conf);
24 | client.start();
25 | }
26 | return client;
27 | }
28 |
29 | public Configuration getConfig(){
30 | return conf;
31 | }
32 |
33 | public void close(){
34 | try {
35 | if(client == null){
36 | client.close();
37 | }
38 | } catch (IOException e) {
39 | e.printStackTrace();
40 | }
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/bd-kylin/src/main/java/org/bd/kylin/JobStatusEnum.java:
--------------------------------------------------------------------------------
1 | package org.bd.kylin;
2 |
3 | /**
4 | * 版权信息: big data module
5 | * 功能描述: 作业状态
6 | * 版本历史:
7 | * @author wpk | 2017年11月21日 上午10:21:31 |创建
8 | */
9 | public enum JobStatusEnum {
10 |
11 | NEW(0), PENDING(1), RUNNING(2), FINISHED(4), ERROR(8), DISCARDED(16), STOPPED(32);
12 |
13 | private final int code;
14 |
15 | private JobStatusEnum(int statusCode) {
16 | this.code = statusCode;
17 | }
18 |
19 | public static JobStatusEnum getByCode(int statusCode) {
20 | for (JobStatusEnum status : values()) {
21 | if (status.getCode() == statusCode) {
22 | return status;
23 | }
24 | }
25 |
26 | return null;
27 | }
28 |
29 | public int getCode() {
30 | return this.code;
31 | }
32 |
33 | public boolean isComplete() {
34 | return code == JobStatusEnum.FINISHED.getCode() || code == JobStatusEnum.ERROR.getCode() || code == JobStatusEnum.DISCARDED.getCode();
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/bd-spark/src/test/java/org/bd/spark/read/ReadCsvTest.java:
--------------------------------------------------------------------------------
1 | package org.bd.spark.read;
2 |
3 | import org.apache.spark.sql.Dataset;
4 | import org.apache.spark.sql.Row;
5 | import org.apache.spark.sql.SparkSession;
6 | import org.bd.spark.ReadComm;
7 | import org.bd.spark.enums.FormatType;
8 |
9 | /**
10 | * 版权信息: big data module
11 | * 功能描述: 从csv读取数据
12 | * 版本历史:
13 | * @author wpk | 2018年1月16日 上午11:22:57 |创建
14 | */
15 | public class ReadCsvTest {
16 |
17 | public static void readCsv(SparkSession spark) throws Exception{
18 | /*CSVWriter writer =new CSVWriter(new FileWriter("D:/wpk/devToll/workspace/nkzjProject1/idata-spark/test-file/people.csv"),',');
19 | CSVReader reader =new CSVReader(new Reader(),'\t');*/
20 |
21 | Dataset csv = ReadComm.getInstance().
22 | readSource(spark, FormatType.CSV, "D:/wpk/devToll/workspace/nkzjProject1/idata-spark/test-file/people.csv");
23 | csv.show();
24 | }
25 |
26 | public static void main(String[] args) {
27 | // TODO Auto-generated method stub
28 |
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/bd-datax/src/main/java/org/bd/datax/DataxPara.java:
--------------------------------------------------------------------------------
1 | package org.bd.datax;
2 |
3 | /**
4 | * 版权信息: big data module
5 | * 功能描述: datax键值对参数配置
6 | * 版本历史:
7 | * @author wpk | 2017年8月7日 下午10:41:24 |创建
8 | */
9 | public class DataxPara {
10 |
11 | public final static String job = "job";
12 |
13 | public final static String setting = "setting";//全局设置
14 | public final static String speed = "speed";//速度设置
15 | public final static String channel = "channel";
16 | public final static String byt = "byte";
17 | public final static String errorLimit = "errorLimit";//错误限制
18 | public final static String record = "record";
19 | public final static String percentage = "percentage";
20 |
21 | public final static String content = "content";//内容设置
22 | public final static String reader = "reader";//读取设置
23 | public final static String transformer = "transformer";//转换设置
24 | public final static String writer = "writer";//写入设置
25 |
26 | public final static String name = "name";
27 | public final static String parameter = "parameter";
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/bd-zk/src/main/java/org/bd/zk/watcher/ZkLinkWatcher.java:
--------------------------------------------------------------------------------
1 | package org.bd.zk.watcher;
2 |
3 | import org.apache.zookeeper.WatchedEvent;
4 | import org.apache.zookeeper.Watcher;
5 | import org.apache.zookeeper.Watcher.Event.KeeperState;
6 |
7 | /**
8 | * 版权信息: big data module
9 | * 功能描述: zookeeper连接同步观察
10 | * 版本历史:
11 | * @author wpk | 2017年12月3日 上午10:54:59 |创建
12 | */
13 | public class ZkLinkWatcher implements Watcher{
14 |
15 | @Override
16 | public void process(WatchedEvent event) {
17 | if (event.getState() == KeeperState.Disconnected) {//断开连接
18 | System.out.print("====断开连接====");
19 | } else if(event.getState() == KeeperState.SyncConnected) {//同步连接
20 | System.out.print("====同步连接====");
21 | } else if(event.getState() == KeeperState.Expired) {//过期
22 | System.out.print("====过期====");
23 | } else if(event.getState() == KeeperState.AuthFailed){//验证失败
24 | System.out.print("====验证失败====");
25 | }
26 | System.out.println("Receive watched event :" + event);
27 | }
28 |
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/bd-kylin/src/main/java/org/bd/kylin/model/Partition_desc.java:
--------------------------------------------------------------------------------
1 | package org.bd.kylin.model;
2 |
3 | /**
4 | * 版权信息: big data module
5 | * 功能描述: 分区设置
6 | * 版本历史:
7 | * @author wpk | 2017年9月14日 下午3:38:51 |创建
8 | */
9 | public class Partition_desc {
10 |
11 | private String partition_date_column;
12 | private String partition_date_format = "yyyy-MM-dd";
13 | private String partition_type = "APPEND";
14 |
15 | public String getPartition_date_column() {
16 | return partition_date_column;
17 | }
18 | public void setPartition_date_column(String partition_date_column) {
19 | this.partition_date_column = partition_date_column;
20 | }
21 | public String getPartition_date_format() {
22 | return partition_date_format;
23 | }
24 | public void setPartition_date_format(String partition_date_format) {
25 | this.partition_date_format = partition_date_format;
26 | }
27 | public String getPartition_type() {
28 | return partition_type;
29 | }
30 | public void setPartition_type(String partition_type) {
31 | this.partition_type = partition_type;
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/bd-spark/src/test/java/org/bd/spark/read/ReadTextTest.java:
--------------------------------------------------------------------------------
1 | package org.bd.spark.read;
2 |
3 | import org.apache.spark.sql.Dataset;
4 | import org.apache.spark.sql.Row;
5 | import org.apache.spark.sql.SparkSession;
6 | import org.bd.spark.ReadComm;
7 | import org.bd.spark.enums.FormatType;
8 |
9 | /**
10 | * 版权信息: big data module
11 | * 功能描述: 从test读取数据
12 | * 版本历史:
13 | * @author wpk | 2018年1月16日 上午11:24:28 |创建
14 | */
15 | public class ReadTextTest {
16 |
17 | public static void readText(SparkSession spark) throws Exception{
18 | Dataset text = ReadComm.getInstance().
19 | readSource(spark, FormatType.TEXT, "D:/wpk/devToll/workspace/nkzjProject1/idata-spark/test-file/people.txt");
20 | // Dataset text = SparkReadCommon.getInstance().
21 | // readSource(spark, ReadFormat.TEXT.value(), "D:/wpk/devToll/workspace/nkzjProject1/idata-spark/test-file/people.txt",
22 | // "D:/wpk/devToll/workspace/nkzjProject1/idata-spark/test-file/people2.txt");
23 |
24 | text.show();
25 | }
26 |
27 | public static void main(String[] args) {
28 | // TODO Auto-generated method stub
29 |
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/bd-hbase/src/main/java/org/bd/hbase/Test.java:
--------------------------------------------------------------------------------
1 | package org.bd.hbase;
2 |
3 | import java.io.IOException;
4 |
5 | /**
6 | * 版权信息: big data module
7 | * 功能描述: hbase客户端
8 | * 版本历史:
9 | * @author wpk | 2017年11月8日 上午8:54:06 |创建
10 | */
11 | public class Test {
12 |
13 | public static void main(String[] arg) throws IOException{
14 | // createTable("wpk_test1","col1");
15 |
16 | /*List list = new ArrayList();
17 | list.add("col1");
18 | list.add("col2");
19 | list.add("COL3");
20 | list.add("CoL4");
21 | HBaseClient.createTable("wpk_test", list);
22 | System.out.println("新增结束...");
23 | HBaseClient.createTable("wpk_test", "codls5");*/
24 |
25 | // HBaseClient.deleteColumnFamily("wpk_test", "codls5");
26 |
27 | // HBaseClient.deleteTable("member");
28 |
29 | HBaseClient.listTableNames();
30 |
31 | /*Collection c = HBaseClient.getHColumnDescriptors("wpk_test");
32 | for(HColumnDescriptor d : c){
33 | System.out.println(d.getNameAsString());
34 | }*/
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/bd-kylin/src/main/java/org/bd/kylin/request/JobBuildRequest.java:
--------------------------------------------------------------------------------
1 | package org.bd.kylin.request;
2 |
3 | /**
4 | * 版权信息: big data module
5 | * 功能描述: 创建cube任务请求参数对象
6 | * 版本历史:
7 | * @author wpk | 2017年11月21日 上午9:44:21 |创建
8 | */
9 | public class JobBuildRequest {
10 |
11 | private long startTime;
12 |
13 | private long endTime;
14 |
15 | private String buildType;
16 |
17 | // private boolean force;
18 |
19 | public long getStartTime() {
20 | return startTime;
21 | }
22 |
23 | public void setStartTime(long startTime) {
24 | this.startTime = startTime;
25 | }
26 |
27 | public long getEndTime() {
28 | return endTime;
29 | }
30 |
31 | public void setEndTime(long endTime) {
32 | this.endTime = endTime;
33 | }
34 |
35 | public String getBuildType() {
36 | return buildType;
37 | }
38 |
39 | public void setBuildType(String buildType) {
40 | this.buildType = buildType;
41 | }
42 |
43 | /*public boolean isForce() {
44 | return force;
45 | }
46 |
47 | public void setForce(boolean force) {
48 | this.force = force;
49 | }*/
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/bd-spark/src/test/java/org/bd/spark/write/WriteMysqlTest.java:
--------------------------------------------------------------------------------
1 | package org.bd.spark.write;
2 |
3 | import org.apache.spark.SparkConf;
4 | import org.apache.spark.sql.Dataset;
5 | import org.apache.spark.sql.Row;
6 | import org.apache.spark.sql.SparkSession;
7 | import org.bd.spark.SessionDrive;
8 | import org.bd.spark.WriteComm;
9 | import org.bd.spark.enums.DbmsType;
10 |
11 | /**
12 | * 版权信息: big data module
13 | * 功能描述: 写入mysql数据库
14 | * 版本历史:
15 | * @author wpk | 2018年1月16日 上午11:36:42 |创建
16 | */
17 | public class WriteMysqlTest {
18 |
19 | public static void writeMysql(Dataset ds) throws Exception{
20 | SparkConf conf = new SparkConf();
21 | conf.setAppName("wirteMysql");
22 | conf.setMaster("local[2]");
23 | conf.set("spark.some.config.option", "some-value");
24 | SparkSession spark = SessionDrive.getInstance().getSparkSession(conf);
25 | Dataset jdbcDF = WriteComm.getInstance().writeToJDBC(ds, DbmsType.MYSQL, "a_spark_text1");
26 | jdbcDF.show();
27 |
28 | spark.stop();
29 | }
30 |
31 | public static void main(String[] args) {
32 | // TODO Auto-generated method stub
33 |
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/bd-datax/src/main/java/org/bd/datax/bean/Transformer.java:
--------------------------------------------------------------------------------
1 | package org.bd.datax.bean;
2 |
3 | import java.util.List;
4 |
5 |
6 | /**
7 | * 版权信息: big data module
8 | * 功能描述: datax字段处理类
9 | * 版本历史:
10 | * @author wpk | 2017年9月20日 下午9:47:30 |创建
11 | */
12 | public class Transformer {
13 |
14 | private String name;
15 | private Parameter parameter;
16 |
17 | public class Parameter{
18 | private List extraPackage;
19 | private String code;
20 |
21 | public List getExtraPackage() {
22 | return extraPackage;
23 | }
24 | public void setExtraPackage(List extraPackage) {
25 | this.extraPackage = extraPackage;
26 | }
27 | public String getCode() {
28 | return code;
29 | }
30 | public void setCode(String code) {
31 | this.code = code;
32 | }
33 |
34 | }
35 |
36 | public String getName() {
37 | return name;
38 | }
39 |
40 | public void setName(String name) {
41 | this.name = name;
42 | }
43 |
44 | public Parameter getParameter() {
45 | return parameter;
46 | }
47 |
48 | public void setParameter(Parameter parameter) {
49 | this.parameter = parameter;
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/bd-hive/src/main/java/org/bd/hive/utils/Consts.java:
--------------------------------------------------------------------------------
1 | package org.bd.hive.utils;
2 |
3 |
4 | /**
5 | * 版权信息: big data module
6 | * 功能描述: 常量类
7 | * 版本历史:
8 | * @author wpk | 2017年10月31日 下午2:27:48 |创建
9 | */
10 | public class Consts {
11 |
12 | //驱动类
13 | public static final String impala_driver = "hive.driver";
14 | //url连接地址
15 | public static final String impala_url = "hive.url";
16 | //连接用户
17 | public static final String impala_user = "hive.user";
18 | //连接密码
19 | public static final String impala_password = "hive.password";
20 | //初始化连接池连接数
21 | public static final String initialsize = "initialsize";
22 | //连接池最大连接数
23 | public static final String maxactive = "maxactive";
24 | //最小生存时间
25 | public static final String minEvictableIdleTimeMillis = "minEvictableIdleTimeMillis";
26 | //开启强行回收功能
27 | public static final String removeAbandoned = "removeAbandoned";
28 | //连接废弃超过3小时未关闭,就会被强行回收
29 | public static final String removeAbandonedTimeout = "removeAbandonedTimeout";
30 | //30秒检测一次需要强行回收的连接
31 | public static final String timeBetweenEvictionRunsMillis = "timeBetweenEvictionRunsMillis";
32 |
33 | //属性配置文件名称
34 | public static final String hive_properties = "hive.properties";
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/bd-zk/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.bd
7 | wpk-manage
8 | 0.0.1-SNAPSHOT
9 |
10 |
11 | bd-zk
12 | bd-zk
13 | http://maven.apache.org
14 |
15 |
16 | UTF-8
17 |
18 |
19 |
20 |
21 | junit
22 | junit
23 | 3.8.1
24 | test
25 |
26 |
27 | com.github.sgroschupf
28 | zkclient
29 | 0.1
30 |
31 |
32 | org.apache.zookeeper
33 | zookeeper
34 | 3.4.6
35 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/bd-kafka/src/main/java/org/bd/kafka/ProducerRunner.java:
--------------------------------------------------------------------------------
1 | package org.bd.kafka;
2 |
3 | import java.util.concurrent.ExecutionException;
4 | import java.util.concurrent.TimeUnit;
5 |
6 | import org.apache.kafka.clients.producer.RecordMetadata;
7 |
8 | /**
9 | * 版权信息: big data module
10 | * 功能描述: 生产者线程
11 | * 版本历史:
12 | * @author wpk | 2017年11月26日 下午3:29:05 |创建
13 | */
14 | public class ProducerRunner implements Runnable {
15 |
16 | private ProducerClient producer;
17 |
18 | public void run() {
19 | int i=0;
20 | producer = new ProducerClient("topic1");
21 | while(true){
22 | try {
23 | RecordMetadata rm = producer.sendMsg("message: " + i++);
24 | System.out.println(rm.toString());
25 | TimeUnit.SECONDS.sleep(2);
26 | } catch (InterruptedException e) {
27 | e.printStackTrace();
28 | } catch (ExecutionException e) {
29 | e.printStackTrace();
30 | }
31 | }
32 | }
33 |
34 | public static void main(String[] args) {
35 | ProducerRunner item = new ProducerRunner();
36 | Thread t = new Thread(item);
37 | t.start();
38 | }
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/bd-hdfs/src/main/java/org/bd/hdfs/utils/SysVarsUtils.java:
--------------------------------------------------------------------------------
1 | package org.bd.hdfs.utils;
2 |
3 | import java.util.HashMap;
4 | import java.util.Map;
5 |
6 | import org.apache.commons.lang.StringUtils;
7 |
8 | /**
9 | * 版权信息: big data module
10 | * 功能描述: 获取系统常量配置参数
11 | * 版本历史:
12 | * @author wpk | 2017年11月15日 上午10:25:15 |创建
13 | */
14 | public class SysVarsUtils {
15 |
16 | private Map configCache = new HashMap();
17 |
18 | private static SysVarsUtils instance;
19 |
20 | public static SysVarsUtils getInstance(){
21 | if(instance==null)instance = new SysVarsUtils();
22 | return instance;
23 | }
24 |
25 | /**清空缓存*/
26 | public void clearCache(){
27 | configCache.clear();
28 | }
29 |
30 | /**根据参数名取得参数值 */
31 | public String getVarByName(String name){
32 | if(StringUtils.isEmpty(name)){
33 | return null;
34 | }
35 | String config = configCache.get(name);
36 | if(config != null) {
37 | return config;
38 | }
39 | PropertiesUtil propertiesUtil = PropertiesUtil.getInstance();
40 | config = propertiesUtil.getPropertyValue(Consts.HDFS_PROPERTIES, name);
41 | if(config != null){
42 | configCache.put(name, config);
43 | }
44 | return config;
45 | }
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/bd-flink/src/main/resources/log4j.properties:
--------------------------------------------------------------------------------
1 | ################################################################################
2 | # Licensed to the Apache Software Foundation (ASF) under one
3 | # or more contributor license agreements. See the NOTICE file
4 | # distributed with this work for additional information
5 | # regarding copyright ownership. The ASF licenses this file
6 | # to you under the Apache License, Version 2.0 (the
7 | # "License"); you may not use this file except in compliance
8 | # with the License. You may obtain a copy of the License at
9 | #
10 | # http://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | ################################################################################
18 |
19 | log4j.rootLogger=INFO, console
20 |
21 | log4j.appender.console=org.apache.log4j.ConsoleAppender
22 | log4j.appender.console.layout=org.apache.log4j.PatternLayout
23 | log4j.appender.console.layout.ConversionPattern=%d{HH:mm:ss,SSS} %-5p %-60c %x - %m%n
24 |
--------------------------------------------------------------------------------
/bd-hive/src/main/java/org/bd/hive/utils/SysVarsUtils.java:
--------------------------------------------------------------------------------
1 | package org.bd.hive.utils;
2 |
3 | import java.util.HashMap;
4 | import java.util.Map;
5 |
6 | import org.apache.commons.lang.StringUtils;
7 |
8 |
9 | /**
10 | * 版权信息: big data module
11 | * 功能描述: 获取系统常量配置参数
12 | * 版本历史:
13 | * @author wpk | 2017年10月31日 下午2:30:27 |创建
14 | */
15 | public class SysVarsUtils {
16 |
17 | private Map configCache = new HashMap();
18 |
19 | private static SysVarsUtils instance;
20 |
21 | public static SysVarsUtils getInstance(){
22 | if(instance==null)instance = new SysVarsUtils();
23 | return instance;
24 | }
25 |
26 | /**清空缓存*/
27 | public void clearCache(){
28 | configCache.clear();
29 | }
30 |
31 | /**根据参数名取得参数值 */
32 | public String getVarByName(String name){
33 | if(StringUtils.isEmpty(name)){
34 | return null;
35 | }
36 | String config = configCache.get(name);
37 | if(config != null) {
38 | return config;
39 | }
40 | PropertiesUtil propertiesUtil = PropertiesUtil.getInstance();
41 | config = propertiesUtil.getPropertyValue(Consts.hive_properties, name);
42 | if(config != null){
43 | configCache.put(name, config);
44 | }
45 | return config;
46 | }
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/bd-hbase/src/main/java/org/bd/hbase/utils/SysVarsUtils.java:
--------------------------------------------------------------------------------
1 | package org.bd.hbase.utils;
2 |
3 | import java.util.HashMap;
4 | import java.util.Map;
5 |
6 | import org.apache.commons.lang.StringUtils;
7 |
8 |
9 | /**
10 | * 版权信息: big data module
11 | * 功能描述: 获取系统常量配置参数
12 | * 版本历史:
13 | * @author wpk | 2017年10月31日 下午2:30:27 |创建
14 | */
15 | public class SysVarsUtils {
16 |
17 | private Map configCache = new HashMap();
18 |
19 | private static SysVarsUtils instance;
20 |
21 | public static SysVarsUtils getInstance(){
22 | if(instance==null)instance = new SysVarsUtils();
23 | return instance;
24 | }
25 |
26 | /**清空缓存*/
27 | public void clearCache(){
28 | configCache.clear();
29 | }
30 |
31 | /**根据参数名取得参数值 */
32 | public String getVarByName(String name){
33 | if(StringUtils.isEmpty(name)){
34 | return null;
35 | }
36 | String config = configCache.get(name);
37 | if(config != null) {
38 | return config;
39 | }
40 | PropertiesUtil propertiesUtil = PropertiesUtil.getInstance();
41 | config = propertiesUtil.getPropertyValue(Consts.HBASE_PROPERTIES, name);
42 | if(config != null){
43 | configCache.put(name, config);
44 | }
45 | return config;
46 | }
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/bd-impala/src/main/java/org/bd/impala/utils/SysVarsUtils.java:
--------------------------------------------------------------------------------
1 | package org.bd.impala.utils;
2 |
3 | import java.util.HashMap;
4 | import java.util.Map;
5 |
6 | import org.apache.commons.lang.StringUtils;
7 |
8 |
9 | /**
10 | * 版权信息: big data module
11 | * 功能描述: 获取系统常量配置参数
12 | * 版本历史:
13 | * @author wpk | 2017年8月23日 上午11:21:03 |创建
14 | */
15 | public class SysVarsUtils {
16 |
17 | private Map configCache = new HashMap();
18 |
19 | private static SysVarsUtils instance;
20 |
21 | public static SysVarsUtils getInstance(){
22 | if(instance==null)instance = new SysVarsUtils();
23 | return instance;
24 | }
25 |
26 | /**清空缓存*/
27 | public void clearCache(){
28 | configCache.clear();
29 | }
30 |
31 | /**根据参数名取得参数值 */
32 | public String getVarByName(String name){
33 | if(StringUtils.isEmpty(name)){
34 | return null;
35 | }
36 | String config = configCache.get(name);
37 | if(config != null) {
38 | return config;
39 | }
40 | PropertiesUtil propertiesUtil = PropertiesUtil.getInstance();
41 | config = propertiesUtil.getPropertyValue(Consts.impala_properties, name);
42 | if(config != null){
43 | configCache.put(name, config);
44 | }
45 | return config;
46 | }
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/bd-kylin/src/main/java/org/bd/kylin/utils/SysVarsUtils.java:
--------------------------------------------------------------------------------
1 | package org.bd.kylin.utils;
2 |
3 | import java.util.HashMap;
4 | import java.util.Map;
5 |
6 | import org.apache.commons.lang3.StringUtils;
7 |
8 |
9 | /**
10 | * 版权信息: big data module
11 | * 功能描述: 获取系统常量配置参数
12 | * 版本历史:
13 | * @author wpk | 2017年8月23日 上午11:21:03 |创建
14 | */
15 | public class SysVarsUtils {
16 |
17 | private Map configCache = new HashMap();
18 |
19 | private static SysVarsUtils instance;
20 |
21 | public static SysVarsUtils getInstance(){
22 | if(instance==null)instance = new SysVarsUtils();
23 | return instance;
24 | }
25 |
26 | /**清空缓存*/
27 | public void clearCache(){
28 | configCache.clear();
29 | }
30 |
31 | /**根据参数名取得参数值 */
32 | public String getVarByName(String name){
33 | if(StringUtils.isEmpty(name)){
34 | return null;
35 | }
36 | String config = configCache.get(name);
37 | if(config != null) {
38 | return config;
39 | }
40 | PropertiesUtil propertiesUtil = PropertiesUtil.getInstance();
41 | config = propertiesUtil.getPropertyValue(Consts.KYLIN_PROPERTIES, name);
42 | if(config != null){
43 | configCache.put(name, config);
44 | }
45 | return config;
46 | }
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/bd-impala/src/main/java/org/bd/impala/utils/Consts.java:
--------------------------------------------------------------------------------
1 | package org.bd.impala.utils;
2 |
3 |
4 | /**
5 | * 版权信息: big data module
6 | * 功能描述: 常量类
7 | * 版本历史:
8 | * @author wpk | 2017年8月23日 上午11:18:51 |创建
9 | */
10 | public class Consts {
11 |
12 | /**impala 连接配置信息参数*/
13 | //impala驱动类
14 | public static final String impala_driver = "impala.driver";
15 | //impala url连接地址
16 | public static final String impala_url = "impala.url";
17 | //impala连接用户
18 | public static final String impala_user = "impala_user";
19 | //impala连接密码
20 | public static final String impala_password = "impala.password";
21 | //初始化连接池连接数
22 | public static final String initialsize = "initialsize";
23 | //连接池最大连接数
24 | public static final String maxactive = "maxactive";
25 | //最小生存时间
26 | public static final String minEvictableIdleTimeMillis = "minEvictableIdleTimeMillis";
27 | //开启强行回收功能
28 | public static final String removeAbandoned = "removeAbandoned";
29 | //连接废弃超过3小时未关闭,就会被强行回收
30 | public static final String removeAbandonedTimeout = "removeAbandonedTimeout";
31 | //30秒检测一次需要强行回收的连接
32 | public static final String timeBetweenEvictionRunsMillis = "timeBetweenEvictionRunsMillis";
33 |
34 | //属性配置文件名称
35 | public static final String impala_properties = "impala.properties";
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/bd-spark/src/test/java/org/bd/spark/read/AppReadTest.java:
--------------------------------------------------------------------------------
1 | package org.bd.spark.read;
2 |
3 | import java.sql.SQLException;
4 |
5 | import org.apache.spark.SparkConf;
6 | import org.apache.spark.sql.SparkSession;
7 | import org.bd.spark.SessionDrive;
8 |
9 | /**
10 | * 版权信息: big data module
11 | * 功能描述: 从不同库、文件读取数据测试
12 | * 版本历史:
13 | * @author wpk | 2017年7月25日上午9:43:09 |创建
14 | */
15 | public class AppReadTest {
16 |
17 | public static void main(String[] args) {
18 | try {
19 | System.setProperty("hadoop.home.dir", "F:\\hadoop-common-2.2.0-bin-master");
20 | SparkConf conf = new SparkConf();
21 | conf.setAppName("readTest");
22 | conf.setMaster("local[2]");
23 | conf.set("spark.some.config.option", "some-value");
24 | SparkSession spark = SessionDrive.getInstance().getSparkSession(conf);
25 |
26 | ReadJsonTest.readJson(spark);//读取json文件
27 | ReadCsvTest.readCsv(spark);//读取csv文件
28 | ReadTextTest.readText(spark);//读取text文件
29 | ReadParquetTest.readParquet(spark);//读取parquet文件
30 | spark.stop();
31 |
32 | ReadMysqlTest.readMysql();//读取数据库
33 |
34 | ReadHiveTest.readHive();//读取hive表
35 | } catch (SQLException e) {
36 | e.printStackTrace();
37 | } catch (Exception e){
38 | e.printStackTrace();
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/bd-kylin/src/main/java/org/bd/kylin/model/Lookups.java:
--------------------------------------------------------------------------------
1 | package org.bd.kylin.model;
2 |
3 | import java.util.List;
4 |
5 | /**
6 | * 版权信息: big data module
7 | * 功能描述: 查询表
8 | * 版本历史:
9 | * @author wpk | 2017年9月14日 下午3:33:51 |创建
10 | */
11 | public class Lookups {
12 |
13 | private String table;
14 | private Join join;
15 |
16 | public class Join{
17 | private String type;
18 | private List primary_key;
19 | private List foreign_key;
20 |
21 | public String getType() {
22 | return type;
23 | }
24 | public void setType(String type) {
25 | this.type = type;
26 | }
27 | public List getPrimary_key() {
28 | return primary_key;
29 | }
30 | public void setPrimary_key(List primary_key) {
31 | this.primary_key = primary_key;
32 | }
33 | public List getForeign_key() {
34 | return foreign_key;
35 | }
36 | public void setForeign_key(List foreign_key) {
37 | this.foreign_key = foreign_key;
38 | }
39 | }
40 |
41 | public String getTable() {
42 | return table;
43 | }
44 |
45 | public void setTable(String table) {
46 | this.table = table;
47 | }
48 |
49 | public Join getJoin() {
50 | return join;
51 | }
52 |
53 | public void setJoin(Join join) {
54 | this.join = join;
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/bd-spark/src/test/java/org/bd/spark/read/ReadMysqlTest.java:
--------------------------------------------------------------------------------
1 | package org.bd.spark.read;
2 |
3 | import org.apache.spark.SparkConf;
4 | import org.apache.spark.sql.Dataset;
5 | import org.apache.spark.sql.Row;
6 | import org.apache.spark.sql.SparkSession;
7 | import org.bd.spark.ReadComm;
8 | import org.bd.spark.SessionDrive;
9 | import org.bd.spark.enums.DbmsType;
10 |
11 | /**
12 | * 版权信息: big data module
13 | * 功能描述: 从mysql上读取数据
14 | * 版本历史:
15 | * @author wpk | 2018年1月16日 上午11:27:10 |创建
16 | */
17 | public class ReadMysqlTest {
18 |
19 | public static Dataset readMysql() throws Exception{
20 | SparkConf conf = new SparkConf();
21 | conf.setAppName("readMysql");
22 | conf.setMaster("local[2]");
23 | conf.set("spark.some.config.option", "some-value");
24 | conf.set("spark.sql.warehouse.dir","file:///");//不加这一句,启动时会报错Error while instantiating 'org.apache.spark.sql.internal.SessionState'
25 | SparkSession spark = SessionDrive.getInstance().getSparkSession(conf);
26 | Dataset jdbcDF = ReadComm.getInstance().readByJDBC(spark, DbmsType.MYSQL, "a_spark_text");
27 | jdbcDF.show();
28 |
29 | // spark.stop();
30 | return jdbcDF;
31 | }
32 |
33 | public static void main(String[] args) {
34 | // TODO Auto-generated method stub
35 |
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/bd-spark/src/test/java/org/bd/spark/read/ReadHiveTest.java:
--------------------------------------------------------------------------------
1 | package org.bd.spark.read;
2 |
3 | import org.apache.spark.SparkConf;
4 | import org.apache.spark.sql.Dataset;
5 | import org.apache.spark.sql.Row;
6 | import org.apache.spark.sql.SparkSession;
7 | import org.bd.spark.SessionDrive;
8 |
9 | /**
10 | * 版权信息: big data module
11 | * 功能描述: 从hive读取数据
12 | * 版本历史:
13 | * @author wpk | 2018年1月16日 上午11:28:05 |创建
14 | */
15 | public class ReadHiveTest {
16 |
17 | public static Dataset readHive() throws Exception{
18 | SparkConf conf = new SparkConf();
19 | conf.setAppName("SparkPostHive");
20 | conf.setMaster("local[2]");
21 | conf.set("support.type", "hive");
22 | conf.set("spark.sql.warehouse.dir", "./spark-warehouse");//不加这一句,启动时会报错Error while instantiating 'org.apache.spark.sql.internal.SessionState'
23 | SparkSession spark = SessionDrive.getInstance().getSparkSession(conf);
24 |
25 | spark.sql("select count(1) from syeas.t_gl_voucherassistrecord").show();
26 |
27 | Dataset ds1 = spark.sql("select * from syeas.t_gl_voucherassistrecord limit 5");
28 | ds1.show();
29 |
30 | //关闭程序
31 | // spark.stop();
32 |
33 | return ds1;
34 | }
35 |
36 | public static void main(String[] args) {
37 | // TODO Auto-generated method stub
38 |
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/bd-spark/src/test/java/org/bd/spark/write/AppWriteTest.java:
--------------------------------------------------------------------------------
1 | package org.bd.spark.write;
2 |
3 | import java.sql.SQLException;
4 |
5 | import org.apache.spark.sql.Dataset;
6 | import org.apache.spark.sql.Row;
7 | import org.apache.spark.sql.SparkSession;
8 | import org.bd.spark.read.ReadMysqlTest;
9 |
10 | /**
11 | * 版权信息: big data module
12 | * 功能描述: 写入不同库、文件测试
13 | * 版本历史:
14 | * @author wpk | 2017年7月25日下午3:23:06 |创建
15 | */
16 | public class AppWriteTest {
17 |
18 | public static void main(String[] args) {
19 | try {
20 | System.setProperty("hadoop.home.dir", "F:\\hadoop-common-2.2.0-bin-master");
21 | Dataset mysql = ReadMysqlTest.readMysql();//从mysql读取
22 |
23 | //创建临时表用于sql查询
24 | mysql.createOrReplaceTempView("role");
25 | SparkSession spark = mysql.sparkSession();
26 | Dataset sqlDF = spark.sql("select id,name,code,operateStatus from role");
27 | sqlDF.show();
28 |
29 | WriteJsonTest.writeJson(sqlDF);//写入json文件
30 | WriteCsvTest.writeCsv(sqlDF);//写入csv文件
31 | WriteTextTest.writeTxt(sqlDF);//写入text文件
32 | WriteParquetTest.writeParquet(sqlDF);//写入parquet文件
33 |
34 | //写入数据库
35 | // WriteMysqlTest.writeMysql(sqlDF);
36 | } catch (SQLException e) {
37 | e.printStackTrace();
38 | } catch (Exception e){
39 | e.printStackTrace();
40 | }
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/bd-elasticsearch/pom.xml:
--------------------------------------------------------------------------------
1 |
2 | 4.0.0
3 |
4 | com.bd
5 | wpk-manage
6 | 0.0.1-SNAPSHOT
7 |
8 |
9 | com.bd.es
10 | bd-elasticsearch
11 |
12 |
13 |
14 | org.elasticsearch.client
15 | transport
16 | 6.2.2
17 |
18 |
19 | org.apache.logging.log4j
20 | log4j-api
21 | 2.9.1
22 |
23 |
24 | org.apache.logging.log4j
25 | log4j-core
26 | 2.9.1
27 |
28 |
29 | com.fasterxml.jackson.core
30 | jackson-core
31 | 2.9.6
32 |
33 |
34 | com.fasterxml.jackson.core
35 | jackson-databind
36 | 2.9.6
37 |
38 |
39 |
--------------------------------------------------------------------------------
/bd-kylin/src/main/java/org/bd/kylin/rest/response/ProjectRestResponse.java:
--------------------------------------------------------------------------------
1 | package org.bd.kylin.rest.response;
2 |
3 | import java.io.IOException;
4 | import java.util.List;
5 |
6 | import org.bd.kylin.response.ProjectInfo;
7 | import org.bd.kylin.rest.ProjectRest;
8 | import org.bd.kylin.utils.JsonBinder;
9 |
10 | import com.fasterxml.jackson.core.JsonParseException;
11 | import com.fasterxml.jackson.core.type.TypeReference;
12 | import com.fasterxml.jackson.databind.JsonMappingException;
13 | import com.fasterxml.jackson.databind.ObjectMapper;
14 |
15 | /**
16 | * 版权信息: big data module
17 | * 功能描述: kylin项目接口
18 | * 版本历史:
19 | * @author wpk | 2017年11月21日 下午3:23:13 |创建
20 | */
21 | public class ProjectRestResponse extends ProjectRest{
22 |
23 | /**
24 | * 描述: 获取项目信息
25 | * @author wpk | 2017年11月21日 下午3:24:05 |创建
26 | * @return List
27 | * @throws IOException
28 | * @throws JsonMappingException
29 | * @throws JsonParseException
30 | */
31 | @SuppressWarnings("unchecked")
32 | public static List getProjectsResp() throws JsonParseException, JsonMappingException, IOException{
33 | String result = getProjects();
34 | ObjectMapper om = JsonBinder.buildNonNullBinder().getMapper();
35 | List list = (List)om.readValue(result, new TypeReference>() {});
36 | return list;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/bd-kylin/src/main/java/org/bd/kylin/request/SQLRequest.java:
--------------------------------------------------------------------------------
1 | package org.bd.kylin.request;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * 版权信息: big data module
7 | * 功能描述: 查询语句请求参数
8 | * 版本历史:
9 | * @author wpk | 2017年11月20日 下午9:54:14 |创建
10 | */
11 | public class SQLRequest implements Serializable {
12 |
13 | protected static final long serialVersionUID = 1L;
14 |
15 | private String sql;
16 | private String project;
17 | private Integer offset = 0;
18 | private Integer limit = 0;
19 | private boolean acceptPartial = true;
20 |
21 | public SQLRequest() {
22 | }
23 |
24 | public String getSql() {
25 | return sql;
26 | }
27 |
28 | public void setSql(String sql) {
29 | this.sql = sql;
30 | }
31 |
32 | public String getProject() {
33 | return project;
34 | }
35 |
36 | public void setProject(String project) {
37 | this.project = project;
38 | }
39 |
40 | public Integer getOffset() {
41 | return offset;
42 | }
43 |
44 | public void setOffset(Integer offset) {
45 | this.offset = offset;
46 | }
47 |
48 | public Integer getLimit() {
49 | return limit;
50 | }
51 |
52 | public void setLimit(Integer limit) {
53 | this.limit = limit;
54 | }
55 |
56 | public boolean getAcceptPartial() {
57 | return acceptPartial;
58 | }
59 |
60 | public void setAcceptPartial(boolean acceptPartial) {
61 | this.acceptPartial = acceptPartial;
62 | }
63 |
64 | }
65 |
--------------------------------------------------------------------------------
/bd-datax/src/main/java/org/bd/datax/bean/SettingBean.java:
--------------------------------------------------------------------------------
1 | package org.bd.datax.bean;
2 |
3 | import java.util.Map;
4 |
5 | import org.bd.datax.DataxPara;
6 | import org.bd.datax.bean.Setting.ErrorLimit;
7 | import org.bd.datax.bean.Setting.Speed;
8 |
9 | /**
10 | * 版权信息: big data module
11 | * 功能描述: setting转换类
12 | * 版本历史:
13 | * @author wpk | 2017年10月13日 下午10:54:36 |创建
14 | */
15 | @SuppressWarnings("rawtypes")
16 | public class SettingBean {
17 |
18 | /**
19 | * 描述: 获取全局对象
20 | * @author wpk | 2017年10月13日 下午10:55:03 |创建
21 | * @param map
22 | * @return
23 | * @return Setting
24 | */
25 | public Setting getBean(Map map){
26 | Setting bean = new Setting();
27 | Speed speed = bean.new Speed();
28 | ErrorLimit errorLimit = bean.new ErrorLimit();
29 |
30 | if(map.containsKey(DataxPara.channel) && map.get(DataxPara.channel)!=null){
31 | speed.setChannel(Integer.parseInt(map.get(DataxPara.channel).toString()));
32 | }
33 |
34 | if(map.containsKey(DataxPara.record) && map.get(DataxPara.record)!=null){
35 | errorLimit.setRecord(Integer.parseInt(map.get(DataxPara.record).toString()));
36 | }
37 | if(map.containsKey(DataxPara.percentage) && map.get(DataxPara.percentage)!=null){
38 | errorLimit.setPercentage(Double.parseDouble(map.get(DataxPara.percentage).toString()));
39 | }
40 |
41 | bean.setSpeed(speed);
42 | bean.setErrorLimit(errorLimit);
43 | return bean;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/bd-kylin/src/main/java/org/bd/kylin/cube/Rowkey.java:
--------------------------------------------------------------------------------
1 | package org.bd.kylin.cube;
2 |
3 | import java.util.List;
4 |
5 | /**
6 | * 版权信息: big data module
7 | * 功能描述: rowkey配置
8 | * 版本历史:
9 | * @author wpk | 2017年9月14日 下午12:24:26 |创建
10 | */
11 | public class Rowkey {
12 |
13 | private List rowkey_columns;
14 |
15 | public class Rowkey_columns{
16 | private String column;
17 | private String encoding = "dict";
18 | private Integer valueLength = 0;
19 | private String isShardBy = "false";
20 |
21 | public String getColumn() {
22 | return column;
23 | }
24 | public void setColumn(String column) {
25 | this.column = column;
26 | }
27 | public String getEncoding() {
28 | return encoding;
29 | }
30 | public void setEncoding(String encoding) {
31 | this.encoding = encoding;
32 | }
33 | public Integer getValueLength() {
34 | return valueLength;
35 | }
36 | public void setValueLength(Integer valueLength) {
37 | this.valueLength = valueLength;
38 | }
39 | public String getIsShardBy() {
40 | return isShardBy;
41 | }
42 | public void setIsShardBy(String isShardBy) {
43 | this.isShardBy = isShardBy;
44 | }
45 | }
46 |
47 | public List getRowkey_columns() {
48 | return rowkey_columns;
49 | }
50 |
51 | public void setRowkey_columns(List rowkey_columns) {
52 | this.rowkey_columns = rowkey_columns;
53 | }
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/bd-hbase/src/main/java/org/bd/hbase/utils/HBaseUtils.java:
--------------------------------------------------------------------------------
1 | package org.bd.hbase.utils;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | import javax.activation.UnsupportedDataTypeException;
7 |
8 | /**
9 | * 版权信息: big data module
10 | * 功能描述: hbase工具类
11 | * 版本历史:
12 | * @author wpk | 2017年11月9日 下午2:23:45 |创建
13 | */
14 | public class HBaseUtils {
15 |
16 | /**
17 | * 描述: 参数转换
18 | * @author wpk | 2017年11月9日 下午2:24:31 |创建
19 | * @param obj
20 | * @throws UnsupportedDataTypeException
21 | * @return List
22 | */
23 | @SuppressWarnings("unchecked")
24 | public static List familyDataTypeConver(Object obj) throws UnsupportedDataTypeException{
25 | List list = new ArrayList();
26 | if(obj instanceof String){
27 | list.add((String)obj);
28 | }else if(obj instanceof List){
29 | List