Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
matrix
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
mall
arch
matrix
Commits
ba6d6374
Commit
ba6d6374
authored
Mar 19, 2020
by
qiuweili123
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整结构
parent
2f4b1d4b
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
12 additions
and
164 deletions
+12
-164
pom.xml
matrix-bigdata/matrix-bigdata-demo/pom.xml
+0
-37
Application.java
matrix-bigdata/matrix-bigdata-demo/src/main/java/com/secoo/mall/Application.java
+0
-15
SimpleHBase.java
matrix-bigdata/matrix-bigdata-demo/src/main/java/com/secoo/mall/hbase/SimpleHBase.java
+0
-95
application.yml
matrix-bigdata/matrix-bigdata-demo/src/main/resources/application.yml
+0
-10
pom.xml
matrix-bigdata/pom.xml
+11
-1
pom.xml
pom.xml
+1
-6
No files found.
matrix-bigdata/matrix-bigdata-demo/pom.xml
deleted
100644 → 0
View file @
2f4b1d4b
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
matrix-bigdata
</artifactId>
<groupId>
com.secoo.mall
</groupId>
<version>
1.3.2.RELEASE
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
matrix-bigdata-demo
</artifactId>
<dependencies>
<!--lombok-->
<dependency>
<groupId>
org.projectlombok
</groupId>
<artifactId>
lombok
</artifactId>
</dependency>
<dependency>
<groupId>
com.secoo.mall
</groupId>
<artifactId>
logger-starter
</artifactId>
<!--解决启动加载apollo,Config空指针问题-->
<exclusions>
<exclusion>
<artifactId>
apollo-client
</artifactId>
<groupId>
com.ctrip.framework.apollo
</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
com.secoo.mall
</groupId>
<artifactId>
matrix-bigdata-hbase-starter
</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
matrix-bigdata/matrix-bigdata-demo/src/main/java/com/secoo/mall/Application.java
deleted
100644 → 0
View file @
2f4b1d4b
package
com
.
secoo
.
mall
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
@SpringBootApplication
@Slf4j
public
class
Application
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
Application
.
class
,
args
);
log
.
info
(
"matrix-bigdata-demo SpringBoot Start Success"
);
}
}
matrix-bigdata/matrix-bigdata-demo/src/main/java/com/secoo/mall/hbase/SimpleHBase.java
deleted
100644 → 0
View file @
2f4b1d4b
package
com
.
secoo
.
mall
.
hbase
;
import
com.secoo.mall.hbase.spring.boot.autoconfigure.HbaseTemplate
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.hadoop.hbase.Cell
;
import
org.apache.hadoop.hbase.CellUtil
;
import
org.apache.hadoop.hbase.TableName
;
import
org.apache.hadoop.hbase.client.Admin
;
import
org.apache.hadoop.hbase.client.ColumnFamilyDescriptor
;
import
org.apache.hadoop.hbase.client.ColumnFamilyDescriptorBuilder
;
import
org.apache.hadoop.hbase.client.Put
;
import
org.apache.hadoop.hbase.client.TableDescriptor
;
import
org.apache.hadoop.hbase.client.TableDescriptorBuilder
;
import
org.springframework.beans.factory.InitializingBean
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* 简单 HBase 操作
*
* @author zhanghao
* @date 2020-03-1719:20
*/
@Component
@Slf4j
public
class
SimpleHBase
implements
InitializingBean
{
@Resource
private
HbaseTemplate
hbaseTemplate
;
private
static
final
String
TABLE_NAME
=
"mytable"
;
private
static
final
String
CF_DEFAULT
=
"cf"
;
public
static
final
byte
[]
QUALIFIER
=
"col1"
.
getBytes
();
private
static
final
byte
[]
ROWKEY
=
"rowkey1"
.
getBytes
();
/**
* 建表
*
* @throws IOException
*/
public
void
createTable
()
throws
IOException
{
List
<
ColumnFamilyDescriptor
>
columnFamilyDescriptors
=
new
ArrayList
<
ColumnFamilyDescriptor
>();
columnFamilyDescriptors
.
add
(
ColumnFamilyDescriptorBuilder
.
of
(
CF_DEFAULT
));
TableDescriptor
tableDescriptor
=
TableDescriptorBuilder
.
newBuilder
(
TableName
.
valueOf
(
TABLE_NAME
))
.
setColumnFamilies
(
columnFamilyDescriptors
).
build
();
log
.
info
(
"Creating table. "
);
Admin
admin
=
hbaseTemplate
.
getConnection
().
getAdmin
();
if
(!
admin
.
tableExists
(
TableName
.
valueOf
(
TABLE_NAME
))){
admin
.
createTable
(
tableDescriptor
);
}
log
.
info
(
" Done."
);
}
/**
* 保存更新
*/
public
void
put
()
{
Put
put
=
new
Put
(
ROWKEY
);
put
.
addColumn
(
CF_DEFAULT
.
getBytes
(),
QUALIFIER
,
"this is value"
.
getBytes
());
hbaseTemplate
.
saveOrUpdate
(
TABLE_NAME
,
put
);
}
/**
* 查询
*/
public
void
get
()
{
hbaseTemplate
.
get
(
TABLE_NAME
,
"rowkey1"
,
CF_DEFAULT
,
(
result
,
rowNum
)
->
{
Map
<
String
,
String
>
map
=
new
HashMap
();
for
(
Cell
cell
:
result
.
rawCells
())
{
log
.
info
(
"行健: "
+
new
String
(
CellUtil
.
cloneRow
(
cell
)));
log
.
info
(
"列簇: "
+
new
String
(
CellUtil
.
cloneFamily
(
cell
)));
log
.
info
(
"列: "
+
new
String
(
CellUtil
.
cloneQualifier
(
cell
)));
log
.
info
(
"值: "
+
new
String
(
CellUtil
.
cloneValue
(
cell
)));
log
.
info
(
"时间戳: "
+
cell
.
getTimestamp
());
map
.
put
(
new
String
(
CellUtil
.
cloneQualifier
(
cell
)),
new
String
(
CellUtil
.
cloneValue
(
cell
)));
}
return
map
;
});
}
@Override
public
void
afterPropertiesSet
()
throws
Exception
{
// createTable();
// put();
get
();
}
}
matrix-bigdata/matrix-bigdata-demo/src/main/resources/application.yml
deleted
100644 → 0
View file @
2f4b1d4b
spring
:
application
:
name
:
matrix-bigdata-demo
server
:
port
:
6080
hbase
:
zookeeper
:
quorum
:
10.4.3.236:2181,10.4.3.237:2181,10.4.3.235:2181
matrix-bigdata/pom.xml
View file @
ba6d6374
...
...
@@ -14,8 +14,17 @@
<modules>
<module>
matrix-bigdata-hbase-starter
</module>
<module>
matrix-bigdata-spark-starter
</module>
<module>
matrix-bigdata-demo
</module>
</modules>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>
com.aliyun.hbase
</groupId>
<artifactId>
alihbase-client
</artifactId>
<version>
2.0.3
</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>
\ No newline at end of file
pom.xml
View file @
ba6d6374
...
...
@@ -244,12 +244,7 @@
<artifactId>
apollo-client
</artifactId>
<version>
1.4.0
</version>
</dependency>
<!-- hbase -->
<dependency>
<groupId>
com.aliyun.hbase
</groupId>
<artifactId>
alihbase-client
</artifactId>
<version>
2.0.3
</version>
</dependency>
</dependencies>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment