用数据库作用kettle资源库会在数据库中建立很多表,所以就选择用文件资源库的方式。如果单纯的使用文件方式而非文件资源库的方式,在job引用转换的时候要选择文件本地路径,从windows移植到linux中路径就出现问题,虽然可以手动修改一下,但是每次都修改就烦人了。
使用文件资源库就简单多了。
当然,使用资源库就需要上传.kettle文件夹到linux,如果在linux中使用过kettle的话,在用户目录下会自动建好.kettle文件夹,如果没有使用过,可能还没有这个文件夹,那就手动创建。不过创建了也并不可见。位置在/home/user/.kettle
我的资源库内容:repositories.xml
<?xml version="1.0" encoding="UTF-8"?> <repositories> <repository> <id>KettleFileRepository</id> <name>fileRepository</name> <description>filereposity</description> <base_directory>C:\Data\kettleRepository</base_directory> <read_only>N</read_only> <hides_hidden_files>N</hides_hidden_files> </repository> </repositories>
<base_directory>部分是在windows下的资源库路径,上传到linux中需要改为linux下的资源库路径。然后可以将windows下设计好的转换和job都放到这个文件夹下。
最后是调用job脚本:/opt/kettle/data-integration/kitchen.sh -rep=fileRepository -job=testjob
指定资源库ID和job名称。