Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

线上ES集群同步至ES集群报错 #33

Open
WayneLee5991 opened this issue Oct 30, 2020 · 3 comments
Open

线上ES集群同步至ES集群报错 #33

WayneLee5991 opened this issue Oct 30, 2020 · 3 comments
Assignees
Labels

Comments

@WayneLee5991
Copy link

ES版本7.3.2,有密码,
报错信息为:ESIndex not seted、

本地ES集群没密码,不报错

@yin-bp
Copy link
Contributor

yin-bp commented Oct 30, 2020

错误堆栈信息发出来,bboss的版本号也发出来

@WayneLee5991
Copy link
Author

错误信息:
Exception in thread "Elasticsearch-Elasticsearch-Tran" org.frameworkset.elasticsearch.ElasticSearchException: org.frameworkset.tran.ESDataImportException: ESIndex type not seted.
at org.frameworkset.tran.BaseElasticsearchDataTran.parallelBatchExecute(BaseElasticsearchDataTran.java:210)
at org.frameworkset.tran.BaseDataTran.tran(BaseDataTran.java:73)
at org.frameworkset.tran.es.output.AsynESOutPutDataTran.tran(AsynESOutPutDataTran.java:51)
at org.frameworkset.tran.es.input.es.ES2ESDataTranPlugin$1.run(ES2ESDataTranPlugin.java:141)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.frameworkset.tran.ESDataImportException: ESIndex type not seted.
at org.frameworkset.tran.BaseElasticsearchDataTran.buildMeta(BaseElasticsearchDataTran.java:530)
at org.frameworkset.tran.BaseElasticsearchDataTran.evalBuilk(BaseElasticsearchDataTran.java:691)
at org.frameworkset.tran.BaseElasticsearchDataTran.parallelBatchExecute(BaseElasticsearchDataTran.java:154)
... 4 more
线上就显示这么多信息
bboss版本:6.2.2

追踪了一下源码,应该是BaseElasticsearchDataTran的第517行的ESIndexWrapper为空导致此异常
importBuilder.builder()执行的时候,ES2ESExportBuilder的79行调用super.buildImportConfig(es2DBImportConfig);
代码如下:
if(index != null) {
ESIndexWrapper esIndexWrapper = new ESIndexWrapper(index, indexType);
// esIndexWrapper.setUseBatchContextIndexName(this.useBatchContextIndexName);
baseImportConfig.setEsIndexWrapper(esIndexWrapper);
}
index我确实设置了,那么ESIndexWrapper 就不应该为空啊

然后我突发奇想,加了一个setIndexType("_doc"); 这个配置,就不报错了。。

ES2ESExportBuilder importBuilder = new ES2ESExportBuilder();
importBuilder.setBatchSize(properties.getBatchSize()) //设置批量从源Elasticsearch中拉取的记录数
.setFetchSize(properties.getFetchSize()); //设置批量写入目标Elasticsearch记录数
importBuilder.setIndex(targetIndex) //设置要目标elasticsearch索引名称
.setIndexType("_doc");

但是ES7版本默认type是_doc呀,可以不用加的吧??

@yin-bp yin-bp self-assigned this Nov 3, 2020
@yin-bp yin-bp added the question label Nov 3, 2020
@yin-bp
Copy link
Contributor

yin-bp commented Nov 3, 2020

我跑了一下测试demo,没有出现你说的问题:
https://github.com/bbossgroups/elasticsearch-elasticsearch/blob/master/src/main/java/org/frameworkset/elasticsearch/imp/ES2ESScrollAllTimestampDemo.java

importBuilder.setIndex("es2esdemo"); //全局设置要目标elasticsearch索引名称
					 //.setIndexType("es2esdemo"); //全局设值目标elasticsearch索引类型名称,如果是Elasticsearch 7以后的版本不需要配置

是不是你在运行的过程中有调用销毁的相关方法或者重启了 同步进程,导致配置被重置了才报错?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants