Import data from SAP HANA to Huawei Cloud big data service: MRS

举报
DuanbinRobin 发表于 2019/08/06 21:37:40 2019/08/06
【摘要】 This document focuses on the process of exporting data from SAP to an MRS cluster.Environmental information:The MRS cluster version uses MRS_2.0.0 as an example (it is recommended to use a normal c...

This document focuses on the process of exporting data from SAP to an MRS cluster.

Environmental information:

  1. The MRS cluster version uses MRS_2.0.0 as an example (it is recommended to use a normal cluster) and install HADOOP and HIVE services.

  2. The operation location is the master node of the cluster;

  3. The SAP server can communicate with the MRS cluster;

  4. 192.168.0.100 (example) is the SAP server IP.

Install Sqoop

1) Download open source Sqoop

http://www.apache.org/dyn/closer.lua/sqoop/1.4.7

2) Put the downloaded sqoop-1.4.7.bin__hadoop-2.6.0.tar.gz package into the /opt/sqoop directory of the MRS cluster master node and extract it.

3) Enter the directory where the decompression is completed, modify the permissions and configuration

chmod 755 -R /opt/sqoop/sqoop-1.4.7.bin__hadoop-2.6.0
chown omm:wheel -R /opt/sqoop/sqoop-1.4.7.bin__hadoop-2.6.0
cd /opt/sqoop/sqoop-1.4.7.bin__hadoop-2.6.0/conf
cp sqoop-env-template.sh sqoop-env.sh
vi sqoop-env.sh

Add configuration:

export HADOOP_COMMON_HOME=/opt/client/HDFS/hadoop
export HADOOP_MAPRED_HOME=/opt/client/HDFS/hadoop
export HIVE_HOME=/opt/Bigdata/MRS_2.0.0/install/FusionInsight-Hive-3.1.0/hive-3.1.0
export HIVE_CONF_DIR=/opt/client/Hive/config
export HCAT_HOME=/opt/client/Hive/HCatalog

4) Add system variables and add SQOOP_HOME to your PATH

vi /etc/profile

Add some information:

export SQOOP_HOME=/opt/sqoop-1.4.7.bin__hadoop-2.6.0
export PATH=$PATH:$SQOOP_HOME/bin

After loading the environment

source /etc/profile
source /opt/client/bigdata_env


Import data from SAP HANA into HDFS

Obtain ngdbc.jar from the hdbclient folder of the SAP node (the general address is C:\Program Files\SAP\hdbclient). This is the driver that connects to the SAP HANA system. Put this Jar package into the Sqoop lib folder. Inside and change permissions

sqoop import \
--username SYSTEM \
--password **** \
--connect jdbc:sap://192.168.0.100:30215/?currentschema=SYSTEM \
--driver com.sap.db.jdbc.Driver \
--table test02 \
--m 1 \
--target-dir /tmp/test06
--username      SAP HANA username
--password      SAP HANA password
--connect       SAP IP and port
--driver        driver type
--table         table name
--m 1           process number
--target-dir    HDFS path for storage

After the operation is complete, go to view the data on HDFS:

image

Get data from SAP HANA and import it into HIVE

Obtain ngdbc.jar from the hdbclient folder of the SAP node (the general address is C:\Program Files\SAP\hdbclient). This is the driver that connects to the SAP HANA system. Put this Jar package into the Sqoop lib folder. Inside and change permissions

sqoop import \
--username SYSTEM \
--password **** \
--connect jdbc:sap://192.168.0.100:30215/?currentschema=SYSTEM \
--driver com.sap.db.jdbc.Driver \
--table TEST01 \
--m 1 \
--hive-import \
--direct
--username      SAP HANA username
--password      SAP HANA password
--connect       SAP IP and port
--driver        driver type
--table         table name
--m 1           process number
--hive-import
--direct


Enter beeline

Check whether the hive table has been imported

select * from test01;

image

Common error message:

1, if the report can not find the class: jline.console.completer.ArgumentCompleter

Need to add the missing jar package to Sqoop's lib folder

cp /opt/share/jline-2.12/jline-2.12.jar /opt/sqoop/sqoop-1.4.7.bin__hadoop-2.6.0/lib/

2. If you report the error: TEST01 table already exists, you need to delete or rename the TEST01 table storage address first (change the table name)

image

other problems:

1, the table name can not have "." (can not use the table name such as default.test01), if you need to specify the library, add the parameter currentschema=SYSTEM after the connection address

--connect jdbc:sap://192.168.0.100:30215/?currentschema=SYSTEM \

2. If there is no suitable type for the SAP data type to be converted to the HDFS data type, you need to change the type to a simpler data type.

3, the current test is a normal cluster, whether the security cluster has a certification problem has not been tested








【版权声明】本文为华为云社区用户翻译文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容, 举报邮箱:cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。