#!/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 " 33[35mUsage: 33[0m"
echo -e " 33[31mcd {YOUR_DATAX_HOME}/bin 33[0m 该脚本中是: /usr/local/datax/bin/"
echo -e " 33[31mpython datax. py {YOUR_JOB.json} 33[0m" 该脚本中是: python datax.py ../job/job.json
echo " "
echo " "
echo -e " 33[0mmysql数据传输到oracle: 33[0m"
echo -e " python datax.py -r mysqlreader -w oraclewriter"
echo -e " 把生成的json数据样式写到job目录中的任意一个xxx.json文件中,比如为opop.json"
echo -e " 33[0mpython datax.py ../job/opop.json 33[0m"
echo -e "
"
把python datax.py -r mysqlreader -w oraclewriter执行完后的json样式拿下来放到opop.json中
示例:
echo "VIA: https://github.com/alibaba/DataX"