Demo connecteur Hadoop de MongoDB
Slides : http://fr.slideshare.net/BrunoBonnin/mug-nantes-mongodb-et-son-connecteur-pour-hadoop
- Java
cd spark/java
mvn clean package assembly:single
- Clean (mongo shell)
use marketdata
db.stock_prices.drop()
- Source : cf. http://www.barchartmarketdata.com/data-samples/mstf.csv
- Import
mongoimport nom_fichier.csv --type csv --headerline -d marketdata -c stock_prices
- Data des sociétés (fichier texte mis dans HDFS)
data/put-hdfs.sh
- Création table des sociétés
hive -f hive/0-create-company.sql
- Création table externe
hive -f hive/1-create-stock-prices.sql
- Select sur la nouvelle table
hive -f hive/2-select-from-stock-prices.sql
- Création table des max/min
hive -f hive/3-create-max-min-prices.sql
- Insertion des données dans table des max/min
hive -f hive/4-insert-max-min-prices.sql
- Select dans table des max/min
hive -f hive/5-select-max-min-prices.sql
- Clean (mongo shell)
use marketdata
db.max_min_prices.drop()
- Lancement tâche Spark
spark/run-java-connector-demo.sh
- Check data (mongo shell)
use marketdata
db.max_min_prices.find().sort({"Day":1})
- Clean HDFS
hdfs dfs -rm -r data/spark_result
- Lancement tâche Spark
spark/run-py-connector-demo.sh
- Check data
hdfs dfs -cat data/spark_result/part-00000