// 生成key, 都不輸入密碼 ssh-keygen -t rsa // 因而在用戶主目錄下會有.ssh/文件夾生成, 文件有: id_rsa id_rsa.pub 將三臺機器的id_rsa.pub的內容合併到一個authorized_keys文件,並複製到三臺機器用戶主目錄/.ssh/下。注意, Centos默認沒有啓動ssh無密登陸,去掉/etc/ssh/sshd_config其中3行的註釋:
完成後就能夠無密ssh了,如: html
//1. hadoop-env.sh中添加JAVA_HOME, 如: # The java implementation to use. export JAVA_HOME=/usr/java/jdk1.7.0_45 //2. core-site.xml(tmp目錄需手動建立): <configuration> <property> <name>hadoop.tmp.dir</name> <value>/home/hadoop/tmp/hadoop-${user.name}</value> </property> <property> <name>fs.default.name</name> <value>hdfs://hadoopmaster:9000</value> </property> </configuration> //3. mapred-site.xml <configuration> <property> <name>mapred.job.tracker</name> <value>hadoopmaster:9001</value> </property> </configuration> //4. hdfs-site.xml <configuration> <property> <name>dfs.replication</name> <value>2</value> </property> </configuration> //5. slaves hadoopslave1 hadoopslave2
// 配置yarn-site.xml <configuration> <property> <name>yarn.resourcemanager.address</name> <value>hadoopmaster:8080</value> </property> <property> <name>yarn.resourcemanager.scheduler.address</name> <value>hadoopmaster:8081</value> </property> <property> <name>yarn.resourcemanager.resource-tracker.address</name> <value>hadoopmaster:8082</value> </property> <property> <name>yarn.nodemanager.resource.memory-mb</name> <value>10240</value> </property> <property> <name>yarn.nodemanager.remote-app-log-dir</name> <value>${hadoop.tmp.dir}/nodemanager/remote</value> </property> <property> <name>yarn.nodemanager.log-dirs</name> <value>${hadoop.tmp.dir}/nodemanager/logs</value> </property> <property> <name>yarn.nodemanager.aux-services</name> <value>mapreduce_shuffle</value> </property> </configuration>
scp -r hadoop-2.2.0 hadoop@hadoopslave1:/home/hadoop scp -r hadoop-2.2.0 hadoop@hadoopslave2:/home/hadoop
hdfs namenode -format
start-dfs.sh start-yarn.sh