$ vim \/etc\/profile \u6700\u540e\u9762\u8ffd\u52a0\u4ee5\u4e0b\u5185\u5bb9\n<\/code><\/pre>\n#java\nexport JAVA_HOME=\/software\/jdk1.8.0_271\nexport PATH=$JAVA_HOME\/bin:$PATH\nexport CLASSPATH=.:$JAVA_HOME\/lib\/dt.jar:$JAVA_HOME\/lib\/tools.jar\n\n#hadoop\nexport HADOOP_HOME=\/software\/hadoop-3.3.0\nexport PATH=$PATH:$HADOOP_HOME\/bin\nexport PATH=$PATH:$HADOOP_HOME\/sbin\nexport HADOOP_OPTS="-Djava.library.path=$HADOOP_HOME\/lib:$HADOOP_HOME\/lib\/native"\n#zookeeper\nexport ZOOKEEPER_HOME=\/software\/apache-zookeeper-3.7.0-bin\nexport PATH=$PATH:$ZOOKEEPER_HOME\/bin\n#\u811a\u672c\nexport PATH=\/root:$PATH\n<\/code><\/pre>\n\n\u7f16\u5199\u4e24\u4e2a\u5c0f\u811a\u672c\uff0c\u7528\u4e8e\u540e\u7eed\u540c\u6b65\u6587\u4ef6\uff0c\u67e5\u770b\u8fdb\u7a0b<\/li>\n<\/ul>\n$ cd \/root\n$ vim xsync\n\n#!\/bin\/bash\n# \u5224\u65ad\u53c2\u6570\u4e2a\u6570\nif [ $# -lt 1 ]\nthen\n echo "\u6ca1\u6709\u4f20\u9012\u53c2\u6570\uff01"\n exit;\nfi\n\n# \u904d\u5386\u7fa4\u96c6\u6240\u6709\u673a\u5668\nfor host in 64.115.3.30 64.115.3.40 64.115.3.50\ndo\n echo "============================= $host ==========================="\n #\u904d\u5386\u6240\u6709\u76ee\u5f55\uff0c\u6328\u4e2a\u53d1\u9001\n for file in $@\n do\n #\u5224\u65ad\u6587\u4ef6\u662f\u5426\u5b58\u5728\n if [ -e $file ]\n then\n #\u83b7\u53d6\u7236\u76ee\u5f55\n pdir=$( cd -P $(dirname $file ); pwd )\n #\u83b7\u53d6\u5f53\u524d\u6587\u4ef6\u7684\u540d\u79f0\n fname=$(basename $file)\n ssh $host "mkdir -p $pdir"\n rsync -av $pdir\/$fname $host:$pdir\n else\n echo "$file \u4e0d\u5b58\u5728\uff01"\n fi\n done\ndone\n<\/code><\/pre>\n$ vim jpsall\n\n#!\/bin\/bash\nfor host in hadoop30 hadoop40 hadoop50\ndo\n echo =============== $host ===============\n ssh $host \/software\/jdk1.8.0_271\/bin\/jps\ndone\n<\/code><\/pre>\n <\/p>\n
#\u52a0\u4e2a\u6267\u884c\u6743\u9650\n$ chmod +x xsync\n<\/code><\/pre>\n\u4e09\u3001\u4fee\u6539Hadoop \u7fa4\u96c6\u914d\u7f6e<\/h2>\n\n \u6bcf\u9879\u914d\u7f6e\u57fa\u672c\u90fd\u6709\u6ce8\u91ca\uff0c\u5f88\u597d\u7406\u89e3\u3002<\/p>\n<\/blockquote>\n
\n\n\u914d\u7f6ehadoop.env.sh<\/p>\n
#\u8bbe\u7f6e\u4e3aJava\u5b89\u88c5\u7684\u6839\u76ee\u5f55\nexport JAVA_HOME=\/software\/jdk1.8.0_271\nexport HADOOP_PID_DIR=\/software\/hadoop-3.3.0\/tmp\n\n#\u5c06\u8fd0\u884c\u7528\u6237\u8bbe\u7f6e\u4e3aroot \u7528\u6237\nexport HDFS_NAMENODE_USER=root\nexport HDFS_DATANODE_USER=root\nexport HDFS_SECONDARYNAMENODE_USER=root\nexport YARN_RESOURCEMANAGER_USER=root\nexport YARN_NODEMANAGER_USER=root\nexport HDFS_JOURNALNODE_USER=root\nexport HDFS_ZKFC_USER=root\n<\/code><\/pre>\n<\/li>\n\n\u914d\u7f6ehdfs.site.xml<\/p>\n
<?xml version="1.0" encoding="UTF-8"?>\n<?xml-stylesheet type="text\/xsl" href="configuration.xsl"?>\n<!--\n Licensed under the Apache License, Version 2.0 (the "License");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http:\/\/www.apache.org\/licenses\/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an "AS IS" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License. See accompanying LICENSE file.\n-->\n\n<!-- Put site-specific property overrides in this file. -->\n\n<configuration>\n <!--\u526f\u672c\u6570 \u9ed8\u8ba4\u4e3a 3 -->\n <property>\n <name>dfs.replication<\/name>\n <value>3<\/value>\n <\/property>\n <!-- hdfs \u96c6\u7fa4\u540d\u79f0-->\n <property>\n <name>dfs.nameservices<\/name>\n <value>mycluster<\/value>\n <\/property>\n <!--\u96c6\u7fa4\u5185namenode\u914d\u7f6e-->\n <property>\n <name>dfs.ha.namenodes.mycluster<\/name>\n <value>nn30,nn40,nn50<\/value>\n <\/property>\n <!-- namenode rpc \u901a\u4fe1\u7aef\u53e3 -->\n <property>\n <name>dfs.namenode.rpc-address.mycluster.nn30<\/name>\n <value>hadoop30:8020<\/value>\n <\/property>\n <property>\n <name>dfs.namenode.rpc-address.mycluster.nn40<\/name>\n <value>hadoop40:8020<\/value>\n <\/property>\n <property>\n <name>dfs.namenode.rpc-address.mycluster.nn50<\/name>\n <value>hadoop50:8020<\/value>\n <\/property>\n <!-- namenode WEB \u7aef\u914d\u7f6e -->\n <property>\n <name>dfs.namenode.http-address.mycluster.nn1<\/name>\n <value>hadoop30:9870<\/value>\n <\/property>\n <property>\n <name>dfs.namenode.http-address.mycluster.nn2<\/name>\n <value>hadoop40:9870<\/value>\n <\/property>\n <property>\n <name>dfs.namenode.http-address.mycluster.nn3<\/name>\n <value>hadoop50:9870<\/value>\n <\/property>\n <!-- \u6307\u5b9aNameNode\u5143\u6570\u636e\u5728JournalNode\u4e0a\u7684\u5b58\u653e\u4f4d\u7f6e -->\n <property>\n <name>dfs.namenode.shared.edits.dir<\/name>\n <value>qjournal:\/\/hadoop30:8485;hadoop40:8485;hadoop50:8485\/mycluster<\/value>\n <\/property>\n <!-- \u58f0\u660ejournalnode\u670d\u52a1\u5668\u5b58\u50a8\u76ee\u5f55-->\n <property>\n <name>dfs.journalnode.edits.dir<\/name>\n <value>\/data\/hadoop\/journalnode<\/value>\n <\/property>\n <!-- HDFS\u5ba2\u6237\u7aef\u7528\u4e8e\u8054\u7cfbActive NameNode\u7684Java\u7c7b -->\n <property>\n <name>dfs.client.failover.proxy.provider.mycluster<\/name>\n <value>org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider<\/value>\n <\/property>\n <!-- \u5728\u6545\u969c\u8f6c\u79fb\u671f\u95f4\u5c06\u7528\u4e8e\u9694\u79bbActive NameNode\u7684\u811a\u672c\u6216Java\u7c7b\u7684\u5217\u8868 -->\n <property>\n <name>dfs.ha.fencing.methods<\/name>\n <value>sshfence<\/value> <!--SSH\u5230Active NameNode\u5e76\u7ec8\u6b62\u8fdb\u7a0b\uff0c\u540c\u4e00\u65f6\u523b\u53ea\u80fd\u6709\u4e00\u53f0\u670d\u52a1\u5bf9\u5916\u76f8\u5e94-->\n <\/property>\n <property>\n <name>dfs.ha.fencing.ssh.private-key-files<\/name>\n <value>\/root\/.ssh\/id_rsa<\/value> <!-- \u7528\u4e8essh\u767b\u5f55\u7684\u79c1\u94a5 -->\n <\/property> \n <!-- \u542f\u7528\u6545\u969c\u81ea\u52a8\u8f6c\u79fb -->\n <property>\n <name>dfs.ha.automatic-failover.enabled<\/name>\n <value>true<\/value>\n <\/property>\n\n <!-- \u767d\u540d\u5355\n <property>\n <name>dfs.hosts<\/name>\n <value>\/software\/hadoop-3.3.0\/etc\/hadoop\/whitelist<\/value>\n <\/property>\n -->\n <!-- \u9ed1\u540d\u5355 \n <property>\n <name>dfs.hosts.exclude<\/name>\n <value>\/software\/hadoop-3.3.0\/etc\/hadoop\/blacklist<\/value>\n <\/property>\n -->\n<\/configuration>\n<\/code><\/pre>\n<\/li>\n\n\u914d\u7f6ecore.site.xnl<\/p>\n
<?xml version="1.0" encoding="UTF-8"?>\n<?xml-stylesheet type="text\/xsl" href="configuration.xsl"?>\n<!--\n Licensed under the Apache License, Version 2.0 (the "License");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http:\/\/www.apache.org\/licenses\/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an "AS IS" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License. See accompanying LICENSE file.\n-->\n\n<!-- Put site-specific property overrides in this file. -->\n\n<configuration>\n <!--\u5b9a\u4e49namenode\u5730\u5740-->\n <property>\n <name>fs.defaultFS<\/name>\n <value>hdfs:\/\/mycluster<\/value>\n <\/property>\n <!-- \u914d\u7f6eZookeeper \u5730\u5740 -->\n <property>\n <name>ha.zookeeper.quorum<\/name>\n <value>hadoop30:2181,hadoop40:2181,hadoop50:2181<\/value>\n <\/property>\n <!--\u4fee\u6539hadoop\u5b58\u50a8\u6570\u636e\u7684\u9ed8\u8ba4\u4f4d\u7f6e-->\n <property>\n <name>hadoop.tmp.dir<\/name>\n <value>\/data\/hadoop<\/value>\n <\/property> \n <!-- \u542f\u7528\u56de\u6536\u7ad9\uff0c\u5783\u573e\u56de\u6536\u65f6\u95f4\u4e3a5\u5206\u949f -->\n <property>\n <name>fs.trash.interval<\/name>\n <value>5<\/value>\n <\/property>\n <!-- \u5f53\u524d\u7528\u6237\u5168\u8bbe\u7f6e\u6210root -->\n <property>\n <name>hadoop.http.staticuser.user<\/name>\n <value>root<\/value>\n <\/property>\n\n <!-- \u4e0d\u5f00\u542f\u6743\u9650\u68c0\u67e5 -->\n <property>\n <name>dfs.permissions.enabled<\/name>\n <value>false<\/value>\n <\/property>\n<\/configuration>\n<\/code><\/pre>\n<\/li>\n\n\u914d\u7f6eyarn.site.xml<\/p>\n
<?xml version="1.0"?>\n<!--\n Licensed under the Apache License, Version 2.0 (the "License");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http:\/\/www.apache.org\/licenses\/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an "AS IS" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License. See accompanying LICENSE file.\n-->\n<!-- Site specific YARN configuration properties -->\n<configuration>\n <!--\u6307\u5b9aMR\u8d70shuffle\u534f\u8bae -->\n <property>\n <name>yarn.nodemanager.aux-services<\/name>\n <value>mapreduce_shuffle<\/value>\n <\/property>\n <!-- yarn ha \u542f\u52a8 -->\n <property>\n <name>yarn.resourcemanager.ha.enabled<\/name>\n <value>true<\/value>\n <\/property>\n <property>\n <name>yarn.resourcemanager.cluster-id<\/name>\n <value>yarn-cluster<\/value>\n <\/property>\n <property>\n <name>yarn.resourcemanager.ha.rm-ids<\/name>\n <value>rm1,rm2<\/value>\n <\/property>\n <property>\n <name>yarn.resourcemanager.hostname.rm1<\/name>\n <value>hadoop40<\/value>\n <\/property>\n <property>\n <name>yarn.resourcemanager.hostname.rm2<\/name>\n <value>hadoop50<\/value>\n <\/property>\n <!-- yarn web \u7aef\u5730\u5740\u7aef\u53e3 -->\n <property>\n <name>yarn.resourcemanager.webapp.address.rm1<\/name>\n <value>hadoop40:8088<\/value>\n <\/property>\n <property>\n <name>yarn.resourcemanager.webapp.address.rm2<\/name>\n <value>hadoop50:8088<\/value>\n <\/property>\n <!-- Zookeeper \u5730\u5740\u7aef\u53e3 -->\n <property>\n <name>hadoop.zk.address<\/name>\n <value>hadoop30:2181,hadoop40:2181,hadoop50:2181<\/value>\n <\/property>\n\n <!-- \u4e0b\u9762\u914d\u7f6e\u90fd\u662f\u4f18\u5316\u9879\uff0c\u6839\u636e\u4e2a\u4eba\u670d\u52a1\u5668\u914d\u7f6e\u6765\u4fee\u6539\uff0c\u53ea\u505aHA\u5b9e\u9a8c\u7684\u8bdd\u53ef\u4ee5\u4e0d\u52a0\u3002 -->\n\n <!-- \u9009\u62e9\u8c03\u5ea6\u5668\uff0c\u9ed8\u8ba4\u5bb9\u91cf -->\n <property>\n <description>The class to use as the resource scheduler.<\/description>\n <name>yarn.resourcemanager.scheduler.class<\/name>\n <value>org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler<\/value>\n <\/property>\n <!-- ResourceManager \u5904\u7406\u8c03\u5ea6\u5668\u8bf7\u6c42\u7684\u7ebf\u7a0b\u6570\u91cf,\u9ed8\u8ba4 50\uff1b\u5982\u679c\u63d0\u4ea4\u7684\u4efb\u52a1\u6570\u5927\u4e8e 50\uff0c\u53ef\u4ee5\n \u589e\u52a0\u8be5\u503c\uff0c\u4f46\u662f\u4e0d\u80fd\u8d85\u8fc7 3 \u53f0 * 4 \u7ebf\u7a0b = 12 \u7ebf\u7a0b\uff08\u53bb\u9664\u5176\u4ed6\u5e94\u7528\u7a0b\u5e8f\u5b9e\u9645\u4e0d\u80fd\u8d85\u8fc7 8\uff09 -->\n <property>\n <description>Number of threads to handle scheduler interface.<\/description>\n <name>yarn.resourcemanager.scheduler.client.thread-count<\/name>\n <value>8<\/value>\n <\/property>\n\n <!-- \u662f\u5426\u8ba9 yarn \u81ea\u52a8\u68c0\u6d4b\u786c\u4ef6\u8fdb\u884c\u914d\u7f6e\uff0c\u9ed8\u8ba4\u662f false\uff0c\u5982\u679c\u8be5\u8282\u70b9\u6709\u5f88\u591a\u5176\u4ed6\u5e94\u7528\u7a0b\u5e8f\uff0c\u5efa\u8bae\n \u624b\u52a8\u914d\u7f6e\u3002\u5982\u679c\u8be5\u8282\u70b9\u6ca1\u6709\u5176\u4ed6\u5e94\u7528\u7a0b\u5e8f\uff0c\u53ef\u4ee5\u91c7\u7528\u81ea\u52a8 -->\n <property>\n <description>Enable auto-detection of node capabilities such as memory and CPU.<\/description>\n <name>yarn.nodemanager.resource.detect-hardware-capabilities<\/name>\n <value>false<\/value>\n <\/property>\n <!-- \u662f\u5426\u5c06\u865a\u62df\u6838\u6570\u5f53\u4f5c CPU \u6838\u6570\uff0c\u9ed8\u8ba4\u662f false\uff0c\u91c7\u7528\u7269\u7406 CPU \u6838\u6570 -->\n <property>\n <description>Flag to determine if logical processors(such as\n hyperthreads) should be counted as cores. Only applicable on Linux\n when yarn.nodemanager.resource.cpu-vcores is set to -1 and\n yarn.nodemanager.resource.detect-hardware-capabilities is true.\n <\/description>\n <name>yarn.nodemanager.resource.count-logical-processors-as-cores<\/name>\n <value>false<\/value>\n <\/property>\n <!-- \u865a\u62df\u6838\u6570\u548c\u7269\u7406\u6838\u6570\u4e58\u6570\uff0c\u9ed8\u8ba4\u662f 1.0 -->\n <property>\n <description>Multiplier to determine how to convert phyiscal cores to\n vcores. This value is used if yarn.nodemanager.resource.cpu-vcores\n is set to -1(which implies auto-calculate vcores) and\n yarn.nodemanager.resource.detect-hardware-capabilities is set to true. \n The number of vcores will be calculated as number of CPUs * multiplier.\n <\/description>\n <name>yarn.nodemanager.resource.pcores-vcores-multiplier<\/name>\n <value>1.0<\/value>\n <\/property>\n <!-- NodeManager \u4f7f\u7528\u5185\u5b58\u6570\uff0c\u9ed8\u8ba4 8G\uff0c\u4fee\u6539\u4e3a 4G \u5185\u5b58 -->\n <property>\n <description>Amount of physical memory, in MB, that can be allocated \n for containers. If set to -1 and\n yarn.nodemanager.resource.detect-hardware-capabilities is true, it is\n automatically calculated(in case of Windows and Linux).\n In other cases, the default is 8192MB.\n <\/description>\n <name>yarn.nodemanager.resource.memory-mb<\/name>\n <value>4096<\/value>\n <\/property>\n <!-- nodemanager \u7684 CPU \u6838\u6570\uff0c\u4e0d\u6309\u7167\u786c\u4ef6\u73af\u5883\u81ea\u52a8\u8bbe\u5b9a\u65f6\u9ed8\u8ba4\u662f 8 \u4e2a\uff0c\u4fee\u6539\u4e3a 4 \u4e2a -->\n <property>\n <description>Number of vcores that can be allocated\n for containers. This is used by the RM scheduler when allocating\n resources for containers. This is not used to limit the number of\n CPUs used by YARN containers. If it is set to -1 and\n yarn.nodemanager.resource.detect-hardware-capabilities is true, it is\n automatically determined from the hardware in case of Windows and Linux.\n In other cases, number of vcores is 8 by default.<\/description>\n <name>yarn.nodemanager.resource.cpu-vcores<\/name>\n <value>4<\/value>\n <\/property>\n <!-- \u5bb9\u5668\u6700\u5c0f\u5185\u5b58\uff0c\u9ed8\u8ba4 1G -->\n <property>\n <description>The minimum allocation for every container request at the \n RM in MBs. Memory requests lower than this will be set to the value of \n this property. Additionally, a node manager that is configured to have \n less memory than this value will be shut down by the resource manager.\n <\/description>\n <name>yarn.scheduler.minimum-allocation-mb<\/name>\n <value>1024<\/value>\n <\/property>\n <!-- \u5bb9\u5668\u6700\u5927\u5185\u5b58\uff0c\u9ed8\u8ba4 8G\uff0c\u4fee\u6539\u4e3a 2G -->\n <property>\n <description>The maximum allocation for every container request at the \n RM in MBs. Memory requests higher than this will throw an\n InvalidResourceRequestException.\n <\/description>\n <name>yarn.scheduler.maximum-allocation-mb<\/name>\n <value>2048<\/value>\n <\/property>\n <!-- \u5bb9\u5668\u6700\u5c0f CPU \u6838\u6570\uff0c\u9ed8\u8ba4 1 \u4e2a -->\n <property>\n <description>The minimum allocation for every container request at the \n RM in terms of virtual CPU cores. Requests lower than this will be set to \n the value of this property. Additionally, a node manager that is configured \n to have fewer virtual cores than this value will be shut down by the \n resource manager.\n <\/description>\n <name>yarn.scheduler.minimum-allocation-vcores<\/name>\n <value>1<\/value>\n <\/property>\n <!-- \u5bb9\u5668\u6700\u5927 CPU \u6838\u6570\uff0c\u9ed8\u8ba4 4 \u4e2a\uff0c\u4fee\u6539\u4e3a 2 \u4e2a -->\n <property>\n <description>The maximum allocation for every container request at the \n RM in terms of virtual CPU cores. Requests higher than this will throw an\n InvalidResourceRequestException.<\/description>\n <name>yarn.scheduler.maximum-allocation-vcores<\/name>\n <value>2<\/value>\n <\/property>\n <!-- \u865a\u62df\u5185\u5b58\u68c0\u67e5\uff0c\u9ed8\u8ba4\u6253\u5f00\uff0c\u4fee\u6539\u4e3a\u5173\u95ed -->\n <property>\n <description>Whether virtual memory limits will be enforced for\n containers.<\/description>\n <name>yarn.nodemanager.vmem-check-enabled<\/name>\n <value>false<\/value>\n <\/property>\n <!-- \u865a\u62df\u5185\u5b58\u548c\u7269\u7406\u5185\u5b58\u8bbe\u7f6e\u6bd4\u4f8b,\u9ed8\u8ba4 2.1 -->\n <property>\n <description>Ratio between virtual memory to physical memory when\n setting memory limits for containers. Container allocations are\n expressed in terms of physical memory, and virtual memory usage is \n allowed to exceed this allocation by this ratio.\n <\/description>\n <name>yarn.nodemanager.vmem-pmem-ratio<\/name>\n <value>2.1<\/value>\n <\/property>\n <!-- \u914d\u7f6e\u6700\u5927\u4f18\u5148\u7ea7 -->\n <property>\n <name>yarn.cluster.max-application-priority<\/name>\n <value>5<\/value>\n <\/property>\n\n<\/configuration>\n<\/code><\/pre>\n<\/li>\n\n\u914d\u7f6emapred.site.xml<\/p>\n
<?xml version="1.0"?>\n<?xml-stylesheet type="text\/xsl" href="configuration.xsl"?>\n<!--\n Licensed under the Apache License, Version 2.0 (the "License");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http:\/\/www.apache.org\/licenses\/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an "AS IS" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License. See accompanying LICENSE file.\n-->\n\n<!-- Put site-specific property overrides in this file. -->\n\n<configuration>\n <!--\u6307\u5b9aMapReduce \u7a0b\u5e8f\u8fd0\u884c\u5728Yarn \u4e0a -->\n <property>\n <name>mapreduce.framework.name<\/name>\n <value>yarn<\/value>\n <\/property>\n <!--\u7ee7\u627f\u73af\u5883\u53d8\u91cf -->\n <property>\n <name>yarn.app.mapreduce.am.env<\/name>\n <value>HADOOP_MAPRED_HOME=${HADOOP_HOME}<\/value>\n <\/property>\n <property>\n <name>mapreduce.map.env<\/name>\n <value>HADOOP_MAPRED_HOME=${HADOOP_HOME}<\/value>\n <\/property>\n <property>\n <name>mapreduce.reduce.env<\/name>\n <value>HADOOP_MAPRED_HOME=${HADOOP_HOME}<\/value>\n <\/property>\n <!--\u6307\u5b9aJob\u5386\u53f2\u670d\u52a1\u5668\u5730\u5740-->\n <property>\n <name>mapreduce.jobhistory.address<\/name>\n <value>hadoop50:10020<\/value>\n <\/property>\n <!--\u6307\u5b9aJob\u5386\u53f2\u670d\u52a1\u5668WEB\u7aef\u5730\u5740 http-->\n <property>\n <name>mapreduce.jobhistory.webapp.address<\/name>\n <value>hadoop50:19888<\/value>\n <\/property>\n<\/configuration>\n<\/code><\/pre>\n<\/li>\n\n\u914d\u7f6eworkers \u65e7\u7248\u672c\u53eb slave<\/p>\n
hadoop30\nhadoop40\nhadoop50\n<\/code><\/pre>\n <\/p>\n<\/li>\n<\/ol>\n
\u56db\u3001\u521d\u59cb\u5316\u542f\u52a8\u96c6\u7fa4<\/h2>\n\n\n\u521b\u5efa\u6570\u636e\u76ee\u5f55<\/p>\n
mkdir -p \/data\/hadoop\n<\/code><\/pre>\n<\/li>\n\n \u590d\u5236hadoop\u5230\u5176\u4f59\u673a\u5668<\/p>\n
\n\u914d\u7f6e\u6587\u4ef6\u4fee\u6539\u597d\u4e4b\u540e\uff0c\u53ef\u4ee5\u7528\u7f16\u5199\u597d\u7684xsync<\/strong> \u811a\u672c\uff0c\u5c06hadoop \u590d\u5236\u5230\u5176\u4f59\u673a\u5668\u3002<\/p>\n<\/blockquote>\n#\u540c\u6b65Hadoop\u914d\u7f6e\nxsync \/software\/hadoop-3.3.0\n#\u540c\u6b65Hadoop\u6570\u636e\u76ee\u5f55\nxsync \/data\/hadoop\n<\/code><\/pre>\n<\/li>\n\n\u542f\u52a8JournalNode<\/p>\n
# hadoop30 \u4e0b\u542f\u52a8 journalnode\nhadoop-daemon.sh start journalnode\n\n# hadoop40 \u4e0b\u542f\u52a8 journalnode\nhadoop-daemon.sh start journalnode\n\n# hadoop50 \u4e0b\u542f\u52a8 journalnode\nhadoop-daemon.sh start journalnode\n<\/code><\/pre>\n <\/p>\n<\/li>\n
\n\u9009\u62e9\u4e00\u4e2a Namenode \u505a\u683c\u5f0f\u5316<\/h4>\n# \u683c\u5f0f\u5316 hadoop30 \u4e0b\u7684 namenode\nhdfs namenode -format\n<\/code><\/pre>\n <\/p>\n<\/li>\n
\n\u542f\u52a8\u683c\u5f0f\u5316\u540e\u7684 Namenode<\/h4>\n# \u542f\u52a8 hadoop30 \u4e0b\u7684 namenode\nhadoop-daemon.sh start namenode\n<\/code><\/pre>\n <\/p>\n<\/li>\n
\n\u53e6\u5916\u51e0\u53f0 Namenode \u540c\u6b65\u5143\u6570\u636e<\/h4>\n# hadoop40 \u540c\u6b65namenode\u5143\u6570\u636e\nhdfs namenode -bootstrapStandby\n\n# hadoop50 \u540c\u6b65namenode\u5143\u6570\u636e\nhdfs namenode -bootstrapStandby\n<\/code><\/pre>\n <\/p>\n<\/li>\n
\n \u683c\u5f0f\u5316 Zookeeper<\/h4>\n# hadoop30 \u6267\u884c\u683c\u5f0f\u5316 ZooKeeper \u96c6\u7fa4\nhdfs zkfc -formatZK\n<\/code><\/pre>\n <\/p>\n<\/li>\n
\n\u542f\u52a8Hadoop HA \u96c6\u7fa4<\/p>\n
start-dfs.sh\nstart-yarn.sh\n<\/code><\/pre>\n <\/p>\n<\/li>\n
\n\u542f\u52a8\u5386\u53f2\u670d\u52a1\u5668<\/p>\n
#hadoop50 \u670d\u52a1\u5668\u6267\u884c\nmapred --daemon start historyserver\n<\/code><\/pre>\n <\/p>\n<\/li>\n<\/ol>\n
\u4e94\u3001Web\u754c\u9762<\/h2>\n Hadoop\u96c6\u7fa4\u542f\u52a8\u5e76\u8fd0\u884c\u540e\uff0c\u5982\u4e0b\u6240\u8ff0\u68c0\u67e5\u7ec4\u4ef6\u7684Web UI\uff1a<\/p>\n\n\n\n\n\u5b88\u62a4\u8fdb\u7a0b<\/th>\n \u7f51\u9875\u754c\u9762<\/th>\n \u7b14\u8bb0<\/th>\n<\/tr>\n<\/thead>\n \n\nNameNode<\/td>\n http\uff1a\/\/ nn_host\uff1aport \/<\/a><\/td>\n \u9ed8\u8ba4\u7684HTTP\u7aef\u53e3\u662f9870\u3002<\/td>\n<\/tr>\n \nResourceManager<\/td>\n http\uff1a\/\/ rm_host\uff1aport \/<\/a><\/td>\n \u9ed8\u8ba4\u7684HTTP\u7aef\u53e3\u4e3a8088\u3002<\/td>\n<\/tr>\n \nMapReduce JobHistory Server<\/td>\n http\uff1a\/\/ jhs_host\uff1aport \/<\/a><\/td>\n \u9ed8\u8ba4\u7684HTTP\u7aef\u53e3\u662f19888\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/figure>\n <\/p>\n
<\/p>\n
<\/p>\n
\u516d\u3001\u9a8c\u8bc1\u96c6\u7fa4<\/h2>\n\n\u5173\u95ed\u72b6\u6001\u4e3a active \u7684 namenode<\/li>\n<\/ul>\n\n\u53e6\u5916\u4e24\u53f0 namenode\u5176\u4e2d\u4e00\u53f0 \u4f1a\u6210\u4e3a active \u72b6\u6001<\/p>\n
\u91cd\u65b0\u542f\u52a8 hadoop-daemon.sh start namenode<\/code> \u7b2c\u4e00\u53f0 namenode\uff0c\u4f1a\u6210\u4e3a standby \u72b6\u6001<\/p>\n<\/ul>\n\n\u5173\u95ed\u72b6\u6001\u4e3a active \u4e3b\u673a\u7684 ZKFC<\/li>\n<\/ul>\n\n\u53e6\u5916\u4e24\u53f0 ZKFC \u5176\u4e2d\u4e00\u53f0\u4f1a\u5c06\u672c\u673a\u7684 namenode \u63d0\u5347\u4e3a active<\/p>\n
\u5173\u95ed ZKFC \u6240\u5728\u7684 namenode \u964d\u7ea7\u4e3a standby<\/p>\n
\u91cd\u65b0\u542f\u52a8 ZKFC hadoop-daemon.sh start zkfc<\/code> \u4f9d\u7136\u4e3a standby<\/p>\n<\/ul>\n\n\nYarn \u9ad8\u53ef\u7528\u9a8c\u8bc1\u547d\u4ee4<\/p>\n
$ yarn rmadmin -getServiceState rm1\n active\n\n $ yarn rmadmin -getServiceState rm2\n standby\n<\/code><\/pre>\n\u5173\u95edrm1 rm2 \u5c06\u6210\u4e3aacrive \u72b6\u6001\u3002<\/p>\n<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"
\u89c6\u9891\u6559\u7a0b \u5b98\u65b9\u6587\u6863 Hadoop HA \u81ea\u52a8\u5207\u6362\u539f\u7406 IP HOSTNAME \u542f\u52a8\u670d\u52a1 64.1<\/p>\n","protected":false},"author":1,"featured_media":992,"comment_status":"open","ping_status":"open","sticky":true,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17,18,74],"tags":[75,81,84,82,83,79],"yoast_head":"\n
Hadoop HA \u6545\u969c\u81ea\u52a8\u5207\u6362\u90e8\u7f72\u914d\u7f6e - Linux\u81ea\u52a8\u5316\u8fd0\u7ef4<\/title>\n \n \n \n \n \n \n \n \n \n \n \n\t \n\t \n\t \n \n \n