最近 cdh 5.2.0 发布了,想看看其做了哪些改进、带来哪些不兼容以及是否有必要升级现有的 hadoop 集群。
avro 版本使用1.7.6,重要的一些改变:
提供新的功能:
hdfs data at rest encryption。hdfs 数据的加密,该功能在5.2.0中还有一些限制,尚不能用于生产环境。
使用 http proxy server时的authentication改进
增加了一个新的 metrics sink,允许直接将监控数据写到 graphite
specification for hadoop compatible filesystem effort
增加 offlineimageviewer 通过 webhdfs api 浏览 fsimage
对 nfs 支持的改进
hdfs daemons 的 web ui 改进
cdh 5.2 提供了一个 mapper 端 shuffle 的优化实现,使用该实现需要修改原来的实现类,默认未开启该实现。
可以修改 <code>mapreduce.job.map.output.collector.class</code> 参数为 <code>org.apache.hadoop.mapred.nativetask.nativemapoutputcollectordelegator</code>来开启该特性。
使用了自定义的可写的类型或者比较器时,无法使用该特性。
fair scheduler 新特性:
允许为每个队列设置 <code>fairsharepreemptionthreshold</code> 属性,该值在 fair-scheduler.xml 中设置,默认值为0.5
允许为每个队列设置 <code>fairsharepreemptiontimeout</code> 属性,该值在 fair-scheduler.xml 中设置
在 web ui 中可以显示 steady fair share
fair scheduler 改进:
fair scheduler uses instantaneous fair share (fairshare that considers only active queues) for scheduling decisions to improve the time to achieve steady state (fairshare).
maxamshare 默认值设为0.5,意思是只有一半的集群资源可以被 application master 使用。该参数可以在 fair-scheduler.xml 中设置。
yarn 的 rest api 支持提交和杀掉 application 。
yarn 的 timeline store 和 kerberos 集成
新的 join api
增加新的模块 crunch-hive,用于使用 crunch 读写 orc 文件。
kite sink 可以写数据到 hive 和 hbase。
flume agent 可以通过 zookeeper 配置(试验中)。
嵌入式的 agent 支持拦截器。
syslog source 支持配置那个字段可以保留。
file channel replay 速度变快
添加新的正则表达式查询替换拦截器
backup checkpoint 可以可选的被压缩。
添加新的应用修改数据和表上的 sentry 的角色和权限
arch app
添加 heatmap, tree, leaflet 组件
micro-analysis of fields
exclusion facets
oozie dashboard: bulk actions, faster display
file browser: drag-and-drop upload, history, acls edition
hive and impala: ldap pass-through, query expiration, ssl (hive), new graphs
job browser: yarn kill application button
hbase 版本升级到 0.98.6
hive 版本升级到 0.13,增加如下特性:
where 语句支持子查询
common table expressions
parquet 支持 timestamp
hiveserver2 可以配置 hiverc 文件,当连接的时候,自动执行该文件内容
permanent udfs
hiveserver2 添加 session 和操作超时
beeline 接受一个 <code>-i</code> 参数执行初始化的 sql 文件
新的 join 语法(implicit joins)
建表语句支持 avro 存储格式
hive 支持额外的数据类型:
hive 可以读 hive 和 impala 创建的 char 和 varchar 数据类型
impala 可以读 hive 和 impala 创建的 char 和 varchar 数据类型
describe database 命令添加两个新属性:owner_name 和 owner_type。
impala 版本升级到 2.0,改进包括:
子查询改进:
<code>where</code> 语句中支持子查询,可以用于 <code>in</code> 查询
支持 <code>exists</code> 和 <code>not exists</code> 操作
子查询中可以使用 <code>in</code> 和 <code>not in</code>
where 语句可以使用如下语句: <code>where column = (select max(some_other_column from table)</code> 或者 <code>where column in (select some_other_column from table where conditions)</code>
correlated subqueries let you cross-reference values from the outer query block and the subquery.
scalar subqueries let you substitute the result of single-value aggregate functions such as max(), min(), count(), or avg(), where you would normally use a numeric value in a where clause.
添加几个聚合函数: <code>rank()</code>, <code>lag()</code>, <code>lead(</code>), <code>first_value()</code>
添加新的数据类型:
varchar
char
security方面的改进:
<a href="http://www.cloudera.com/content/cloudera/en/documentation/core/latest/topics/impala_mixed_security.html#mixed_security" target="_blank">using multiple authentication methods with impala</a>
grant
revoke
create role
drop role
show roles
–disk_spill_encryption
impala 可以读取 gzip, bzip, 或 snappy 的压缩数据
<code>query_timeout_s</code> 用于设置查询超时时间。
添加 <code>var_samp()</code> 和 <code>var_pop()</code>,分别为 <code>variance_samp()</code> 和 <code>variance_pop()</code> 别名
添加新的日期和时间类型函数:date_part()
stddev(), stddev_pop(), stddev_samp(), variance(), variance_pop(), variance_samp(), ndv() 返回 double 类型
parquet 块大小默认值由 1g 改为256m,也可以通过 <code>parquet_file_size</code> 参数设置
支持 anti-joins,可以使用 <code>left anti join</code> 和 <code>right anti join</code> 语句
版本更新: 5.2 parquet is rebased on parquet 1.5 and parquet-format 2.1.0.
apache spark/streaming 版本使用 1.1
稳定性和性能改进
新的 sort-based shuffle 实现,默认未开启。
spark ui 更好的监控性能改进
pyspark 支持 hadoop inputformats
改进 yarn 的支持,并修复一些 bug
cdh 5.2 sqoop 1 is rebased on sqoop 1.4.5
mainframe connector added.
parquet support added.
当没有快照目录时,getsnapshottabledirlisting() 方法返回 null
namenode ` -finalize<code> 启动参数被删除,为了完成集群的升级,应该使用 </code>hdfs dfsadmin -finalizeupgrade` 命令
libhdfs 函数返回正确的错误码
hdfs balancer 命令运行错误时候返回0,运行成功返回1
disable symlinks temporarily
files named <code>.snapshot</code> or <code>.reserved</code> must not exist within hdfs.
change in high-availability support:
cdh5 中唯一的 ha 实现是基于 quorum-based storage,使用 nfs 的共享存储不再支持。
catalina_base 变量不再用于决定一个组件是否配置为 yarn 或者 mrv1
yarn fair scheduler acl change. root queue defaults to everybody, and other queues default to nobody.
yarn 高可用配置参数修改了 key 名称
<code>yarn_home</code> 改为 <code>hadoop_yarn_home</code>
yarn-site.xml 中的以下参数改名:
<code>mapreduce.shuffle</code> 改为 <code>mapreduce_shuffle</code>
<code>yarn.nodemanager.aux-services.mapreduce.shuffle.class</code> 改为 <code>yarn.nodemanager.aux-services.mapreduce_shuffle.class</code>
<code>yarn.resourcemanager.resourcemanager.connect.max.wait.secs</code> 改为 <code>yarn.resourcemanager.connect.max-wait.secs</code>
<code>yarn.resourcemanager.resourcemanager.connect.retry_interval.secs</code> 改名为 <code>yarn.resourcemanager.connect.retry-interval.secs</code>
<code>yarn.resourcemanager.am.max-retries</code> 改名为 <code>yarn.resourcemanager.am.max-attempts</code>
hbase 版本变化太大,这里不做说明。
cdh 5 提供一个新的离线命令用于升级元数据:
cdh 4.x 和 cdh 5 中不兼容的地方:
cdh 4 jdbc 客户端和 cdh5 hiveserver2 不兼容
连接 hiveserver2 需要 cdh5 的 jar 包
因为权限和并发问题,hive 命令行和 hiveserver1 将删除不再使用,建议使用 hiveserver2 和 beeline
cdh 5 hue 不能用于 cdh 4 的hiveserver2
删除 npath 函数
cloudera recommends that custom objectinspectors created for use with custom serdes have a no-argument constructor in addition to their normal constructors, for serialization purposes. see hive-5380 for more details.
the serde interface has been changed which requires the custom serde modules to be reworked.
the decimal data type format has changed as of cdh 5 beta 2 and is not compatible with cdh 4.
cdh 5 和 cdh 5.2.x 中不兼容的地方:
the cdh 5.2 hive jdbc driver is not wire-compatible with the cdh 5.1
1、disabling transparent hugepage compaction
查看是否开启
关闭该特性,并将其加入到 /etc/rc.local
2、设置 swap 交换
查看是否开启:
on most systems, it is set to 60 by default. this is not suitable for hadoop clusters nodes, because it can cause processes to get swapped out even when there is free memory available. this can affect stability and performance, and may cause problems such as lengthy garbage collection pauses for important system daemons.
建议修改为0:
3、improving performance in shuffle handler and ifile reader
shuffle handler,开启预先读取数据:
对于 yarn,设置 <code>mapreduce.shuffle.readahead.bytes</code>,默认值为4mb
对于 mrv1,设置 <code>mapred.tasktracker.shuffle.readahead.bytes</code>,默认值为4mb
ifile reader,开启预先读取ifile文件可以改进合并文件性能,开启该特性,请设置 <code>mapreduce.ifile.readahead property</code> 为 true,默认值为 true,更进一步,可以设置<code>mapreduce.ifile.readahead.bytes</code> 参数值,该值默认为4mb
4、mapreduce配置最佳实践
设置 <code>mapreduce.tasktracker.outofband.heartbeat</code> 为 true,该值默认为 false
在一个小集群中,设置 jobtracker heartbeat 间隔到一个更小的值,参数为 <code>apreduce.jobtracker.heartbeat.interval.min</code> ,默认值为10
5、立即启动 mapreduce 的 jvm
对于小任务,设置 <code>mapred.reduce.slowstart.completed.maps</code> 值为0,对于比较大的任务,最大设置为 50%
6、调整 mrv1 日志级别
<code>mapreduce.map.log.level</code>
<code>mapreduce.reduce.log.level</code>
flume does not provide a native sink that stores the data that can be directly consumed by hive.
fast replay does not work with encrypted file channel
distcp between unencrypted and encrypted locations fails
namenode - kms communication fails after long periods of inactivity
spark fails when the kms is configured to use ssl
files inside encryption zones cannot be read in hue
cannot move encrypted files to trash
no error when changing permission to 777 on .snapshot directory
snapshots do not retain directories’ quotas settings
namenode cannot use wildcard address in a secure cluster
permissions for dfs.namenode.name.dir incorrectly set.
hadoop fsck -move does not work in a cluster with host-based kerberos
httpfs cannot get delegation token without prior authenticated request.
distcp does not work between a secure cluster and an insecure cluster in some cases
using distcp with hftp on a secure cluster using spnego requires that the dfs.https.port property be configured
offline image viewer (oiv) tool regression: missing delimited outputs.
snapshot operations are not supported by viewfilesystem
starting an unmanaged applicationmaster may fail
no jobtracker becomes active if both jobtrackers are migrated to other hosts
hadoop pipes may not be usable in an mrv1 hadoop installation done through tarballs
task-completed percentage may be reported as slightly under 100% in the web ui, even when all of a job’s tasks have successfully completed.
encrypted shuffle in mrv2 does not work if used with linuxcontainerexecutor and encrypted web uis.
link from resourcemanager to application master does not work when the web ui over https feature is enabled.
hadoop client jars don’t provide all the classes needed for clean compilation of client code
the ulimits setting in /etc/security/limits.conf is applied to the wrong user if security is enabled.
hive’s timestamp type cannot be stored in parquet
hive’s decimal type cannot be stored in parquet and avro
hive creates an invalid table if you specify more than one partition with alter table
postgresql 9.0+ requires additional configuration,需要设置 <code>standard_conforming_strings</code> 为 off
setting hive.optimize.skewjoin to true causes long running queries to fail
jdbc - executeupdate does not returns the number of rows modified
hive auth (grant/revoke/show grant) statements do not support fully qualified table names (default.tab1)
parquet file writes run out of memory if (number of partitions) times (block size) exceeds available memory
hive cannot read arrays in parquet written by parquet-avro or parquet-thrift
本篇文章主要是翻译了 cloudera 官网上关于 cdh5.2 的新特性、不兼容变化、性能改进以及可能存在的问题等相关文档,以便清楚的了解 hadoop 各组件的特性并为是否升级 hadoop 版本做出决策支持。