SlideShare a Scribd company logo
1 of 16
Download to read offline
2017.11.01
大數據平台架構
(Spark on Yarn & MongoDB)
-Presentation by Hughe Chen
Agenda
● 大數據平台(Spark on Yarn & MongoDB)簡介
● 環境設定
○ spark
○ mongoDB
● 使用方式-以 northwind 資料集示範
環境設定
• Host :
– i5-4 core, 8G RAM, SATA 256G SSD
– OS:centos7
• Guest :
– spark-2.1.1 on yarn
• nn : 3G ,2core
• dn01 : 2G ,1core
• dn02 : 2G ,1core
– Anaconda2(python2.7.13)
– Mongodb-3.4.6
• replica + sharding
– mongo-spark connector:
• mongo-spark-connector_2.11-2.1.0.jar
平台架構 YARN
(Resource Manager)
name node
Spark
(master & worker 1)
MongoDB
(shard 1)
data node 1 data node 2
Spark
(worker 3)
Spark
(worker 2)
MongoDB
(shard 3)
MongoDB
(shard 2)
replica 1 replica 2 replica 3
spark
• 使用spark on yarn模式
• 使用動態資源分配 - spark當遇到大量task產生時,動態資源分配將會依照
需求啟動第二和三個excutor,等待執行結束之後,將excutor結束,自動歸
還資源。
MongoDB
• 使用 replica + sharding 架構
• 設定 wiredTiger 使用 256MB 的記憶體(每個 mongod 實體,最小需求)
• 盡量將資料集(collection)控制在 wiredTigercache 內,充分利用cache效能
Spark MongoDB平台簡介
• Spark 任務一般由 Spark 的 driver 發起,經過 Spark Master 進行資源調
度分發。
• 每個 excutor 會獨立的去 MongoDB 中取來原始數據,直接套用 spark 提
供的分析算法或者使用自定義流程來處理數據,計算完後把相應結果寫回
到 MongoDB 。
使用方式
pyspark --master yarn --packages org.mongodb.spark:mongo-spark-connector_2.11:2.1.0
● 使用jupyter notebook示範
使用方式 - 以 northwind 資料集示範
● 讀取product , suppliers , categories 三個 collection 作 join
● 讀取product , suppliers , categories 三個 collection 作 join
使用方式 - 以 northwind 資料集示範
● 將 join 完的 dataframe 作型態的轉換。
使用方式 - 以 northwind 資料集示範
● 調整值為 null 的欄位,將值設定為非 null (mongoDB connector 無法順利轉換 null 值)
使用方式 - 以 northwind 資料集示範
● 將 join 後的 dataframe 轉為 rdd 並修改為需要的格式
使用方式 - 以 northwind 資料集示範
● 將調整完之後的 rdd 再轉換回 dataframe (配合 connector 需求)
使用方式 - 以 northwind 資料集示範
● 將修改完成的 dataframe 存入 mongoDB 中成為新的 collection
使用方式 - 以 northwind 資料集示範
Thanks for listening!

More Related Content

What's hot

MongoDB at Qihoo 360
MongoDB at Qihoo 360MongoDB at Qihoo 360
MongoDB at Qihoo 360MongoDB
 
OpenStack Introduction Ecosystem
OpenStack Introduction EcosystemOpenStack Introduction Ecosystem
OpenStack Introduction EcosystemNUTC, imac
 
分布式系统缓存设计
分布式系统缓存设计分布式系统缓存设计
分布式系统缓存设计aleafs
 
分布式系统缓存设计
分布式系统缓存设计分布式系统缓存设计
分布式系统缓存设计zhujiadun
 
Redis 常见使用模式分析
Redis 常见使用模式分析Redis 常见使用模式分析
Redis 常见使用模式分析vincent253
 
NoSQL误用和常见陷阱分析
NoSQL误用和常见陷阱分析NoSQL误用和常见陷阱分析
NoSQL误用和常见陷阱分析iammutex
 
nodejs在微博前端开发中的应用
nodejs在微博前端开发中的应用nodejs在微博前端开发中的应用
nodejs在微博前端开发中的应用dong yuwei
 
