public DFSClient(InetSocketAddress address, Configuration conf) throws IOException { this(NameNode.getUri(address), conf); }
public DFSClient(InetSocketAddress address, Configuration conf) throws IOException { this(NameNode.getUri(address), conf); }
/** @deprecated */ public DistributedFileSystem(InetSocketAddress namenode, Configuration conf) throws IOException { initialize(NameNode.getUri(namenode), conf); }
/** @deprecated */ public DistributedFileSystem(InetSocketAddress namenode, Configuration conf) throws IOException { initialize(NameNode.getUri(namenode), conf); }
protected void setRpcServerAddress(Configuration conf, InetSocketAddress rpcAddress) { FileSystem.setDefaultUri(conf, getUri(rpcAddress)); }
protected void setRpcServerAddress(Configuration conf, InetSocketAddress rpcAddress) { FileSystem.setDefaultUri(conf, getUri(rpcAddress)); }
public void initialize(URI uri, Configuration conf) throws IOException { setConf(conf); String host = uri.getHost(); if (host == null) { throw new IOException("Incomplete HDFS URI, no host: "+ uri); } InetSocketAddress namenode = NameNode.getAddress(uri.getAuthority()); this.dfs = new DFSClient(namenode, conf, statistics); this.uri = NameNode.getUri(namenode); this.workingDir = getHomeDirectory(); }
private void execute(String [] args, String namenode) { FsShell shell=new FsShell(); FileSystem fs=null; try { ToolRunner.run(shell, args); fs = FileSystem.get(NameNode.getUri(NameNode.getAddress(namenode)), shell.getConf()); assertTrue("Directory does not get created", fs.isDirectory(new Path("/data"))); fs.delete(new Path("/data"), true); } catch (Exception e) { System.err.println(e.getMessage()); e.printStackTrace(); } finally { if (fs!=null) { try { fs.close(); } catch (IOException ignored) { } } } }
private void init(InetSocketAddress namenodeAddress) throws IOException { this.namenodeAddress = namenodeAddress; this.namenode = createNamenode(namenodeAddress, conf); this.client = DFSClient.createNamenode(namenodeAddress, conf); this.fs = FileSystem.get(NameNode.getUri(namenodeAddress), conf); this.moverExecutor = Executors.newFixedThreadPool(moveThreads); int dispatchThreads = (int)Math.max(1, moveThreads/maxConcurrentMoves); this.dispatcherExecutor = Executors.newFixedThreadPool(dispatchThreads); /* Check if there is another balancer running. * Exit if there is another one running. */ this.out = checkAndMarkRunningBalancer(); if (out == null) { throw new IOException("Another balancer is running"); } // get namespace id LocatedBlocksWithMetaInfo locations = client.openAndFetchMetaInfo(BALANCER_ID_PATH.toString(), 0L, 1L); this.namespaceId = locations.getNamespaceID(); }
public void initialize(URI uri, Configuration conf) throws IOException { super.initialize(uri, conf); setConf(conf); String host = uri.getHost(); if (host == null) { throw new IOException("Incomplete HDFS URI, no host: "+ uri); } InetSocketAddress namenode = NameNode.getAddress(uri.getAuthority()); this.dfs = new DFSClient(namenode, conf, statistics); this.uri = NameNode.getUri(namenode); this.workingDir = getHomeDirectory(); pathValidator = new PathValidator(conf); }
URI nnUri = NameNode.getUri(nn.getNameNodeAddress()); jConf.set(JobContext.JOB_NAMENODES, nnUri + "," + nnUri.toString());
/** * Initialize the server * * @param address hostname:port to bind to * @param conf the configuration */ private void initialize(String address, Configuration conf) throws IOException { InetSocketAddress socAddr = NameNode.getAddress(address); this.supportAppends = conf.getBoolean("dfs.support.append", true); this.handlerCount = conf.getInt("dfs.namenode.handler.count", 10); this.server = RPC.getServer(this, socAddr.getHostName(), socAddr.getPort(), handlerCount, false, conf); // The rpc-server port can be ephemeral... ensure we have the correct info this.nameNodeAddress = this.server.getListenerAddress(); FileSystem.setDefaultUri(conf, getUri(nameNodeAddress)); LOG.info("Namenode up at: " + this.nameNodeAddress); myMetrics = new NameNodeMetrics(conf, this); this.namesystem = new FSNamesystem(this, conf); this.server.start(); //start RPC server this.emptier = new Thread(new Trash(conf).getEmptier(), "Trash Emptier"); this.emptier.setDaemon(true); this.emptier.start(); }
public void startServerForClientRequests() throws IOException { if (this.server == null) { InetSocketAddress socAddr = NameNode.getAddress(getConf()); int handlerCount = getConf().getInt("dfs.namenode.handler.count", 10); // create rpc server this.server = RPC.getServer(this, socAddr.getHostName(), socAddr.getPort(), handlerCount, false, getConf()); // The rpc-server port can be ephemeral... ensure we have the correct info this.serverAddress = this.server.getListenerAddress(); FileSystem.setDefaultUri(getConf(), getUri(serverAddress)); if (this.httpServer != null) { // This means the server is being started once out of safemode // and jetty is initialized already this.httpServer.setAttribute("name.node.address", getNameNodeAddress()); } LOG.info("Namenode up at: " + this.serverAddress); this.server.start(); } }
private void execute(String [] args, String namenode) { FsShell shell=new FsShell(); FileSystem fs=null; try { ToolRunner.run(shell, args); fs = FileSystem.get(NameNode.getUri(NameNode.getAddress(namenode)), shell.getConf()); assertTrue("Directory does not get created", fs.isDirectory(new Path("/data"))); fs.delete(new Path("/data"), true); } catch (Exception e) { System.err.println(e.getMessage()); e.printStackTrace(); } finally { if (fs!=null) { try { fs.close(); } catch (IOException ignored) { } } } }
URI nnUri = NameNode.getUri(nn.getNameNodeAddress()); jobConf.set(JobContext.JOB_NAMENODES, nnUri + "," + nnUri.toString());
/** * Create a {@link NameNode} proxy from the current {@link ServletContext}. */ protected ClientProtocol createNameNodeProxy() throws IOException { ServletContext context = getServletContext(); // if we are running in the Name Node, use it directly rather than via // rpc NameNode nn = NameNodeHttpServer.getNameNodeFromContext(context); if (nn != null) { return nn.getRpcServer(); } InetSocketAddress nnAddr = NameNodeHttpServer.getNameNodeAddressFromContext(context); Configuration conf = new HdfsConfiguration( NameNodeHttpServer.getConfFromContext(context)); return NameNodeProxies.createProxy(conf, NameNode.getUri(nnAddr), ClientProtocol.class).getProxy(); }
/** * Create a {@link NameNode} proxy from the current {@link ServletContext}. */ protected ClientProtocol createNameNodeProxy() throws IOException { ServletContext context = getServletContext(); // if we are running in the Name Node, use it directly rather than via // rpc NameNode nn = NameNodeHttpServer.getNameNodeFromContext(context); if (nn != null) { return nn.getRpcServer(); } InetSocketAddress nnAddr = NameNodeHttpServer.getNameNodeAddressFromContext(context); Configuration conf = new HdfsConfiguration( NameNodeHttpServer.getConfFromContext(context)); return NameNodeProxies.createProxy(conf, NameNode.getUri(nnAddr), ClientProtocol.class).getProxy(); }
try { fs0 = FileSystem.get(NameNode.getUri(nn0.getNameNodeAddress()), conf);