etl工程跑的时候有概率会报以下错误:
at org.pentaho.big.data.impl.vfs.hdfs.nc.NamedClusterProvider.closeFileSystem(NamedClusterProvider.java:195)
at org.pentaho.di.core.vfs.ConcurrentFileSystemManager.closeEmbeddedFileSystem(ConcurrentFileSystemManager.java:192)
at org.pentaho.di.core.vfs.KettleVFS.closeEmbeddedFileSystem(KettleVFS.java:502)
at org.pentaho.di.base.AbstractMeta.disposeEmbeddedMetastoreProvider(AbstractMeta.java:2054)
at org.pentaho.di.job.Job.execute(Job.java:626)
at org.pentaho.di.job.Job.execute(Job.java:821)
at org.pentaho.di.job.Job.execute(Job.java:559)
at org.pentaho.di.job.entries.job.JobEntryJobRunner.run(JobEntryJobRunner.java:69)
at java.lang.Thread.run(Thread.java:748)
查阅了一些资料以及翻阅源码:
首先外网资料:
https://jira.pentaho.com/browse/PDI-18940
Could this be related to PDI-18465?
If there are multiple jobs running on the same machine and PENTAHO_METASTORE_FOLDER defaults to users's home, if the first disposes of it, the rest fail with above error.
原因好像是同一台机器前一个任务占用了PENTAHO_METASTORE_FOLDER,导致后面的任务使用不了,抛错处理失败了。
然后我翻了下jar包的源码:
…\data-integration\system\karaf\system\pentaho\pentaho-big-data-impl-vfs-hdfs\8.2.0.0-342\pentaho-big-data-impl-vfs-hdfs-8.2.0.0-342.jar
IMetaStore defaultMetastore = this.metaStoreService.getMetastore();
为第195行
public void closeFileSystem(String embeddedMetastoreKey) {
IMetaStore defaultMetastore = this.metaStoreService.getMetastore();//L195
IMetaStore embeddedMetastore = this.metaStoreService.getExplicitMetastore(embeddedMetastoreKey);
if (this.cacheEntries.get(embeddedMetastoreKey) != null) {
for (FileSystem fs : this.cacheEntries.get(embeddedMetastoreKey)) {
closeFileSystem(fs);
}
所以先准备尝试配置下
参阅
https://jira.pentaho.com/browse/PDI-18465
对OPT追加配置 “-DPENTAHO_METASTORE_FOLDER=%PENTAHO_METASTORE_FOLDER%”
因为偶然出现的,无法复现,所以观望下后续是否会解决。
The spoon.bat and .sh scripts are missing the -DPENTAHO_METASTORE_FOLDER
Workaround is to edit this line in spoon.bat:
set OPT=%OPT% %PENTAHO_DI_JAVA_OPTIONS% "-Dhttps.protocols=TLSv1,TLSv1.1,TLSv1.2" "-Djava.library.path=%LIBSPATH%" "-DKETTLE_HOME=%KETTLE_HOME%" "-DKETTLE_REPOSITORY=%KETTLE_REPOSITORY%" "-DKETTLE_USER=%KETTLE_USER%" "-DKETTLE_PASSWORD=%KETTLE_PASSWORD%" "-DKETTLE_PLUGIN_PACKAGES=%KETTLE_PLUGIN_PACKAGES%" "-DKETTLE_LOG_SIZE_LIMIT=%KETTLE_LOG_SIZE_LIMIT%" "-DKETTLE_JNDI_ROOT=%KETTLE_JNDI_ROOT%"
and add:
"-DPENTAHO_METASTORE_FOLDER=%PENTAHO_METASTORE_FOLDER%"
similar change to spoon.sh needed.
20210827更新:
补充下修正之后的日志记录:
我以为没人看的,就没更新。
过了4个月后,问题还是存在,METASTORE应该有个默认值,所以我这边觉得配不配无所谓。
主要问题一个任务内存在大量并行任务的老不定期报错,其他任务都不报错。估计主要还是因为并行任务抢占METASTORE导致的。网上查了下,没找到怎么设置线程层次的METASTORE。那就只能把并行改成串行的。
我先不改串行,优化了几点试试看:
1、修改内存配置
spoon.sh文件内修改,增加一倍尝试下。
注意:Xmx不能高于机器内存的1/4,Xms、MaxPermSize不能高于Xmx
if [ -z "$PENTAHO_DI_JAVA_OPTIONS" ]; then
PENTAHO_DI_JAVA_OPTIONS="-Xms1024m -Xmx2048m -XX:MaxPermSize=256m"
fi
2、删除缓存文件
接手之前不知道为啥data-integration下会存在一个 D:\kettle8.2\data-integration\system\karaf\caches\pan\data-1 的文件夹(linux系统),估计是之前在windows上面执行过后放到linux上面的,删除了看看效果。
其他运行缓存:
data内没有啥文件,删不删无所谓
rm -rf XXX/data-integration/system/karaf/caches
#rm -rf XXX/data-integration/system/karaf/data
3、其他配置文件
XXX/data-integration/system/karaf/instances/instance.properties
原先居然在D:/XXX/karaf
item.0.loc = XXX/data-integration/system/karaf
20220225更新:
查询到猜测是否是metastore使用hive导致的,所以可能是hive锁导致的。关闭并发
hive.support.concurrency默认是true
找到data-integration\plugins\pentaho-big-data-plugin\hadoop-configurations\cdh514\hive-site.xml
hive.support.concurrency改成false
20220315还是报错,还是没什么用。
20220819更新:
这几天有空又查看了些资料
https://www.jianshu.com/p/eca6eff9360a
HDFS的FileSystem非线程安全,所以并行会报错,但是找不到kettle设置"fs.hdfs.impl.disable.cache"参数的地方。
搜了配置只找到2个和cache有关的参数,hdfs的一个配置文件\data-integration\plugins\pentaho-big-data-plugin\plugin.properties,另一个是karaf的,暂时先没处理。
# Enables the use of Hadoop's Distributed Cache to store the Kettle environment required to execute Pentaho MapReduce
# If this is disabled you must configure all TaskTracker nodes with the Pentaho for Hadoop Distribution
# @deprecated This is deprecated and is provided as a migration path for existing installations.
pmr.use.distributed.cache=true
我没用hdfs但为啥会报这个错就很奇怪。
改成pmr.use.distributed.cache=false试一下。但是写着是弃用,只能先试试看。
上面的20220225改的部分,应该没有指定使用cdh514,所以应该没有改的必要。
20240611更新:
部署到新环境时候发现可能是在生成随机数的时候卡住,改spoon、kitchen、pan脚本(Windows:bat;linux:sh)就行。刚改,持续跟进下。(只改spoon好像无效)
增加启动参数-Djava.security.egd=file:/dev/urandom
spoon.sh
OPT="$OPT $PENTAHO_DI_JAVA_OPTIONS -Djava.security.egd=file:/dev/urandom -Dhttps.protocols=TLSv1,TLSv1.1,TLSv1.2 -Djava.library.path=$LIBPATH -DKETTLE_HOME=$KETTLE_HOME -DKETTLE_REPOSITORY=$KETTLE_REPOSITORY -DKETTLE_USER=$KETTLE_USER -DKETTLE_PASSWORD=$KETTLE_PASSWORD -DKETTLE_PLUGIN_PACKAGES=$KETTLE_PLUGIN_PACKAGES -DKETTLE_LOG_SIZE_LIMIT=$KETTLE_LOG_SIZE_LIMIT -DKETTLE_JNDI_ROOT=$KETTLE_JNDI_ROOT -DPENTAHO_METASTORE_FOLDER=/home/axxt/data-integration/pentaho/"
kitchen.sh
"$DIR/spoon.sh" -main org.pentaho.di.kitchen.Kitchen -Djava.security.egd=file:/dev/urandom -initialDir "$INITIALDIR/" "$@"
pan.sh
"$DIR/spoon.sh" -main org.pentaho.di.pan.Pan -Djava.security.egd=file:/dev/urandom -initialDir "$INITIALDIR/" "$@"