Ria的强力后盾:rest+海量存储
Ria的强力后盾:rest+海量存储 Ria的强力后盾:rest+海量存储
Ria的强力后盾:rest+海量存储 zhen chen
 
Google IoT Core 初體驗
Google IoT Core 初體驗Google IoT Core 初體驗
Google IoT Core 初體驗Simon Su
 
百姓网如何优化网速-Qcon2011
百姓网如何优化网速-Qcon2011百姓网如何优化网速-Qcon2011
百姓网如何优化网速-Qcon2011Yiwei Ma
 
Seqdb存储引擎
Seqdb存储引擎   Seqdb存储引擎
Seqdb存储引擎 luckywhu
 
高性能并发Web服务器实现核心内幕
高性能并发Web服务器实现核心内幕高性能并发Web服务器实现核心内幕
高性能并发Web服务器实现核心内幕ideawu
 
Huangjing renren
Huangjing renrenHuangjing renren
Huangjing renrend0nn9n
 
作業系統 7 3常見儲存裝置管理範例
作業系統 7 3常見儲存裝置管理範例作業系統 7 3常見儲存裝置管理範例
作業系統 7 3常見儲存裝置管理範例慧鈴 鍾
 
7 3常見儲存裝置管理範例
7 3常見儲存裝置管理範例7 3常見儲存裝置管理範例
7 3常見儲存裝置管理範例慧鈴 鍾
 
Mongo db部署架构之优先方案
Mongo db部署架构之优先方案Mongo db部署架构之优先方案
Mongo db部署架构之优先方案Lucien Li
 
Windows 10 install mysql 8.0.16
Windows 10 install mysql 8.0.16Windows 10 install mysql 8.0.16
Windows 10 install mysql 8.0.16songwenxuan2020
 
SSDB 入门基础
SSDB 入门基础SSDB 入门基础
SSDB 入门基础ideawu
 
Linux Network Monitoring
Linux Network MonitoringLinux Network Monitoring
Linux Network MonitoringKenny (netman)
 

What's hot (20)

MongoDB at Qihoo 360
MongoDB at Qihoo 360MongoDB at Qihoo 360
MongoDB at Qihoo 360
 
OpenStack Introduction Ecosystem
OpenStack Introduction EcosystemOpenStack Introduction Ecosystem
OpenStack Introduction Ecosystem
 
分布式系统缓存设计
分布式系统缓存设计分布式系统缓存设计
分布式系统缓存设计
 
分布式系统缓存设计
分布式系统缓存设计分布式系统缓存设计
分布式系统缓存设计
 
Redis 常见使用模式分析
Redis 常见使用模式分析Redis 常见使用模式分析
Redis 常见使用模式分析
 
NoSQL误用和常见陷阱分析
NoSQL误用和常见陷阱分析NoSQL误用和常见陷阱分析
NoSQL误用和常见陷阱分析
 
nodejs在微博前端开发中的应用
nodejs在微博前端开发中的应用nodejs在微博前端开发中的应用
nodejs在微博前端开发中的应用
 
Ria的强力后盾:rest+海量存储
Ria的强力后盾:rest+海量存储 Ria的强力后盾:rest+海量存储
Ria的强力后盾:rest+海量存储
 
Google IoT Core 初體驗
Google IoT Core 初體驗Google IoT Core 初體驗
Google IoT Core 初體驗
 
百姓网如何优化网速-Qcon2011
百姓网如何优化网速-Qcon2011百姓网如何优化网速-Qcon2011
百姓网如何优化网速-Qcon2011
 
Seqdb存储引擎
Seqdb存储引擎   Seqdb存储引擎
Seqdb存储引擎
 
Redis介绍
Redis介绍Redis介绍
Redis介绍
 
高性能并发Web服务器实现核心内幕
高性能并发Web服务器实现核心内幕高性能并发Web服务器实现核心内幕
高性能并发Web服务器实现核心内幕
 
Huangjing renren
Huangjing renrenHuangjing renren
Huangjing renren
 
