2019独角兽企业重金招聘Python工程师标准>>>
#Teradata Sqoop部署过程 ##驱动包下载 下载sqoop-connector-teradata.jar
- sqoop-connector-teradata-1.6c5.jar
下载teradata jdbc jar
- terajdbc4.jar
- tdgssconfig.jar
拷贝至$SQOOP_HOME/lib
##配置teradata sqoop驱动 cd $SQOOP_HOME/conf mkdir managers.d chmod 755 manager.d cd manager.d vi cldra_td_connector com.cloudera.connector.teradata.TeradataManagerFactory=/opt/beh/core/sqoop/lib/sqoop-connector-teradata-1.6c5.jar
在sqoop-site.xml中添加
configuration>
sqoop.connection.factories
com.cloudera.sqoop.manager.DefaultManagerFactory,com.cloudera.connector.teradata.TeradataManagerFactory
#Sqoop命令 ##Oracle
查看Oracle是否可用JDBC连接
sqoop list-tables --verbose --connect jdbc:oracle:thin:@172.16.13.137:1521/xe --username BDC --password bdc123
Hive->Oracle
sqoop export --connect jdbc:oracle:thin:@172.16.13.137:1521/xe --username BDC --password bdc123 --table TABLE2 --fields-terminated-by '^A' --export-dir /user/hive/warehouse/table1 -m 1 --input-null-string '\\N' --input-null-non-string '\\N'
Oracle->Hive
sqoop import --connect jdbc:oracle:thin:@172.16.13.137:1521/xe --username BDC --password bdc123 --table TABLE2 --fields-terminated-by '^A' --hive-overwrite --hive-database default --hive-table table1 -m 1
##Teradata
查看Teradata是否可用JDBC连接
sqoop list-tables --verbose --connect "jdbc:teradata://192.168.246.128/test" --username RENGENG --password rengeng --driver com.teradata.jdbc.TeraDriver
HDFS(Hive)->Teradata
sqoop export --connect jdbc:teradata://192.168.246.128/DATABASE=rengeng --username RENGENG --password rengeng --table TABLE2 --fields-terminated-by '^A' --export-dir /user/hive/warehouse/table1 -m 1 --update-mode allowinsert
Teradata->Hive
sqoop import --hive-import --connect jdbc:teradata://192.168.246.128/DATABASE=rengeng --username RENGENG --password rengeng --table TABLE1 --fields-terminated-by '^A' --hive-overwrite --hive-database default --hive-table table1 -m 1 --delete-target-dir --verbose --split-by name
Teradata->HDFS
sqoop import --connect jdbc:teradata://192.168.246.128/DATABASE=rengeng --username RENGENG --password rengeng --table TABLE1 --fields-terminated-by '^A' --target-dir /user/hive/warehouse/table1 --delete-target-dir -m 1 --delete-target-dir --verbose --split-by name
Teradata-(SQL)>HDFS
sqoop import --connect jdbc:teradata://192.168.246.128/DATABASE=rengeng --username RENGENG --password rengeng --fields-terminated-by '^A' --target-dir /user/hive/warehouse/table1 --delete-target-dir -m 1 --delete-target-dir --verbose --split-by name -e "select * from rengeng.table1 where \$CONDITIONS"
#Teredata vmware使用 ##vmware安装使用
- 安装vmware,导入系统(注意td提供的版本是64位的)
- Linux系统:root/root
- 配置ip: Enter a cop entry in the linux hosts file (/etc/hosts accessible from the linux command line in the VMware console, ie. c:>vi /etc/hosts) Should be something like "192.168.186.128 hyperjcop1 dbccop1" Use "/sbin/ifconfig" command on linux vm to find the ipaddress
- 启动服务:/etc/init.d/tpa start (tpa stop停止服务) 正常情况会打印下面两行信息,表示启动成功。 Teradata database inititiator service is starting。。。 pde(pdemain) already running :use ‘tpareset -f force’
- td的默认用户名密码:dbc/dbc
##2.2、Teradata数据库登录 bteq .logon 127.0.0.1/dbc --password dbc
##2.3、数据库创建
- 创建一个数据库的命令举例:
Create database test as perm=200000000,spool=100000000; - 2、创建用户的命令实例:
Create user rengeng as perm=200000000,spool=100000000,password=rengeng; - 3、创建表
create table rengeng.table1(id integer,name varchar(5));