Hive Hcatalog配置单元问题java.lang.IllegalArgumentException:URI:没有方案
嗨,我正试图从下面的链接中完成这个hcatalog示例 运行作业时,我遇到以下异常 java.lang.IllegalArgumentException:URI:没有方案 java类:Hive Hcatalog配置单元问题java.lang.IllegalArgumentException:URI:没有方案,hive,hcatalog,Hive,Hcatalog,嗨,我正试图从下面的链接中完成这个hcatalog示例 运行作业时,我遇到以下异常 java.lang.IllegalArgumentException:URI:没有方案 java类: import java.io.IOException; import java.util.*; import org.apache.hadoop.fs.Path; import org.apache.hadoop.conf.*; import org.apache.hadoop.io.*; import or
import java.io.IOException;
import java.util.*;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.conf.*;
import org.apache.hadoop.io.*;
import org.apache.hadoop.mapreduce.*;
import org.apache.hadoop.util.*;
import org.apache.hcatalog.common.*;
import org.apache.hcatalog.mapreduce.*;
import org.apache.hcatalog.data.*;
import org.apache.hcatalog.data.schema.*;
import org.apache.hadoop.util.GenericOptionsParser;
//import org.apache.commons.cli.Options;
public class UseHCat extends Configured implements Tool {
public static class Map extends Mapper<WritableComparable, HCatRecord, Text, IntWritable> {
String groupname;
@Override
protected void map( WritableComparable key,
HCatRecord value,
org.apache.hadoop.mapreduce.Mapper<WritableComparable, HCatRecord,
Text, IntWritable>.Context context)
throws IOException, InterruptedException {
// The group table from /etc/group has name, 'x', id
groupname = (String) value.get(0);
int id = (Integer) value.get(2);
// Just select and emit the name and ID
context.write(new Text(groupname), new IntWritable(id));
}
}
public static class Reduce extends Reducer<Text, IntWritable,
WritableComparable, HCatRecord> {
protected void reduce( Text key,
java.lang.Iterable<IntWritable> values,
org.apache.hadoop.mapreduce.Reducer<Text, IntWritable,
WritableComparable, HCatRecord>.Context context)
throws IOException, InterruptedException {
// Only expecting one ID per group name
Iterator<IntWritable> iter = values.iterator();
IntWritable iw = iter.next();
int id = iw.get();
// Emit the group name and ID as a record
HCatRecord record = new DefaultHCatRecord(2);
record.set(0, key.toString());
record.set(1, id);
context.write(null, record);
}
}
@SuppressWarnings("deprecation")
public int run(String[] args) throws Exception {
Configuration conf = getConf();
args = new GenericOptionsParser(conf, args).getRemainingArgs();
// Get the input and output table names as arguments
String inputTableName = args[0];
String outputTableName = args[1];
// Assume the default database
String dbName = "hadooppracticedb";
Job job = new Job(conf, "UseHCat");
HCatInputFormat.setInput(job, InputJobInfo.create(dbName,
inputTableName, null));
job.setJarByClass(UseHCat.class);
job.setMapperClass(Map.class);
job.setReducerClass(Reduce.class);
// An HCatalog record as input
job.setInputFormatClass(HCatInputFormat.class);
// Mapper emits a string as key and an integer as value
job.setMapOutputKeyClass(Text.class);
job.setMapOutputValueClass(IntWritable.class);
// Ignore the key for the reducer output; emitting an HCatalog record as value
job.setOutputKeyClass(WritableComparable.class);
job.setOutputValueClass(DefaultHCatRecord.class);
job.setOutputFormatClass(HCatOutputFormat.class);
HCatOutputFormat.setOutput(job, OutputJobInfo.create(dbName,
outputTableName, null));
HCatSchema s = HCatOutputFormat.getTableSchema(job);
System.err.println("INFO: output schema explicitly set for writing:" + s);
HCatOutputFormat.setSchema(job, s);
return (job.waitForCompletion(true) ? 0 : 1);
}
public static void main(String[] args) throws Exception {
int exitCode = ToolRunner.run(new UseHCat(), args);
System.exit(exitCode);
}
}
hadoop jar命令:
hadoop jar Hcat.jar com.otsi.Hcat.UseHCat-files$HCATJAR-libjars${libjars}groupid
我在hive-site.xml中设置了以下属性
hive-site.xml:
<property>
<name>hive.metastore.uris</name>
<value>thrift://localhost:9083</value>
</property>
hive.metastore.uris
thrift://localhost:9083
我在“hadooppracticedb”中创建了两个表组GroupID
请建议。您还没有定义metastore本地属性吗 如果正在运行独立的metastore服务器,则只应设置hive.metastore.uris属性,在这种情况下,需要将hive.metastore.local=false并将hive.metastore.uris设置为旧URI 有关更多详细信息,请参阅本文档:
您好,我正在使用hive-0.13.0..hive.metastore.uris hive连接到其中一个URI,以向远程元存储(URI的逗号分隔列表)hive.metastore.local或远程元存储发出元数据请求(从Hive 0.10开始删除:如果Hive.metastore.uris为空,则假定为本地模式,否则为远程模式..并且我正在2节点群集上运行此示例..Hive-site.xml;Hive.metastore.uristhrift://NameNode:9083
<property>
<name>hive.metastore.uris</name>
<value>thrift://localhost:9083</value>
</property>