作業系統 7 3常見儲存裝置管理範例
作業系統 7 3常見儲存裝置管理範例作業系統 7 3常見儲存裝置管理範例
作業系統 7 3常見儲存裝置管理範例
 
7 3常見儲存裝置管理範例
7 3常見儲存裝置管理範例7 3常見儲存裝置管理範例
7 3常見儲存裝置管理範例
 
Mongo db部署架构之优先方案
Mongo db部署架构之优先方案Mongo db部署架构之优先方案
Mongo db部署架构之优先方案
 
Windows 10 install mysql 8.0.16
Windows 10 install mysql 8.0.16Windows 10 install mysql 8.0.16
Windows 10 install mysql 8.0.16
 
SSDB 入门基础
SSDB 入门基础SSDB 入门基础
SSDB 入门基础
 
Linux Network Monitoring
Linux Network MonitoringLinux Network Monitoring
Linux Network Monitoring
 

Similar to Spark on Yarn & Mongodb(Big Data Platform)

Oda安装 恢复步骤
Oda安装 恢复步骤Oda安装 恢复步骤
Oda安装 恢复步骤n-lauren
 
Spark性能调优分享
Spark性能调优分享Spark性能调优分享
Spark性能调优分享Wenchun Xu
 
Mongo db架构之优先方案
Mongo db架构之优先方案Mongo db架构之优先方案
Mongo db架构之优先方案Lucien Li
 
Mongo db部署架构之优先方案
Mongo db部署架构之优先方案Mongo db部署架构之优先方案
Mongo db部署架构之优先方案Lucien Li
 
Dbabc.net 利用heartbeat + drbd搭建my sql高可用环境
Dbabc.net 利用heartbeat + drbd搭建my sql高可用环境Dbabc.net 利用heartbeat + drbd搭建my sql高可用环境
Dbabc.net 利用heartbeat + drbd搭建my sql高可用环境dbabc
 
探索 ISTIO 新型 DATA PLANE 架構 AMBIENT MESH - GOLANG TAIWAN GATHERING #77 X CNTUG
探索 ISTIO 新型 DATA PLANE 架構 AMBIENT MESH - GOLANG TAIWAN GATHERING #77 X CNTUG探索 ISTIO 新型 DATA PLANE 架構 AMBIENT MESH - GOLANG TAIWAN GATHERING #77 X CNTUG
探索 ISTIO 新型 DATA PLANE 架構 AMBIENT MESH - GOLANG TAIWAN GATHERING #77 X CNTUGYingSiang Geng
 
LinkIt Smart 7688程式開發
LinkIt Smart 7688程式開發LinkIt Smart 7688程式開發
LinkIt Smart 7688程式開發Wei-Tsung Su
 
icecream / icecc:分散式編譯系統簡介
icecream / icecc:分散式編譯系統簡介icecream / icecc:分散式編譯系統簡介
icecream / icecc:分散式編譯系統簡介Kito Cheng
 
Linux network monitoring hands-on pratice
Linux network monitoring hands-on praticeLinux network monitoring hands-on pratice
Linux network monitoring hands-on praticeKenny (netman)
 
OpenStack Introduction Ecosystem
OpenStack Introduction EcosystemOpenStack Introduction Ecosystem
OpenStack Introduction EcosystemNUTC, imac
 
Kmeans in-hadoop
Kmeans in-hadoopKmeans in-hadoop
Kmeans in-hadoopTianwei Liu
 
ElasticSearch Training#2 (advanced concepts)-ESCC#1
ElasticSearch Training#2 (advanced concepts)-ESCC#1ElasticSearch Training#2 (advanced concepts)-ESCC#1
ElasticSearch Training#2 (advanced concepts)-ESCC#1medcl
 
How to plan a hadoop cluster for testing and production environment
How to plan a hadoop cluster for testing and production environmentHow to plan a hadoop cluster for testing and production environment
How to plan a hadoop cluster for testing and production environmentAnna Yen
 
