将mysql数据导入hbase

#MySQL导出本地文件
mysql -A monitor_data -h 172.16.100.208 -uroot -p7ujm8ik, -ss -e “SELECT * from kpi;” | sed ‘s/\t/","/g;s/^/"/;s/$/"/;s/\n//g’ > kpi1.csv

#远程数据导出到本地
ssh [email protected] ‘mysql -A monitor_data -h 172.16.100.208 -uroot -ptrustfar -ss -e “SELECT * from KPI;”’ | sed ‘s/\t/","/g;s/^/"/;s/$/"/;s/\n//g’>1.csv

#上传hdfs
hdfs dfs -put /本地文件路径 /hdfs的路径
hdfs dfs -put /data/perform1.csv /perform1.csv

#hdfs中的csv文件导入hbase
./bin/hbase org.apache.hadoop.hbase.mapreduce.ImportTsv -Dimporttsv.separator=’,’ -Dimporttsv.columns=‘HBASE_ROW_KEY,cf1:CI_ID,cf1:CI_NAME’ ‘表名’ hdfs:/user/trustfar/perform1.csv

你可能感兴趣的:(hdfs)