关注云端搜索技术:elasticsearch,nutch,hadoop,nosql,mongodb,hbase,cassandra 及Hadoop优化
Hadoop添加或调整的参数:
一、hadoop-env.sh
1、hadoop的heapsize的设置,默认1000
# The maximum amount of heap to use, in MB. Default is 1000.
# export HADOOP_HEAPSIZE=2000
2、改变pid的路径,pid文件默认在/tmp目录下,而/tmp是会被系统定期清理的
# The directory where pid files are stored. /tmp by default.
# export HADOOP_PID_DIR=/var/hadoop/pids
二、core-site.xml
1、hadoop.tmp.dir 是hadoop文件系统依赖的基础配置(默认值/tmp),尽量手动配置这个选项。
<property>
<name>hadoop.tmp.dir</name>
<value>/tmp/hadoop-${user.name}</value>
<description>A base for other temporary directories.</description>
</property>
2、SequenceFiles在读写中可以使用的缓存大小,可减少 I/O 次数。默认4096(byte),建议可设定为 65536 到 131072。
<property>
<name>io.file.buffer.size</name>
<value>4096</value>
<description>The size of buffer for use in sequence files.
The size of this buffer should probably be a multiple of hardware
page size (4096 on Intel x86), and it determines how much data is
buffered during read and write operations.</description>
</property>
三、hdfs-site.xml
1、默认hdfs里每個block是 67108864(64MB)。如果確定存取的文件块都很大可以改為 134217728(128MB)
<property>
<name>dfs.block.size</name>
<value></value>
<description>The default block size for new files.</description>
</property>
2、Hadoop启动时会进入safe mode,也就是安全模式,這时是不能写入数据的。只有当设置的的blocks(默认0.999f)达到最小的dfs.replication.min数量才会离开safe mode。
在 dfs.replication.min 设的比较大或 data nodes 数量比较多时会等比较久。
<property>
<name>dfs.safemode.threshold.pct</name>
<value>0.999f</value>
<description>
Specifies the percentage of blocks that should satisfy
the minimal replication requirement defined by dfs.replication.min.
Values less than or equal to 0 mean not to start in safe mode.
Values greater than 1 will make safe mode permanent.
</description>
</property>
3、指定namenode、datanode 的存储路径,默认保存在 ${hadoop.tmp.dir}/dfs/ 目录里。
<property>
<name>dfs.name.dir</name>
<value>${hadoop.tmp.dir}/dfs/name</value>
<description>Directory in NameNode's local filesystem to store HDFS's metadata.</description>
</property> <property>
<name>dfs.data.dir</name>
<value>${hadoop.tmp.dir}/dfs/data</value>
<description>Directory in a DataNode's local filesystem to store HDFS's file blocks.</description>
</property>
四、mapred-site.xml
1、缓存map中间结果的buffer大小(默认100MB)
map任务运算产生的中间结果并非直接写入磁盘。hadoop利用内存buffer对部分结果缓存,并在内存buffer中进行一些预排序来优化整个map的性能。
map在运行过程中,不停的向该buffer中写入计算结果,但是该buffer并不一定能将全部的map输出缓存下来,当map输出超出一定阈值,那么map就必须将该buffer中的数据写入到磁盘中去,这个过程在mapreduce中叫做spill,把io.sort.mb调大,则map的spill的次数就会降低,map任务对磁盘的操作变少,最终提高map的计算性能。
<property>
<name>io.sort.mb</name>
<value></value>
<description>
The total amount of buffer memory to use while sorting
files, in megabytes. By default, gives each merge stream 1MB, which should minimize seeks.
</description>
</property>
2、排序文件merge时,一次合并的文件上限(默认10)。
当map任务全部完成后,就会生成一个或者多个spill文件。map在正常退出之前,需要将这些spill合并(merge)成一个。
参数io.sort.factor调整merge行为,它表示最多能有多少并行的stream向merge文件中写入。
调大io.sort.factor,有利于减少merge次数,进而减少map对磁盘的读写频率,最终提高map的计算性能。
<property>
<name>io.sort.factor</name>
<value></value>
<description>The number of streams to merge at once while sorting files. This determines the number of open file handles. </description>
</property>
3、JobTracker的管理线程数(默认10)
<property>
<name>mapred.job.tracker.handler.count</name>
<value></value>
<description>
The number of server threads for the JobTracker. This should be roughly
% of the number of tasktracker nodes.
</description>
</property>
4、每个作业的map/reduce任务数(map默认2,reduce默认1)
<property>
<name>mapred.map.tasks</name>
<value></value>
<description>The default number of map tasks per job.Ignored when mapred.job.tracker is "local". </description>
</property> <property>
<name>mapred.reduce.tasks</name>
<value></value>
<description>The default number of reduce tasks per job. Typically set to %
of the cluster's reduce capacity, so that if a node fails the reduces
can still be executed in a single wave. Ignored when mapred.job.tracker is "local".
</description>
</property>
5、单个tasktracker节点最多可并行执行的map/reduce任务数(map默认2,reduce默认2)
<property>
<name>mapred.tasktracker.map.tasks.maximum</name>
<value></value>
<description>The maximum number of map tasks that will be run simultaneously by a task tracker. </description>
</property> <property>
<name>mapred.tasktracker.reduce.tasks.maximum</name>
<value></value>
<description>The maximum number of reduce tasks that will be run simultaneously by a task tracker. </description>
</property>
6、限制每个用户在JobTracker的内存中保存已完成任务的个数(默认100)。
任务被扔到历史作业之前完成的最大任务数,一般我们只会关注运行中的队列,所以可以考虑降低它的值,减少内存资源占用
这个参数在0.21.0以后的版本已经没有必要设置了,因为0.21版本改造了completeuserjobs的算法,让它尽快的写入磁盘,不再内存中长期存在了。
<property>
<name>mapred.jobtracker.completeuserjobs.maximum</name>
<value></value>
<description>The maximum number of complete jobs per user to keep
around before delegating them to the job history.
</description>
</property>
7、从map复制时reduce并行传送的值(默认5)
默认情况下,每个reduce只会有5个并行的下载线程从map复制数据,如果一个时间段内job完成的map有100个或者更多,那么reduce也最多只能同时下载5个map的数据。
所以这个参数比较适合map很多并且完成的比较快的job的情况下调大,有利于reduce更快的获取属于自己部分的数据。
<property>
<name>mapred.reduce.parallel.copies</name>
<value></value>
<description>The default number of parallel transfers run by reduce during the copy(shuffle) phase.</description>
</property>
8、Map的输出中间结果时是否压缩(默认false)
将这个参数设置为true时,那么map在写中间结果时,就会将数据压缩后再写入磁盘,读结果时也会采用先解压后读取数据。
这样做的后果就是:写入磁盘的中间结果数据量会变少,但是cpu会消耗一些用来压缩和解压。
所以这种方式通常适合job中间结果非常大,瓶颈不在cpu,而是在磁盘的读写的情况。说的直白一些就是用cpu换IO。
<property>
<name>mapred.compress.map.output</name>
<value>false</value>
<description>Should the outputs of the maps be compressed before being sent across the network. Uses SequenceFile compression. </description>
</property>
10、启动tasktracker的子进程时的heapsize设置(默认200M)
<property>
<name>mapred.child.java.opts</name>
<value>-Xmx200m -verbose:gc -Xloggc:/tmp/@taskid@.gc</value>
<description>Java opts for the task tracker child processes.
The following symbol, if present, will be interpolated: @taskid@ is
replaced
by current TaskID. Any other occurrences of '@' will go unchanged.
For example, to enable verbose gc logging to a file named for the taskid
in /tmp and to set the heap maximum to be a gigabyte, pass a 'value' of:
-Xmx1024m -verbose:gc -Xloggc:/tmp/@taskid@.gc The configuration variable mapred.child.ulimit can be used to control
the maximum virtual memory of the child processes.
</description>
</property>
关注云端搜索技术:elasticsearch,nutch,hadoop,nosql,mongodb,hbase,cassandra 及Hadoop优化的更多相关文章
- 百度和 Google 的搜索技术是一个量级吗?
著作权归作者所有. 商业转载请联系作者获得授权,非商业转载请注明出处. 作者:Kenny Chao 链接:http://www.zhihu.com/question/22447908/answer/2 ...
- 数据分析≠Hadoop+NoSQL
数据分析≠Hadoop+NoSQL 目录(?)[+] Hadoop让大数据分析走向了大众化,然而它的部署仍需耗费大量的人力和物力.在直奔Hadoop之前,是否已经将现有技术推向极限 ...
- 复杂的1秒--图解Google搜索技术
谷歌(Google),一个非常成功,但又十分神秘,而且带有几分理想化色彩的互联网搜索巨人,它还是一家相当了不起的广告公司,谷歌首页上的那个搜索按钮是其年赢利200亿美元的杀手级应用,也是Interne ...
- Solr搜索技术
Solr搜索技术 今日大纲 回顾上一天的内容: 倒排索引 lucene和solr的关系 lucene api的使用 CRUD 文档.字段.目录对象(类).索引写入器类.索引写入器配置类.IK分词器 查 ...
- 搜索技术---solr
solr 企业站内搜索技术选型 在一些大型门户网站.电子商务网站等都需要站内搜索功能,使用传统的数据库查询方式实现搜索无法满足一些高级的搜索需求,比如:搜索速度要快.搜索结果按相关度排序.搜索内容格式 ...
- 1.搜索引擎的历史,搜索引擎起步,发展,繁荣,搜索引擎的原理,搜索技术用途,信息检索过程,倒排索引,什么是Lucene,Lucene快速入门
一: 1 搜索引擎的历史 萌芽:Archie.Gopher Archie:搜索FTP服务器上的文件 Gopher:索引网页 2 起步:Robot(网络机器人)的出现与spider(网络爬虫) ...
- 渐进反馈式搜索技术助力运维工程师——Linux命令高效检索
日常生活工作中,我们通过搜索引擎查询相关资料时,经常遇到不知如何指定准确关键词的情况,仅仅根据指定大概范围的关键词时,搜索结果往往不能尽如人意. <信息导航>APP最新版本(Ver 1.1 ...
- 【SpringBoot】搜索框架ElasticSearch介绍和整合SpringBoot
========================12章 搜索框架ElasticSearch介绍和整合SpringBoot ============================= 加入小D课堂技术交 ...
- 12章 搜索框架ElasticSearch介绍和整合SpringBoot 4节课
1.搜索引擎知识和搜索框架elasticsearch基本介绍 简介:通过京东电商 介绍什么是搜索引擎,和开源搜索框架ElasticSearch6.x新特性介绍 前言:介绍ES的主要特点和使用场 ...
随机推荐
- [题解]bzoj 1861 Book 书架 - Splay
1861: [Zjoi2006]Book 书架 Time Limit: 4 Sec Memory Limit: 64 MBSubmit: 1396 Solved: 803[Submit][Stat ...
- 写了一个复杂的sql语句
$sp_sql = "select sp_ProductNo, sp_ProductName,sp_Standard,sp_Unit,sum(sp_Amount) as amount fro ...
- AndroidManifest.xml文件
AndroidManifest.xml常用标签解读 1.全局篇(包名,版本信息) 2.组件篇(四大组件) Activity Service Content Provider Broadcast Rec ...
- BZOJ2720: [Violet 5]列队春游
2720: [Violet 5]列队春游 Time Limit: 5 Sec Memory Limit: 128 MBSubmit: 173 Solved: 125[Submit][Status] ...
- Swift 动态创建提示框
var alert = UIAlertController(title: "", message: "", prefferedStyle: UIAlertCon ...
- centos7.0之Lnmp和Lamp
首先配置防火墙 CentOS 7.0默认使用的是firewall作为防火墙 1.关闭firewall: systemctl stop firewalld.service #停止firewall sys ...
- js架构设计模式——前端MVVM框架设计及实现(二)
前端MVVM框架设计及实现(二) 在前端MVVM框架设计及实现(一)中有一个博友提出一个看法: “html中使用mvvm徒增开发成本” 我想这位朋友要表达的意思应该是HTML定义了大量的语法标记,HT ...
- 按钮(Buton)组价的功能和用法
Button继承了TextView,它主要是在UI界面上生成一个按钮,该按钮可以供用户单机,当用户单击按钮时,按钮会触发一个onClick事件. 按钮使用起来比较容易,可以通过为按钮指定android ...
- java Swing 图片缓冲机制
java Swing 图片缓冲机制: 参考:http://jorneyr.iteye.com/blog/868858#comments package util; import java.awt.ge ...
- ASP.NET Zero--13.一个例子(6)商品分类管理-删除分类
1.添加按钮 首先添加一个删除按钮,打开文件Index.js[..\MyCompanyName.AbpZeroTemplate.Web\Areas\Mpa\Views\Category\Index.j ...