ProtoStar:“次世代”的移动端渲染
ProtoStar:“次世代”的移动端渲染ProtoStar:“次世代”的移动端渲染
ProtoStar:“次世代”的移动端渲染Ning Hu
 
再生龍於雲端環境之應用
再生龍於雲端環境之應用再生龍於雲端環境之應用
再生龍於雲端環境之應用Chenkai Sun
 
The Construction and Practice of Apache Pegasus in Offline and Online Scenari...
The Construction and Practice of Apache Pegasus in Offline and Online Scenari...The Construction and Practice of Apache Pegasus in Offline and Online Scenari...
The Construction and Practice of Apache Pegasus in Offline and Online Scenari...acelyc1112009
 
Kvmopt osforce
Kvmopt osforceKvmopt osforce
Kvmopt osforcemeecheng
 
Spark在苏宁云商的实践及经验分享
Spark在苏宁云商的实践及经验分享Spark在苏宁云商的实践及经验分享
Spark在苏宁云商的实践及经验分享alipay
 

Similar to Spark on Yarn & Mongodb(Big Data Platform) (20)

Oda安装 恢复步骤
Oda安装 恢复步骤Oda安装 恢复步骤
Oda安装 恢复步骤
 
Spark性能调优分享
Spark性能调优分享Spark性能调优分享
Spark性能调优分享
 
Mongo db架构之优先方案
Mongo db架构之优先方案Mongo db架构之优先方案
Mongo db架构之优先方案
 
Mongo db部署架构之优先方案
Mongo db部署架构之优先方案Mongo db部署架构之优先方案
Mongo db部署架构之优先方案
 
Dbabc.net 利用heartbeat + drbd搭建my sql高可用环境
Dbabc.net 利用heartbeat + drbd搭建my sql高可用环境Dbabc.net 利用heartbeat + drbd搭建my sql高可用环境
Dbabc.net 利用heartbeat + drbd搭建my sql高可用环境
 
探索 ISTIO 新型 DATA PLANE 架構 AMBIENT MESH - GOLANG TAIWAN GATHERING #77 X CNTUG
探索 ISTIO 新型 DATA PLANE 架構 AMBIENT MESH - GOLANG TAIWAN GATHERING #77 X CNTUG探索 ISTIO 新型 DATA PLANE 架構 AMBIENT MESH - GOLANG TAIWAN GATHERING #77 X CNTUG
探索 ISTIO 新型 DATA PLANE 架構 AMBIENT MESH - GOLANG TAIWAN GATHERING #77 X CNTUG
 
LinkIt Smart 7688程式開發
LinkIt Smart 7688程式開發LinkIt Smart 7688程式開發
LinkIt Smart 7688程式開發
 
icecream / icecc:分散式編譯系統簡介
icecream / icecc:分散式編譯系統簡介icecream / icecc:分散式編譯系統簡介
icecream / icecc:分散式編譯系統簡介
 
Linux network monitoring hands-on pratice
Linux network monitoring hands-on praticeLinux network monitoring hands-on pratice
Linux network monitoring hands-on pratice
 
OpenStack Introduction Ecosystem
OpenStack Introduction EcosystemOpenStack Introduction Ecosystem
OpenStack Introduction Ecosystem
 
Sth About SSD
Sth About SSDSth About SSD
Sth About SSD
 
Kmeans in-hadoop
Kmeans in-hadoopKmeans in-hadoop
Kmeans in-hadoop
 
ElasticSearch Training#2 (advanced concepts)-ESCC#1
ElasticSearch Training#2 (advanced concepts)-ESCC#1ElasticSearch Training#2 (advanced concepts)-ESCC#1
ElasticSearch Training#2 (advanced concepts)-ESCC#1
 
How to plan a hadoop cluster for testing and production environment
How to plan a hadoop cluster for testing and production environmentHow to plan a hadoop cluster for testing and production environment
How to plan a hadoop cluster for testing and production environment
 
ProtoStar:“次世代”的移动端渲染
ProtoStar:“次世代”的移动端渲染ProtoStar:“次世代”的移动端渲染
ProtoStar:“次世代”的移动端渲染
 
