This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@org.springframework.context.annotation.Configuration | |
public class HBaseConfig { | |
final Logger logger = LoggerFactory.getLogger(HBaseConfig.class); | |
@Autowired | |
private org.apache.commons.configuration.Configuration configuration; | |
@Bean | |
public Configuration defaultHBaseConfig() throws IOException{ | |
Configuration conf = null; | |
try{ | |
conf = HBaseConfiguration.create(); | |
conf.set("hbase.master", configuration.getString("hbase.master")); | |
conf.set("hbase.zookeeper.quorum", configuration.getString("hbase.zookeeper.quorum")); | |
conf.set("hbase.zookeeper.property.clientPort", configuration.getString("hbase.zookeeper.property.clientPort")); | |
}catch(Exception ex){ | |
logger.error("Exception", ex); | |
} | |
return conf; | |
} | |
@Bean | |
public HTablePool defaultHTablePool() throws IOException { | |
HTablePool tablePool = new HTablePool(defaultHBaseConfig(), 30); | |
return tablePool; | |
} | |
} |
# You need to set ips in the hosts file.
<hbase>
<master>server1:6000</master>
<zookeeper>
<quorum>server1</quorum>
<property>
<clientPort>2181</clientPort>
</property>
</zookeeper>
</hbase>
No comments:
Post a Comment