GAL-224 取消SSL检测,新增HDFS高可用设置
This commit is contained in:
@@ -22,28 +22,23 @@ public class HdfsUtils {
|
||||
static {
|
||||
Configuration configuration = new Configuration();
|
||||
try {
|
||||
//指定用户
|
||||
//配置hdfs相关信息
|
||||
// configuration.set("fs.defaultFS","hdfs://ns1");
|
||||
// configuration.set("hadoop.proxyuser.root.hosts","*");
|
||||
// configuration.set("hadoop.proxyuser.root.groups","*");
|
||||
// configuration.set("ha.zookeeper.quorum", CommonConfig.HBASE_ZOOKEEPER_QUORUM);
|
||||
// configuration.set("dfs.nameservices","ns1");
|
||||
// configuration.set("dfs.ha.namenodes.ns1","nn1,nn2");
|
||||
// configuration.set("dfs.namenode.rpc-address.ns1.nn1",CommonConfig.HDFS_URI_NS1);
|
||||
// configuration.set("dfs.namenode.rpc-address.ns1.nn2",CommonConfig.HDFS_URI_NS2);
|
||||
// configuration.set("dfs.client.failover.proxy.provider.ns1","org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider");
|
||||
// //创建fileSystem,用于连接hdfs
|
||||
//// fileSystem = FileSystem.get(configuration);
|
||||
configuration.set("fs.defaultFS","hdfs://ns1");
|
||||
configuration.set("hadoop.proxyuser.root.hosts","*");
|
||||
configuration.set("hadoop.proxyuser.root.groups","*");
|
||||
configuration.set("ha.zookeeper.quorum", CommonConfig.HBASE_ZOOKEEPER_QUORUM);
|
||||
configuration.set("dfs.nameservices","ns1");
|
||||
configuration.set("dfs.ha.namenodes.ns1","nn1,nn2");
|
||||
configuration.set("dfs.namenode.rpc-address.ns1.nn1",CommonConfig.HDFS_URI_NS1);
|
||||
configuration.set("dfs.namenode.rpc-address.ns1.nn2",CommonConfig.HDFS_URI_NS2);
|
||||
configuration.set("dfs.client.failover.proxy.provider.ns1","org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider");
|
||||
//指定用户
|
||||
System.setProperty("HADOOP_USER_NAME", CommonConfig.HDFS_USER);
|
||||
//创建fileSystem,用于连接hdfs
|
||||
fileSystem = FileSystem.get(new URI(CommonConfig.HDFS_URI_NS1),configuration);
|
||||
fileSystem = FileSystem.get(configuration);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
catch (URISyntaxException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isExists(String filePath) throws IOException {
|
||||
|
||||
Reference in New Issue
Block a user