org.apache.hadoop.hbase.client.RetriesExhaustedWithDetailsException

org.apache.hadoop.hbase.client.RetriesExhaustedWithDetailsException

原因:hbase没创建对应表。
建表语句:

create 'Student','StuInfo','Grades'

建表方法

	public static void creatTable(String tableName, String[] familys) throws Exception {
    
    
		HBaseAdmin admin = new HBaseAdmin(conf);
		if (admin.tableExists(tableName)) {
    
    
			System.out.println("该表已存在");
		}else {
    
    
			HTableDescriptor tableDesc = new HTableDescriptor(TableName.valueOf(tableName));
			for (int i = 0; i < familys.length; i++) {
    
    
				tableDesc.addFamily(new HColumnDescriptor(familys[i]));
			}
			admin.createTable(tableDesc);
			System.out.println("创建表 " + tableName + " 完成.");
		}
	}

猜你喜欢

转载自blog.csdn.net/weixin_43614067/article/details/108366991
今日推荐