doxgxxn / WILT

0 stars 0 forks source link

231005 / sqoop import,export #62

Open doxgxxn opened 1 year ago

doxgxxn commented 1 year ago
#dockerfile download
https://drive.google.com/uc?id=1-GqkbVQI1XJJoad7m3VWRdG2YMnnr7B_ 를 다시 다운받아 
c:\bigdata_system\docker_file 디렉토리에 복사     

#docker build
docker build -t hadoop_hive_sqoop_pig . -f hadoop_hive_sqoop_pig_dockerfile.txt

#docker run
docker run --hostname=localhost --privileged=true  -it -p 10000:10000 -p 8088:8088 -p 8081:8080 -p 9870:9870 -p 8042:8042 -p 9001:9001 -p 10020:10020 -p 9201:9201 -p 9301:9301 -p 5601:5601 hadoop_hive_sqoop_pig /bin/bash

#한글 출력 설정
localedef -f UTF-8 -i ko_KR ko_KR.UTF-8
#한글 출력 설정
export LC_ALL=ko_KR.UTF-8
#한글 입력 설정
LC_ALL=ko_KR.UTF-8 bash 

#sqoop 시작
/root/hadoop_hive_pig_start.sh

sqoop import \
--connect 'jdbc:mysql://${your_ip}/coin_db?useUnicode=true&serverTimezone=Asia/Seoul' \
--username root \
--password 1234 \
--fields-terminated-by "," \
--hive-import --create-hive-table --hive-table sqoop_coin_tbl -m 1 \
--query 'SELECT num,open_time,open_price,high_price,low_price,close_price,volume,symbol,predic_price FROM coin_tbl WHERE $CONDITIONS' \
--target-dir  hdfs://localhost:9000/coin_data

sqoop export \
--connect 'jdbc:mysql://${your_ip}:3306/coin_db?useUnicode=true&serverTimezone=Asia/Seoul' \
--username root \
--password 1234 \
--table mysql_stock \
--export-dir hdfs://localhost:9000/my_stock/