Cov txheej txheem:

Skoop siv dab tsi los import thiab xa cov ntaub ntawv?
Skoop siv dab tsi los import thiab xa cov ntaub ntawv?

Video: Skoop siv dab tsi los import thiab xa cov ntaub ntawv?

Video: Skoop siv dab tsi los import thiab xa cov ntaub ntawv?
Video: Statistics with Python! Variance and Standard Deviation 2024, Hlis ntuj nqeg
Anonim

Sqoop yog ib lub cuab yeej tsim los hloov cov ntaub ntawv nruab nrab ntawm Hadoop thiab kev sib txheeb databases. Sqoop automates feem ntau ntawm cov txheej txheem no, tso siab rau database piav schema rau lub cov ntaub ntawv ua imported . Sqoop siv MapReduce rau import thiab export cov ntaub ntawv , uas muab kev ua haujlwm sib luag nrog rau kev ua txhaum cai.

Ntawm no, kuv yuav export cov ntaub ntawv los ntawm skoop li cas?

Pib pib

  1. Kauj Ruam 1: Tsim cov ntaub ntawv tshiab hauv MySQL piv txwv. Tsim DATABASE db1;
  2. Tsim ib lub rooj hu ua acad.
  3. Kauj ruam 3: Export cov ntaub ntawv input.txt thiab input2.txt los ntawm HDFS rau MySQL. skoop export –connect jdbc:mysql://localhost/db1 –username skoop –password root –table acad –export-dir /sqoop_msql/ -m 1.

Tsis tas li ntawd, skoop export ua haujlwm li cas? Sqoop - Export Sqoop export cov lus txib npaj INSERT cov lus nrog cov ntaub ntawv nkag mus rau hauv cov ntaub ntawv. Nws yog rau kev xa tawm cov ntaub ntawv tshiab, Yog tias lub rooj muaj tus nqi tshwj xeeb tas li nrog tus yuam sij tseem ceeb, xa tawm txoj haujlwm tsis ua haujlwm raws li cov lus qhia tsis ua haujlwm. Yog tias koj muaj qhov hloov tshiab, koj tuaj yeem siv --update-key xaiv.

Ib yam li ntawd, tib neeg nug, Kuv yuav import cov ntaub ntawv li cas rau hauv skoop?

Nov yog dab tsi txhua tus Sqoop hais kom ua kev xaiv txhais tau tias:

  1. txuas – Muab jdbc hlua.
  2. username – Database username.
  3. -P - Yuav nug tus password hauv console.
  4. table – Qhia lub computer twg lub rooj koj xav import los ntawm MySQL.
  5. split-los ntawm - Qhia koj cov kab sib cais.
  6. target-dir – HDFS lo lus uas peb directory.

Scoop import yog dab tsi?

Sqoop cuab tam ' ntshuam ' yog siv rau ntshuam cov ntaub ntawv los ntawm lub rooj mus rau Hadoop cov ntaub ntawv kaw lus ua cov ntawv nyeem lossis cov ntaub ntawv binary. Cov lus txib hauv qab no yog siv rau ntshuam lub emp rooj los ntawm MySQL database server rau HDFS.

Pom zoo: