CentOS7.4到Elasticsearch一路坑(七)
这次问题出在了hbase,具体说,是java调试hbase
描述一下环境:intellij idea装在我的mac,虚拟机是1master2slave,都装在vmware上,各项服务启动正常
代码也很初级
public static Configuration getHBaseConfiguration() {
Configuration conf = HBaseConfiguration.create();
conf.set("hbase.zookeeper.quorum","192.168.18.241");
conf.set("zookeeper.znode.parent", "/hbase");
conf.set("hbase.zookeeper.property.clientPort", "2181");
conf.set("hbase.master", "192.168.18.241:60010");
return conf;
}
public static void createTable(Configuration conf) throws IOException {
Connection connection = ConnectionFactory.createConnection(conf);
Admin admin = connection.getAdmin();
System.out.println("start create table ......");
if (!admin.tableExists(TableName.valueOf(TABLE_NAME))) {
HTableDescriptor tableDescriptor = new HTableDescriptor(TableName.valueOf(TABLE_NAME));
HColumnDescriptor columnDescriptor_1 = new HColumnDescriptor(Bytes.toBytes(FAMILY_NAME_1));
HColumnDescriptor columnDescriptor_2 = new HColumnDescriptor(Bytes.toBytes(FAMILY_NAME_2));
tableDescriptor.addFamily(columnDescriptor_1);
tableDescriptor.addFamily(columnDescriptor_2);
admin.createTable(tableDescriptor);
}
System.out.println("end create table ......");
}
本来也没啥,可是死活超时
查了很多资料,有人让我注释掉hosts里的127,可是大哥,我刚踩的坑,注释掉127,Hadoop就挂了。。。
最后找到了解决方案,集群中的地址,本机也要在hosts中配置好
我先记下来,稍等我得研究一下怎么个机制。。。