Sqoop export error

Lยท2022๋…„ 10์›” 4์ผ
0
post-thumbnail
post-custom-banner

๋…์ž ๋Œ€์ƒ๐Ÿ“ฃ

๐Ÿ‘‰ Sqoop์„ ์‚ฌ์šฉํ•˜์—ฌ Hive to MySQL ๋งˆ์ด๊ทธ๋ ˆ์ด์…˜ํ•˜๋ ค๋Š” ๋ถ„
๐Ÿ‘‰ Ubuntu ํ™˜๊ฒฝ์—์„œ ๊ตฌ์ถ•ํ•˜์‹œ๋Š” ๋ถ„


์ถœ๊ฐ„ ์ด์œ โ“

Sqoop export ์‹œ, ์˜ค๋ฅ˜ ๋ฐœ์ƒ ํ™•์ธ


๋ฌธ์ œ ํŒŒ์•…๐Ÿ”

...
2022-10-04 14:40:07,033 INFO mapreduce.Job: Job job_1662078057204_0026 failed with state FAILED due to: Task failed task_1662078057204_0026_m_000002 Job failed as tasks failed. failedMaps:1 failedReduces:0 killedMaps:0 killedReduces: 0 

2022-10-04 14:40:07,116 INFO mapreduce.Job: Counters: 12 
	Job Counters 
    	Failed map tasks=1 
        Killed map tasks=3 
        Launched map tasks=4 
        Data-local map tasks=4 
        Total time spent by all maps in occupied slots (ms)=31217 
        Total time spent by all reduces in occupied slots (ms)=0 
        Total time spent by all map tasks (ms)=31217 
        Total vcore-milliseconds taken by all map tasks=31217 
        Total megabyte-milliseconds taken by all map tasks=31966208 
	Map-Reduce Framework 
     	CPU time spent (ms)=0 
        Physical memory (bytes) snapshot=0 
        Virtual memory (bytes) snapshot=0 
2022-10-04 14:40:07,124 WARN mapreduce.Counters: Group FileSystemCounters is deprecated. Use org.apache.hadoop.mapreduce.FileSystemCounter instead 
2022-10-04 14:40:07,125 INFO mapreduce.ExportJobBase: Transferred 0 bytes in 21.0529 seconds (0 bytes/sec) 
2022-10-04 14:40:07,128 INFO mapreduce.ExportJobBase: Exported 0 records. 
2022-10-04 14:40:07,128 ERROR mapreduce.ExportJobBase: Export job failed! 
2022-10-04 14:40:07,128 ERROR tool.ExportTool: Error during export: 
Export job failed! at org.apache.sqoop.mapreduce.ExportJobBase.runExport(ExportJobBase.java:445) 
	at org.apache.sqoop.manager.SqlManager.exportTable(SqlManager.java:931) 
	at org.apache.sqoop.tool.ExportTool.exportTable(ExportTool.java:80) 
	at org.apache.sqoop.tool.ExportTool.run(ExportTool.java:99) 
	at org.apache.sqoop.Sqoop.run(Sqoop.java:147) 	
    at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:76) 
    at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:183) 
    at org.apache.sqoop.Sqoop.runTool(Sqoop.java:234) 
    at org.apache.sqoop.Sqoop.runTool(Sqoop.java:243) 
    at org.apache.sqoop.Sqoop.main(Sqoop.java:252)
...
Q: sqoop export๋กœ hive์—์„œ mysql๋กœ 
   ๋ฐ์ดํ„ฐ ๋งˆ์ด๊ทธ๋ ˆ์ด์…˜์„ ํ•˜๋ ค๋Š”๋ฐ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•ด์š”..๐Ÿ˜ฅ

๋ฌธ์ œ ํ•ด๊ฒฐ๐ŸŽŠ

A: ์šฐ์„  yarn log๋ฅผ ํ™•์ธํ•˜์…”์•ผํ•ฉ๋‹ˆ๋‹ค๐Ÿ˜€

   ์ปค๋งจ๋“œ๋กœ ํ™•์ธํ•  ์ˆ˜๋„ ์žˆ๋Š”๋ฐ, ์œ ์ €/๊ถŒํ•œ์ด ๋ถˆ์ผ์น˜ํ•˜์—ฌ
   ๋ณผ ์ˆ˜ ์—†๋Š” ๊ฒฝ์šฐ๊ฐ€ ์ข…์ข… ์žˆ์Šต๋‹ˆ๋‹ค.
   ex) Docker๋กœ Hadoop eco system ๊ตฌ์ถ• ๋“ฑ
   
   ๊ฐ€์žฅ ์‰ฝ๊ฒŒ ๋กœ๊ทธ๋ฅผ ํ™•์ธํ•˜๋Š” ๋ฐฉ๋ฒ•์€ WEB HDFS์— ์ ‘์†ํ•˜๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹คโ—

   ํ•˜๋‹จ์˜ ๋‚ด์šฉ์„ ์ฐธ๊ณ ํ•˜์—ฌ ์ด Disgustingํ•œ ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜์‹ญ์‹œ์˜คโ—โ—
  1. NameNode์˜ ์ฃผ์†Œ๋กœ WEB HDFS ์ ‘์†
    # ์ปจํ…Œ์ด๋„ˆ ๋กœ๊ทธ 1๋กœ ๋๋‚˜๋Š” ๋””๋ ‰ํ„ฐ๋ฆฌ๋กœ ์ ‘๊ทผ
    ๊ฒฝ๋กœ: /logs/userlogs/application_xxxxxxxx_xx/container_xxxx_xxxx_xx_xxxxx1/
  2. ๋””๋ ‰ํ„ฐ๋ฆฌ ๋‚ด, ๋กœ๊ทธ ํŒŒ์ผ ํ™•์ธ
    ๋กœ๊ทธ ํŒŒ์ผ๋ช…: syslog
  3. ํ•„์ž์˜ ์˜ค๋ฅ˜ -> MySQL ์ ‘๊ทผ ๊ถŒํ•œ
    ...
    2022-10-04 05:40:04,716 INFO [AsyncDispatcher event handler org.apache.hadoop.mapreduce.v2.app.job.impl.TaskAttemptImpl: Diagnostics report from attempt 1662078057204 0026 m 000000 0: Error: java.io.I0Exception: java.sql.SQLException: null, message from server: "Host 'mycluster' is not allowed to connect to this MySOL server"
    ...
    # MySQL์— ์ ‘์†ํ•˜์—ฌ 'mycluster' ๋ผ๋Š” ์ปจํ…Œ์ด๋„ˆ์˜ ์ ‘๊ทผ๊ถŒํ•œ์„ ์ƒ์„ฑ ๋ฐ ๋ถ€์—ฌํ•ด์•ผํ•œ๋‹ค.
    # Hive๊ฐ€ HDFS ๊ธฐ๋ฐ˜์ด๊ธฐ ๋•Œ๋ฌธ์— HDFS์˜ Avtive NameNode์ธ mycluster์˜ ๊ถŒํ•œ์ด ํ•„์š”ํ•œ๊ฐ€ ๋ด…๋‹ˆ๋‹ค๐Ÿ˜Š
  4. MySQL์— ์ ‘์†ํ•˜์—ฌ ์ ‘๊ทผ๊ถŒํ•œ ๋ถ€์—ฌํ•˜๊ธฐ
    # ํ•˜๋‹จ์˜ sql ์ปค๋งจ๋”ฉ ์‹œ, ๊ถŒํ•œ ์ƒ์„ฑ ๋ฐ ๋ถ€์—ฌ ์™„๋ฃŒ
    # sqoop export ๋˜ํ•œ ํ•ด๊ฒฐ๋˜์—ˆ์Œ
    > create user root@[mycluster ip address] identified by '[password]';
    > grant all privileges on [database].* to root@[mycluster ip addr];
    > flush privileges;
profile
๋ฐ์ดํ„ฐ ์š”๋ฆฌ์‚ฌ
post-custom-banner

0๊ฐœ์˜ ๋Œ“๊ธ€