再生龍於雲端環境之應用
再生龍於雲端環境之應用再生龍於雲端環境之應用
再生龍於雲端環境之應用
 
The Construction and Practice of Apache Pegasus in Offline and Online Scenari...
The Construction and Practice of Apache Pegasus in Offline and Online Scenari...The Construction and Practice of Apache Pegasus in Offline and Online Scenari...
The Construction and Practice of Apache Pegasus in Offline and Online Scenari...
 
Kvmopt osforce
Kvmopt osforceKvmopt osforce
Kvmopt osforce
 
Something about Kafka - Why Kafka is so fast
Something about Kafka - Why Kafka is so fastSomething about Kafka - Why Kafka is so fast
Something about Kafka - Why Kafka is so fast
 
Spark在苏宁云商的实践及经验分享
Spark在苏宁云商的实践及经验分享Spark在苏宁云商的实践及经验分享
Spark在苏宁云商的实践及经验分享
 

Spark on Yarn & Mongodb(Big Data Platform)

  • 1. 2017.11.01 大數據平台架構 (Spark on Yarn & MongoDB) -Presentation by Hughe Chen
  • 2. Agenda ● 大數據平台(Spark on Yarn & MongoDB)簡介 ● 環境設定 ○ spark ○ mongoDB ● 使用方式-以 northwind 資料集示範
  • 3. 環境設定 • Host : – i5-4 core, 8G RAM, SATA 256G SSD – OS:centos7 • Guest : – spark-2.1.1 on yarn • nn : 3G ,2core • dn01 : 2G ,1core • dn02 : 2G ,1core – Anaconda2(python2.7.13) – Mongodb-3.4.6 • replica + sharding – mongo-spark connector: • mongo-spark-connector_2.11-2.1.0.jar
  • 4. 平台架構 YARN (Resource Manager) name node Spark (master & worker 1) MongoDB (shard 1) data node 1 data node 2 Spark (worker 3) Spark (worker 2) MongoDB (shard 3) MongoDB (shard 2) replica 1 replica 2 replica 3
  • 5. spark • 使用spark on yarn模式 • 使用動態資源分配 - spark當遇到大量task產生時,動態資源分配將會依照 需求啟動第二和三個excutor,等待執行結束之後,將excutor結束,自動歸 還資源。
  • 6. MongoDB • 使用 replica + sharding 架構 • 設定 wiredTiger 使用 256MB 的記憶體(每個 mongod 實體,最小需求) • 盡量將資料集(collection)控制在 wiredTigercache 內,充分利用cache效能
  • 7. Spark MongoDB平台簡介 • Spark 任務一般由 Spark 的 driver 發起,經過 Spark Master 進行資源調 度分發。 • 每個 excutor 會獨立的去 MongoDB 中取來原始數據,直接套用 spark 提 供的分析算法或者使用自定義流程來處理數據,計算完後把相應結果寫回 到 MongoDB 。
  • 8. 使用方式 pyspark --master yarn --packages org.mongodb.spark:mongo-spark-connector_2.11:2.1.0 ● 使用jupyter notebook示範
  • 9. 使用方式 - 以 northwind 資料集示範 ● 讀取product , suppliers , categories 三個 collection 作 join
  • 10. ● 讀取product , suppliers , categories 三個 collection 作 join 使用方式 - 以 northwind 資料集示範
  • 11. ● 將 join 完的 dataframe 作型態的轉換。 使用方式 - 以 northwind 資料集示範
  • 12. ● 調整值為 null 的欄位,將值設定為非 null (mongoDB connector 無法順利轉換 null 值) 使用方式 - 以 northwind 資料集示範
  • 13. ● 將 join 後的 dataframe 轉為 rdd 並修改為需要的格式 使用方式 - 以 northwind 資料集示範
  • 14. ● 將調整完之後的 rdd 再轉換回 dataframe (配合 connector 需求) 使用方式 - 以 northwind 資料集示範
  • 15. ● 將修改完成的 dataframe 存入 mongoDB 中成為新的 collection 使用方式 - 以 northwind 資料集示範