Commit b3336207 by haozi

完善Hbase demo,测试通过

parent 17fd3674
...@@ -20,6 +20,13 @@ ...@@ -20,6 +20,13 @@
<dependency> <dependency>
<groupId>com.secoo.mall</groupId> <groupId>com.secoo.mall</groupId>
<artifactId>logger-starter</artifactId> <artifactId>logger-starter</artifactId>
<!--解决启动加载apollo,Config空指针问题-->
<exclusions>
<exclusion>
<artifactId>apollo-client</artifactId>
<groupId>com.ctrip.framework.apollo</groupId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.secoo.mall</groupId> <groupId>com.secoo.mall</groupId>
......
package mall; package com.secoo.mall;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
......
package mall.hbase; package com.secoo.mall.hbase;
import com.secoo.mall.hbase.spring.boot.autoconfigure.HbaseTemplate; import com.secoo.mall.hbase.spring.boot.autoconfigure.HbaseTemplate;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -53,7 +53,9 @@ public class SimpleHBase implements InitializingBean { ...@@ -53,7 +53,9 @@ public class SimpleHBase implements InitializingBean {
log.info("Creating table. "); log.info("Creating table. ");
Admin admin = hbaseTemplate.getConnection().getAdmin(); Admin admin = hbaseTemplate.getConnection().getAdmin();
admin.createTable(tableDescriptor); if(!admin.tableExists(TableName.valueOf(TABLE_NAME))){
admin.createTable(tableDescriptor);
}
log.info(" Done."); log.info(" Done.");
} }
...@@ -86,8 +88,8 @@ public class SimpleHBase implements InitializingBean { ...@@ -86,8 +88,8 @@ public class SimpleHBase implements InitializingBean {
@Override @Override
public void afterPropertiesSet() throws Exception { public void afterPropertiesSet() throws Exception {
createTable(); // createTable();
// put(); // put();
// get(); get();
} }
} }
...@@ -7,4 +7,4 @@ server: ...@@ -7,4 +7,4 @@ server:
hbase: hbase:
zookeeper: zookeeper:
quorum: 10.0.255.184:2181,10.0.255.185:2181,10.0.255.186:2181 quorum: 10.4.3.236:2181,10.4.3.237:2181,10.4.3.235:2181
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment