不多说,直接上代码。
代码
1 package zhouls.bigdata.myWholeHadoop.RPC.rpc1; 2 3 import java.io.IOException; 4 import java.net.InetSocketAddress; 5 6 import org.apache.hadoop.conf.Configuration; 7 import org.apache.hadoop.ipc.RPC; 8 9 public class LoginController {10 public static void main(String[] args) throws IOException {11 LoginServiceinterface proxy = RPC.getProxy(LoginServiceinterface.class, 1L, new InetSocketAddress("HadoopMaster", 10000), new Configuration());12 String result = proxy.login("angelababy","123456");13 System.out.println(result);14 }15 }
1 package zhouls.bigdata.myWholeHadoop.RPC.rpc1;2 3 public interface LoginServiceinterface {4 public static final long versionID=1L;5 public String login(String username,String password);6 }
fs.default.name hdfs://HadoopMaster:9000 The name of the default file system, using 9000 port. hadoop.tmp.dir /tmp A base for other temporary directories.
dfs.namenode.rpc-address HadoopMaster:9000 dfs.replication 2 Set to 1 for pseudo-distributed mode,Set to 2 for distributed mode,Set to 3 for distributed mode. dfs.namenode.http-address HadoopMaster:50070