欢迎关注大数据技术架构与案例微信公众号:过往记忆大数据
过往记忆博客公众号iteblog_hadoop
欢迎关注微信公众号:
过往记忆大数据

最新发布 第107页

过往记忆专注于大数据技术构架及应用,微信公众号:过往记忆大数据

Spark

Spark多文件输出(MultipleOutputFormat)

Spark多文件输出(MultipleOutputFormat)
  在本博客的《Hadoop多文件输出:MultipleOutputFormat和MultipleOutputs深究(一)》《Hadoop多文件输出:MultipleOutputFormat和MultipleOutputs深究(二)》两篇文章中我介绍了如何在Hadoop中根据Key或者Value的不同将属于不同的类型记录写到不同的文件中。在里面用到了MultipleOutputFormat这个类。  因为Spark内部写文件方式其实调用的都是Hadoop那一套东

w397090770   9年前 (2015-03-11) 20935℃ 19评论17喜欢

Spark

Spark函数讲解:cogroup

Spark函数讲解:cogroup
  将多个RDD中同一个Key对应的Value组合到一起。函数原型[code lang="scala"]def cogroup[W1, W2, W3](other1: RDD[(K, W1)], other2: RDD[(K, W2)], other3: RDD[(K, W3)], partitioner: Partitioner) : RDD[(K, (Iterable[V], Iterable[W1], Iterable[W2], Iterable[W3]))] def cogroup[W1, W2, W3](other1: RDD[(K, W1)], other2: RDD[(K, W2)], other3: RDD[(K, W3)], numPartitions: Int) : RDD[(K

w397090770   9年前 (2015-03-10) 17407℃ 0评论17喜欢

Mysql

Spark将计算结果写入到Mysql中

Spark将计算结果写入到Mysql中
  建议用Spark 1.3.0提供的写关系型数据库的方法,参见《Spark RDD写入RMDB(Mysql)方法二》。  在《Spark与Mysql(JdbcRDD)整合开发》文章中我们介绍了如何通过Spark读取Mysql中的数据,当时写那篇文章的时候,Spark还未提供通过Java来使用JdbcRDD的API,不过目前的Spark提供了Java使用JdbcRDD的API。  今天主要来谈谈如果将Spark计算的结果

w397090770   9年前 (2015-03-10) 36810℃ 5评论33喜欢

Spark

Apache Spark相比Hadoop的优势

Apache Spark相比Hadoop的优势
  以下的话是由Apache Spark committer的Reynold Xin阐述。  从很多方面来讲,Spark都是MapReduce 模式的最好实现。比如从程序抽象的角度来看:  1、他抽象出Map/Reduce两个阶段来支持tasks的任意DAG。大多数计算通过依赖将maps和reduces映射到一起(Most computation maps (no pun intended) into many maps and reduces with dependencies among them. )。而在Spark的RDD

w397090770   9年前 (2015-03-09) 8035℃ 0评论9喜欢

Spark

Spark函数讲解:coalesce

Spark函数讲解:coalesce
  对RDD中的分区重新进行合并。函数原型[code lang="scala"]def coalesce(numPartitions: Int, shuffle: Boolean = false)    (implicit ord: Ordering[T] = null): RDD[T][/code]  返回一个新的RDD,且该RDD的分区个数等于numPartitions个数。如果shuffle设置为true,则会进行shuffle。实例[code lang="scala"]/** * User: 过往记忆 * Date: 15-03-09 * Time: 上午0

w397090770   9年前 (2015-03-09) 14120℃ 1评论5喜欢

Spark

Spark函数讲解序列文章

Spark函数讲解序列文章
  本博客近日将对Spark 1.2.1 RDD中所有的函数进行讲解,主要包括函数的解释,实例以及注意事项,每日一篇请关注。以下是将要介绍的函数,按照字母的先后顺序进行介绍,可以点的说明已经发布了。  aggregate、aggregateByKey、cache、cartesian、checkpoint、coalesce、cogroup groupWith collect, toArraycollectAsMap combineByKey computecontext, spar

w397090770   9年前 (2015-03-08) 7233℃ 0评论6喜欢

Spark

Spark函数讲解:checkpoint

Spark函数讲解:checkpoint
  为当前RDD设置检查点。该函数将会创建一个二进制的文件,并存储到checkpoint目录中,该目录是用SparkContext.setCheckpointDir()设置的。在checkpoint的过程中,该RDD的所有依赖于父RDD中的信息将全部被移出。对RDD进行checkpoint操作并不会马上被执行,必须执行Action操作才能触发。函数原型[code lang="scala"]def checkpoint()[/code]实例

w397090770   9年前 (2015-03-08) 60511℃ 0评论7喜欢

Spark

Spark函数讲解:cartesian

Spark函数讲解:cartesian
  从名字就可以看出这是笛卡儿的意思,就是对给的两个RDD进行笛卡儿计算。官方文档说明:Return the Cartesian product of this RDD and another one, that is, the RDD of all pairs of elements (a, b) where a is in `this` and b is in `other`.函数原型[code lang="scala"]def cartesian[U: ClassTag](other: RDD[U]): RDD[(T, U)][/code]  该函数返回的是Pair类型的RDD,计算结果

w397090770   9年前 (2015-03-07) 11176℃ 0评论5喜欢

Spark

Spark函数讲解:cache

Spark函数讲解:cache
  使用MEMORY_ONLY储存级别对RDD进行缓存,其内部实现是调用persist()函数的。官方文档定义:Persist this RDD with the default storage level (`MEMORY_ONLY`).函数原型[code lang="scala"]def cache() : this.type[/code]实例[code lang="scala"]/** * User: 过往记忆 * Date: 15-03-04 * Time: 下午06:30 * bolg: * 本文地址:/archives/1274 * 过往记忆博客,

w397090770   9年前 (2015-03-04) 14170℃ 0评论8喜欢

Spark

Spark函数讲解:aggregateByKey

Spark函数讲解:aggregateByKey
  该函数和aggregate类似,但操作的RDD是Pair类型的。Spark 1.1.0版本才正式引入该函数。官方文档定义:Aggregate the values of each key, using given combine functions and a neutral "zero value". This function can return a different result type, U, than the type of the values in this RDD, V. Thus, we need one operation for merging a V into a U and one operation for merging two U's, as in scala.Traversabl

w397090770   9年前 (2015-03-02) 39549℃ 2评论35喜欢