DataX

#!/bin/bash
[ ! -d /opop ] && mkdir /opop
cd /opop
wget http://192.168.1.129/package/DataX/{jdk11.0.2.tar.gz,maven-3.6.tar.gz,datax.tar.gz}
tar -zxvf jdk11.0.2.tar.gz -C /usr/local/
echo 'export JAVA_HOME=/usr/local/jdk-11.0.2/' >> /etc/profile
echo 'export JRE_HOME=$JAVA_HOME/jre' >> /etc/profile
echo 'export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib' >> /etc/profile
echo 'export PATH=$JAVA_HOME/bin:$PATH'>> /etc/profile
tar -zxvf maven-3.6.tar.gz -C /usr/local/
mv /usr/local/apache-maven-3.6.0/ /usr/local/maven3.6
echo 'export MAVEN_HOME=/usr/local/maven3.6' >>/etc/profile
echo 'PATH=$MAVEN_HOME/bin:$PATH' >>/etc/profile
sleep 2
source /etc/profile
tar -zxvf datax.tar.gz -C /usr/local/
clear
echo -e "\033[35mUsage:\033[0m"
echo -e "\033[31mcd {YOUR_DATAX_HOME}/bin\033[0m    该脚本中是: /usr/local/datax/bin/"
echo -e "\033[31mpython datax. py {YOUR_JOB.json}\033[0m"      该脚本中是: python datax.py ../job/job.json

echo " "
echo " "
echo -e "\033[0mmysql数据传输到oracle:\033[0m"
echo -e "\tpython datax.py -r mysqlreader -w oraclewriter"
echo -e "\t把生成的json数据样式写到job目录中的任意一个xxx.json文件中,比如为opop.json"
echo -e "\033[0mpython datax.py ../job/opop.json\033[0m"
echo -e "\n"

 把python datax.py -r mysqlreader -w oraclewriter执行完后的json样式拿下来放到opop.json中

示例:

 

 

 


echo "VIA: https://github.com/alibaba/DataX"

 

JDK         Maven         DataX  

 

posted @ 2019-03-05 11:06  Linux大魔王  阅读(285)  评论(0编辑  收藏  举报