๐ 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๋ก ๋๋๋ ๋๋ ํฐ๋ฆฌ๋ก ์ ๊ทผ
๊ฒฝ๋ก: /logs/userlogs/application_xxxxxxxx_xx/container_xxxx_xxxx_xx_xxxxx1/
๋ก๊ทธ ํ์ผ๋ช
: syslog
...
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์ ๊ถํ์ด ํ์ํ๊ฐ ๋ด
๋๋ค๐
# ํ๋จ์ sql ์ปค๋งจ๋ฉ ์, ๊ถํ ์์ฑ ๋ฐ ๋ถ์ฌ ์๋ฃ
# sqoop export ๋ํ ํด๊ฒฐ๋์์
> create user root@[mycluster ip address] identified by '[password]';
> grant all privileges on [database].* to root@[mycluster ip addr];
> flush privileges;