Use kettle timing extraction tool mysql data to the cluster table hbase (II)

Installation kettle

 

Kettle official website to download the installation package, version 7.1

1. After installation is complete Spoon.bat found in the installation directory, click will start keetle, as shown in

 

After starting the interface:

 

Start the problems encountered

提示错误[mysql] : org.pentaho.di.core.exception.KettleDatabaseException: 
      Error occured while trying to connect to the database
      Driver class 'org.gjt.mm.mysql.Driver' could not be found, make sure the 'MySQL' driver (jar file) is installed.
      org.gjt.mm.mysql.Driver

Lack mysql driver jar package, download the mysql-connector-java-5.1.21- bin.jar in the lib directory of the files in the folder kettle, restart the kettle.

 

 

Configuration conversion task

1. After a successful start, the upper left corner click on the "File - New - Convert" Save as demo.ktr

 

2. Open the left core object - "Input -" input table, the intermediate drag

 

Double-click to open, click New

 

Select the database type, fill the database configuration parameters Click OK

 

Click Preview to fill the number of rows you want to query, indicating that if they can get the data mysql configured correctly

 

3. Turn on the left side of the core -> big data -> Hadoop File output, the table and drop to the right, and is connected to the destination end

用鼠标中建连接源端与目标端,或者选中源端,按 shift 将源端指向目标端,如下图:

 

双击 Hadoop File output,点击new,配置hadoop需要的参数,把红色箭头指向的填好即可,其他的默认。然后点击测试

 

此时会弹出hadoop版本信息,记下CDH5.8,之后可能会用

 

 

测试结果如图:

 

我们所要达到的效果是前三个为绿沟。但是可能会遇到一些错误。

1)第一个Active Shim Load为红叉。

打开plugins\pentaho-big-data-plugin\plugin.properties 文件

修改 active.hadoop.configuration 为 active.hadoop.configuration=cdh58

 红字部分,就是我们上面记录的版本信息,保存现有配置,重启kettle

 

2)再次测试可能第二个Shim Configuration Verification为黄色感叹号。

复制集群中的 core-site.xml,将该 xml 文件复制到 plugins\pentaho-big-data-plugin\hadoop-configurations\cdh58,替换原有 core-site.xml。记得将原先的core-site.xml备份乙方改出问题进行回退

测试成功后回到原先的界面,选择我们刚刚配置的hadoop连接。

Folder/File/java/kt是我们数据库的数据在hadoop系统中的存放地址,其中kt是文件名,txt是文件后缀。

到此,mysql抽取数据到hadoop的转换过程配置完毕,下面开始执行。

 

执行转换过程

1.点击左上角 文件-》新建—》作业。

   点击核心对象-》通用,将start和转换拖入作业中,通箭头连接(按住shift从start拖向转换)

 

2.双击转换,选择我们刚刚自定义的转换.ktr文件,并自定义转换的名称

 

点击start,选择一个路径存放运行结果.kjb文件。查看下方日志看是否成功。

 

 

执行完可能遇到的错误:没有权限在hadoop中创建和打开文件。此时需要去hadoop系统中放开该路径下的权限。

执行命令

$hadoop  fs  -chmod  777  /java

 

在hadoop中验证结果

进入hadoop系统中,执行hadoop命令,查看对应的路径下的文件及其内容

$hadoop  fs  -text /java/kt2.txt

对比数据库中的数据

抽取成功。

 

 

 

 

Guess you like

Origin blog.csdn.net/github_39538842/article/details/92611487