|
@ -1,7 +1,6 @@
|
|
package com.yihu.base.hbase.config;
|
|
package com.yihu.base.hbase.config;
|
|
|
|
|
|
import com.yihu.base.hbase.properties.HbaseProperties;
|
|
import com.yihu.base.hbase.properties.HbaseProperties;
|
|
import com.yihu.base.hbase.rowkey.IRowkeyGenerate;
|
|
|
|
import org.apache.hadoop.conf.Configuration;
|
|
import org.apache.hadoop.conf.Configuration;
|
|
import org.apache.hadoop.hbase.HBaseConfiguration;
|
|
import org.apache.hadoop.hbase.HBaseConfiguration;
|
|
import org.apache.hadoop.hbase.HColumnDescriptor;
|
|
import org.apache.hadoop.hbase.HColumnDescriptor;
|
|
@ -10,6 +9,7 @@ import org.apache.hadoop.hbase.TableName;
|
|
import org.apache.hadoop.hbase.client.*;
|
|
import org.apache.hadoop.hbase.client.*;
|
|
import org.springframework.data.hadoop.hbase.HbaseTemplate;
|
|
import org.springframework.data.hadoop.hbase.HbaseTemplate;
|
|
import org.springframework.data.hadoop.hbase.TableCallback;
|
|
import org.springframework.data.hadoop.hbase.TableCallback;
|
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
@ -31,7 +31,6 @@ public class HbaseFactory {
|
|
this.hbaseProperties = hbaseProperties;
|
|
this.hbaseProperties = hbaseProperties;
|
|
}
|
|
}
|
|
|
|
|
|
private IRowkeyGenerate rowkeyRule;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
* 批量新增行
|
|
* 批量新增行
|
|
@ -111,8 +110,14 @@ public class HbaseFactory {
|
|
configuration = HBaseConfiguration.create();
|
|
configuration = HBaseConfiguration.create();
|
|
|
|
|
|
configuration.set("hbase.zookeeper.quorum", hbaseProperties.getZkHosts());
|
|
configuration.set("hbase.zookeeper.quorum", hbaseProperties.getZkHosts());
|
|
configuration.set("zookeeper.znode.parent",HbaseProperties.default_zkZnodeParent);
|
|
|
|
configuration.set("hbase.zookeeper.property.clientPort",HbaseProperties.default_zkPort);
|
|
|
|
|
|
if(StringUtils.isEmpty(hbaseProperties.getZkZnodeParent())){
|
|
|
|
hbaseProperties.setZkZnodeParent(HbaseProperties.default_zkZnodeParent);
|
|
|
|
}
|
|
|
|
configuration.set("zookeeper.znode.parent",hbaseProperties.getZkZnodeParent());
|
|
|
|
if(StringUtils.isEmpty(hbaseProperties.getZkPort())){
|
|
|
|
hbaseProperties.setZkPort(HbaseProperties.default_zkPort);
|
|
|
|
}
|
|
|
|
configuration.set("hbase.zookeeper.property.clientPort",hbaseProperties.getZkPort());
|
|
hbaseTemplate.setConfiguration(configuration);
|
|
hbaseTemplate.setConfiguration(configuration);
|
|
}
|
|
}
|
|
}
|
|
}
|