List of usage examples for org.apache.hadoop.hdfs.protocol ClientDatanodeProtocol versionID
long versionID
To view the source code for org.apache.hadoop.hdfs.protocol ClientDatanodeProtocol versionID.
Click Source Link
From source file:com.splunk.shuttl.prototype.symlink.HadoopFileLocationPrototypeTest.java
License:Apache License
/** Create {@link ClientDatanodeProtocol} proxy using kerberos ticket */ public static ClientDatanodeProtocol createClientDatanodeProtocolProxy(DatanodeID datanodeid, Configuration conf, int socketTimeout) throws IOException { InetSocketAddress addr = NetUtils.createSocketAddr(datanodeid.getHost() + ":" + datanodeid.getIpcPort()); if (ClientDatanodeProtocol.LOG.isDebugEnabled()) { ClientDatanodeProtocol.LOG.info("ClientDatanodeProtocol addr=" + addr); }//from w w w.j a va2 s. c o m return (ClientDatanodeProtocol) RPC.getProxy(ClientDatanodeProtocol.class, ClientDatanodeProtocol.versionID, addr, conf, NetUtils.getDefaultSocketFactory(conf), socketTimeout); }
From source file:common.DataNode.java
License:Apache License
/** {@inheritDoc} */ public long getProtocolVersion(String protocol, long clientVersion) throws IOException { if (protocol.equals(InterDatanodeProtocol.class.getName())) { return InterDatanodeProtocol.versionID; } else if (protocol.equals(ClientDatanodeProtocol.class.getName())) { return ClientDatanodeProtocol.versionID; }/*from w w w .ja v a2 s . c o m*/ throw new IOException("Unknown protocol to " + getClass().getSimpleName() + ": " + protocol); }
From source file:org.cstor.cproc.cloudComputingFramework.CProcFramework.java
License:Apache License
public static void main(String argv[]) throws Exception { LOG.info("CProcFramework version for hadoop-0.20.2-patch : 32"); //GCThreadGC/* w w w .j a v a 2s .com*/ Thread th = new Thread(new GCThread()); th.start(); //LOG.info("CProcFramework [NameNode IP:Port]"); StringUtils.startupShutdownMessage(CProcFramework.class, argv, LOG); //hdfs-site.xml,core-site.xml CProcConfiguration cprocConf = CProcConfiguration.getCProcConfiguration(); RpcConfiguration rpcConf = RpcConfiguration.getRpcConfiguration(); setParamToRpcConf(cprocConf, rpcConf); CProcFramework cpf = null; ClientProtocol nameNode = null; ClientDatanodeProtocol dataNode = null; InetSocketAddress dataNodeAddr = null; InetSocketAddress nameNodeAddr = null; try { boolean isNN = true; //LOG.info("conf.get(\"fs.default.name\") == " + conf.get("cProc.name.") ); //wzt ??? ?? net0 192.168.139.21 9000 if (argv.length >= 3) { network = argv[0]; namenodeAddress = argv[1]; port = argv[2]; } else { LOG.info("CProcFramework [network adapter] [namenode Address]"); System.exit(0); } LOG.info("network = " + network); try { nameNodeAddr = NetUtils.createSocketAddr(namenodeAddress); } catch (IllegalArgumentException e) { //nameNodeAddr = NetUtils.createSocketAddr(argv[0]); } LOG.info("NameNodeAddr = " + nameNodeAddr); //-----------------------get all DN and get conf of NN---------------------------------- ArrayList<String> DNIP = new ArrayList<String>(); // Configuration confInFunc = new Configuration(); nameNode = (ClientProtocol) RPC.getProxy(ClientProtocol.class, ClientProtocol.versionID, nameNodeAddr, rpcConf, NetUtils.getSocketFactory(rpcConf, ClientProtocol.class)); DatanodeDescriptor[] dds = nameNode.getAllDatanode(); // LOG.info("=========="); for (DatanodeDescriptor dd : dds) { LOG.info(dd.getHost()); //LOG.info(dd.getHostName()); //LOG.info(dd.getDatanodeReport()); DNIP.add(dd.getHost()); } //LOG.info("=========="); //conf = nameNode.getConfiguration(); setParamToCprocConf(nameNode.getConfiguration(), rpcConf); LOG.info("getHostIP.getLocalIP() = " + getHostIPcProc.getLocalIP(network)); //-----------------------if this node is a DN get conf---------------------------------- if (DNIP.contains(getHostIPcProc.getLocalIP(network))) { dataNodeAddr = NetUtils .createSocketAddr("127.0.0.1:" + rpcConf.get("dfs.datanode.ipc.address").split(":")[1]); dataNode = (ClientDatanodeProtocol) RPC.getProxy(ClientDatanodeProtocol.class, ClientDatanodeProtocol.versionID, dataNodeAddr, rpcConf, NetUtils.getSocketFactory(rpcConf, ClientDatanodeProtocol.class)); //conf = dataNode.getConfiguration(); LOG.info("This is DataNode!!"); isNN = false; } else { LOG.info("This is NameNode!!"); isNN = true; } cpf = createCProcFramework(nameNode, dataNode, cprocConf, rpcConf, isNN, nameNodeAddr); cpf.waitForStop(); } catch (Throwable e) { LOG.error(StringUtils.stringifyException(e)); System.exit(-1); } finally { //20131210RPC // if(nameNode != null){ // RPC.stopProxy(nameNode); // } // if(dataNode != null){ // RPC.stopProxy(dataNode); // } } }