<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>YARN on F嘉阳</title><link>https://blog.fjy8018.top/tags/yarn/</link><description>Recent content in YARN on F嘉阳</description><generator>Hugo -- gohugo.io</generator><language>zh-cn</language><lastBuildDate>Thu, 07 Sep 2023 14:48:40 +0800</lastBuildDate><atom:link href="https://blog.fjy8018.top/tags/yarn/index.xml" rel="self" type="application/rss+xml"/><item><title>YARN单节点伪分布式搭建</title><link>https://blog.fjy8018.top/archives/144/</link><pubDate>Mon, 09 Apr 2018 20:14:00 +0800</pubDate><guid>https://blog.fjy8018.top/archives/144/</guid><description>&lt;h2 id="配置yarn"&gt;&lt;a href="#%e9%85%8d%e7%bd%aeyarn" class="header-anchor"&gt;&lt;/a&gt;配置YARN&#10;&lt;/h2&gt;&lt;p&gt;首先启动之前配置好的HDFS服务，然后进入&lt;code&gt;/www/hadoop/hadoop-2.6.0-cdh5.7.0/etc/hadoop&lt;/code&gt;目录，按照官方指导配置YARN单节点环境&#10;&lt;img alt="请输入图片描述" class="gallery-image" data-flex-basis="400px" data-flex-grow="166" height="598" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://gitea.fjy8018.top/fjy8018/images/raw/branch/blog/img/2mE8vN.png" width="997"&gt;&lt;/p&gt;&#10;&lt;p&gt;使用&lt;code&gt;cp mapred-site.xml.template mapred-site.xml&lt;/code&gt;命令把&lt;code&gt;mapred-site.xml.template&lt;/code&gt;复制一份，加入官方的配置&#10;&lt;property&gt;&#10;&lt;name&gt;mapreduce.framework.name&lt;/name&gt;&#10;&lt;value&gt;yarn&lt;/value&gt;&#10;&lt;/property&gt;&#10;&lt;img alt="请输入图片描述" class="gallery-image" data-flex-basis="306px" data-flex-grow="127" height="514" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://gitea.fjy8018.top/fjy8018/images/raw/branch/blog/img/2mEHYc.png" width="657"&gt;&lt;/p&gt;&#10;&lt;p&gt;同时对&lt;code&gt;yarn-site.xml&lt;/code&gt;也进行配置&#10;&lt;property&gt;&#10;&lt;name&gt;yarn.nodemanager.aux-services&lt;/name&gt;&#10;&lt;value&gt;mapreduce_shuffle&lt;/value&gt;&#10;&lt;/property&gt;&#10;&lt;img alt="请输入图片描述" class="gallery-image" data-flex-basis="299px" data-flex-grow="124" height="485" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://gitea.fjy8018.top/fjy8018/images/raw/branch/blog/img/2mE5lK.png" width="605"&gt;&lt;/p&gt;&#10;&lt;h2 id="启动yarn"&gt;&lt;a href="#%e5%90%af%e5%8a%a8yarn" class="header-anchor"&gt;&lt;/a&gt;启动YARN&#10;&lt;/h2&gt;&lt;p&gt;进入&lt;code&gt;/www/hadoop/hadoop-2.6.0-cdh5.7.0/sbin&lt;/code&gt;目录，使用&lt;code&gt;./start-yarn.sh&lt;/code&gt;命令启动YARN服务&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;[hadoop@localhost sbin]$ ./start-yarn.sh&#10;starting yarn daemons&#10;starting resourcemanager, logging to /www/hadoop/hadoop-2.6.0-cdh5.7.0/logs/yarn-hadoop-resourcemanager-localhost.localdomain.out&#10;localhost: starting nodemanager, logging to /www/hadoop/hadoop-2.6.0-cdh5.7.0/logs/yarn-hadoop-nodemanager-localhost.localdomain.out&#10;&lt;/code&gt;&lt;/pre&gt;&#10;&lt;p&gt;用&lt;code&gt;jps&lt;/code&gt;命令查看是否启动成功，看到如下显示即为启动成功，主要是&lt;strong&gt;NodeManager&lt;/strong&gt;和&lt;strong&gt;ResourceManager&lt;/strong&gt;两个服务&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;[hadoop@localhost sbin]$ jps&#10;7056 SecondaryNameNode&#10;7475 NodeManager&#10;6775 NameNode&#10;6872 DataNode&#10;7374 ResourceManager&#10;7679 Jps&#10;&lt;/code&gt;&lt;/pre&gt;&#10;&lt;h2 id="开放端口"&gt;&lt;a href="#%e5%bc%80%e6%94%be%e7%ab%af%e5%8f%a3" class="header-anchor"&gt;&lt;/a&gt;开放端口&#10;&lt;/h2&gt;&lt;p&gt;YARN的浏览器客户端占用8088端口，故使用宝塔面板开放8088端口&#10;&lt;img alt="请输入图片描述" class="gallery-image" data-flex-basis="3825px" data-flex-grow="1593" height="48" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://gitea.fjy8018.top/fjy8018/images/raw/branch/blog/img/2mEqP6.png" width="765"&gt;&lt;/p&gt;&#10;&lt;h2 id="访问yarn图形化界面"&gt;&lt;a href="#%e8%ae%bf%e9%97%aeyarn%e5%9b%be%e5%bd%a2%e5%8c%96%e7%95%8c%e9%9d%a2" class="header-anchor"&gt;&lt;/a&gt;访问YARN图形化界面&#10;&lt;/h2&gt;&lt;p&gt;使用浏览器打开&lt;code&gt;http://ip:8088/&lt;/code&gt;可见如下界面，则YARN启动成功&#10;&lt;img alt="请输入图片描述" class="gallery-image" data-flex-basis="686px" data-flex-grow="286" height="423" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://gitea.fjy8018.top/fjy8018/images/raw/branch/blog/img/2mEhVT.png" width="1210"&gt;&lt;/p&gt;&#10;&lt;h2 id="测试"&gt;&lt;a href="#%e6%b5%8b%e8%af%95" class="header-anchor"&gt;&lt;/a&gt;测试&#10;&lt;/h2&gt;&lt;p&gt;YARN官方提供了示例java程序来测试资源调度，进入&lt;code&gt;/www/hadoop/hadoop-2.6.0-cdh5.7.0/share/hadoop/mapreduce&lt;/code&gt;目录，可见&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;[hadoop@localhost mapreduce]$ ls&#10;hadoop-mapreduce-client-app-2.6.0-cdh5.7.0.jar hadoop-mapreduce-client-nativetask-2.6.0-cdh5.7.0.jar&#10;hadoop-mapreduce-client-common-2.6.0-cdh5.7.0.jar hadoop-mapreduce-client-shuffle-2.6.0-cdh5.7.0.jar&#10;hadoop-mapreduce-client-core-2.6.0-cdh5.7.0.jar hadoop-mapreduce-examples-2.6.0-cdh5.7.0.jar&#10;hadoop-mapreduce-client-hs-2.6.0-cdh5.7.0.jar lib&#10;hadoop-mapreduce-client-hs-plugins-2.6.0-cdh5.7.0.jar lib-examples&#10;hadoop-mapreduce-client-jobclient-2.6.0-cdh5.7.0.jar sources&#10;hadoop-mapreduce-client-jobclient-2.6.0-cdh5.7.0-tests.jar&#10;&lt;/code&gt;&lt;/pre&gt;&#10;&lt;p&gt;其中&lt;code&gt;hadoop-mapreduce-examples-2.6.0-cdh5.7.0.jar&lt;/code&gt;就是MapReduce的测试程序，通过&lt;code&gt;hadoop jar&lt;/code&gt;的方式来运行&#10;用命令查看可配置的参数&lt;code&gt;hadoop jar hadoop-mapreduce-examples-2.6.0-cdh5.7.0.jar&lt;/code&gt;&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;[hadoop@localhost mapreduce]$ hadoop jar hadoop-mapreduce-examples-2.6.0-cdh5.7.0.jar&#10;An example program must be given as the first argument.&#10;Valid program names are:&#10; aggregatewordcount: An Aggregate based map/reduce program that counts the words in the input files.&#10; aggregatewordhist: An Aggregate based map/reduce program that computes the histogram of the words in the input files.&#10; bbp: A map/reduce program that uses Bailey-Borwein-Plouffe to compute exact digits of Pi.&#10; dbcount: An example job that count the pageview counts from a database.&#10; distbbp: A map/reduce program that uses a BBP-type formula to compute exact bits of Pi.&#10; grep: A map/reduce program that counts the matches of a regex in the input.&#10; join: A job that effects a join over sorted, equally partitioned datasets&#10; multifilewc: A job that counts words from several files.&#10; pentomino: A map/reduce tile laying program to find solutions to pentomino problems.&#10; pi: A map/reduce program that estimates Pi using a quasi-Monte Carlo method.&#10; randomtextwriter: A map/reduce program that writes 10GB of random textual data per node.&#10; randomwriter: A map/reduce program that writes 10GB of random data per node.&#10; secondarysort: An example defining a secondary sort to the reduce.&#10; sort: A map/reduce program that sorts the data written by the random writer.&#10; sudoku: A sudoku solver.&#10; teragen: Generate data for the terasort&#10; terasort: Run the terasort&#10; teravalidate: Checking results of terasort&#10; wordcount: A map/reduce program that counts the words in the input files.&#10; wordmean: A map/reduce program that counts the average length of the words in the input files.&#10; wordmedian: A map/reduce program that counts the median length of the words in the input files.&#10; wordstandarddeviation: A map/reduce program that counts the standard deviation of the length of the words in the input files.&#10;[hadoop@localhost mapreduce]$ hadoop jar hadoop-mapreduce-examples-2.6.0-cdh5.7.0.jar pi&#10;Usage: org.apache.hadoop.examples.QuasiMonteCarlo &amp;lt;nMaps&amp;gt; &amp;lt;nSamples&amp;gt;&#10;Generic options supported are&#10;-conf &amp;lt;configuration file&amp;gt; specify an application configuration file&#10;-D &amp;lt;property=value&amp;gt; use value for given property&#10;-fs &amp;lt;local|namenode:port&amp;gt; specify a namenode&#10;-jt &amp;lt;local|resourcemanager:port&amp;gt; specify a ResourceManager&#10;-files &amp;lt;comma separated list of files&amp;gt; specify comma separated files to be copied to the map reduce cluster&#10;-libjars &amp;lt;comma separated list of jars&amp;gt; specify comma separated jar files to include in the classpath.&#10;-archives &amp;lt;comma separated list of archives&amp;gt; specify comma separated archives to be unarchived on the compute machines.&#10;&#10;The general command line syntax is&#10;bin/hadoop command [genericOptions] [commandOptions]&#10;&lt;/code&gt;&lt;/pre&gt;&#10;&lt;p&gt;从上可知测试程序可以做诸如数学π、随机文件写入等操作，这里做数学π的运算&#10;使用命令&lt;code&gt;hadoop jar hadoop-mapreduce-examples-2.6.0-cdh5.7.0.jar pi 2 3&lt;/code&gt;做两个map计算精度为3的数学π运算,运算结束后会显示结果如下&lt;/p&gt;&#10;&lt;pre&gt;&lt;code&gt;Job Finished in 26.996 seconds&#10;Estimated value of Pi is 4.00000000000000000000&#10;&lt;/code&gt;&lt;/pre&gt;&#10;&lt;p&gt;同时浏览器也可看到作业情况&#10;&lt;img alt="请输入图片描述" class="gallery-image" data-flex-basis="983px" data-flex-grow="409" height="464" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://gitea.fjy8018.top/fjy8018/images/raw/branch/blog/img/2mE3pt.png" width="1901"&gt;&lt;/p&gt;&#10;</description></item></channel></rss>