mysql spark jdbcrdd,Spark JDBC(一)MySQL Database RDD

当前位置:我的异常网» 数据库 » Spark JDBC(一)MySQL Database RDD

Spark JDBC(一)MySQL Database RDD

www.myexceptions.net  网友分享于:2015-06-16  浏览:0次

Spark JDBC(1)MySQL Database RDD

Spark JDBC(1)MySQL Database RDD

Try to understand how the JDBCRDD work on Spark.

First of all, the master did not connect to the database.

First step,

The client driver class will connect to the MySQL and get the minId and maxId.

150612 17:21:55  58 Connectcluster@192.168.56.1 on lmm

select coalesce(min(d.id), 0) from device d where d.last_updated >= '2014-06-12 00:00:00.0000' and d.last_updated < '2014-06-13 00:00:00.0000'

select coalesce(max(d.id), 0) from device d

Second step, All the workers will try to fetch the data based on partitions

150612 17:22:13  59 Connectcluster@ubuntu-dev2 on lmm

select id, tenant_id, date_created, last_updated, device_id, os_type, os_version,

search_radius, sdk_major_version, last_time_zone, sendable

from

device d

where

375001 <= d.id and

d.id <= 750001

select id, tenant_id, date_created, last_updated, device_id, os_type, os_version,

search_radius, sdk_major_version, last_time_zone, sendable

from

device d

where

750002 <= d.id and

d.id <= 1125002

62 Connectcluster@ubuntu-dev1 on lmm

62 Queryselect id, tenant_id, date_created, last_updated, device_id, os_type, os_version,

search_radius, sdk_major_version, last_time_zone, sendable

from

device d

where

0 <= d.id and

d.id <= 375000

63 Queryselect id, tenant_id, date_created, last_updated, device_id, os_type, os_version,

search_radius, sdk_major_version, last_time_zone, sendable

from

device d

where

1500004 <= d.id and

d.id <= 1875004

The sample JDBCRDD is in code

https://github.com/luohuazju/sillycat-spark/tree/streaming

References:

http://spark.apache.org/docs/1.4.0/tuning.html

http://stackoverflow.com/questions/27619230/how-to-split-the-input-file-in-apache-spark

文章评论

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值