Testing es-hadoop 6.0 connector with ES-5 and Readonlyrest plugin by granting/revoking access to ES-5 server from Hadoop/Hive server.
Note: I successfuly tested ES-5 with Readonlyrest plugin already when making requests using cURL.
ES-5.6.3 with enabled Readonlyrest plugin is running on IP xx.xxx.xx.55 on port 9200
readonlyrest.yml
readonlyrest:
enable: true
response_if_req_forbidden: Access denied by ROR!!!
- name : "Accept all req from hosts"
hosts: [xx.xxx.xx.99]
Hadoop/Hive with es-hadoop-6.0 connector is running on IP xx.xxx.xx.99
READ from ES+ROR
Test Case 1, enabled acces to ES server from Hadoop server
by setting hosts: [xx.xxx.xx.99] in readonlyrest.yml , restarted ES-5
hive> CREATE EXTERNAL TABLE from_es_with_ror (
title string,
author string)
STORED BY 'org.elasticsearch.hadoop.hive.EsStorageHandler'
TBLPROPERTIES('es.nodes'='xx.xxx.xx.55:9200', 'es.resource.read'='books/kindle');
hive> select * from from_es_with_ror;
OK
swimming guide, John Dow
running, Angela Devis
This test case worked fine !
Test Case 2, disabled access to ES server from Hadoop server
by setting hosts: [xx.xxx.xx.00] in readonlyrest.yml , restarted ES-5
hive> select * from from_es_with_ror;
OK
Failed with exception java.io.IOException:org.elasticsearch.hadoop.rest.EsHadoopInvalidRequest:
[HEAD] on [books] failed; server[xx.xxx.xx.55:9200] returned [403|Forbidden:]
That is correct, access forbidden, but I'm not sure if this test case is ok and es-hadoop connector properly handled it because I expected to catch the "Access denied by ROR!!!" (defined in readonlyrest.yml) in the response, as I did when ran cURL -HGET request ?
WRITE to ES+ROR
Test Case 3, enabled access to ES server from Hadoop server
by setting hosts: [xx.xxx.xx.99] in readonlyrest.yml, restarted ES-5
hive> CREATE EXTERNAL TABLE to_es_with_ror (
id string,
title string,
author string)
STORED BY 'org.elasticsearch.hadoop.hive.EsStorageHandler'
TBLPROPERTIES('es.nodes'='xx.xxx.xx.55:9200', 'es.resource.write'='books/kindle',
'es.write.operation'='index', 'es.index.auto.create'='true', 'es.mapping.id'='id',
'es.mapping.names'='title:title, author:author');
hive> insert into table to_es_with_ror values ('5', 'sport', 'michael');
ERROR main: SessionState.java:printError - Vertex failed, vertexName=Map 1...
caused by: org.apache.hadoop.hive.ql.metadata.HiveEception: Hive Runtime Error
while processing row {"tmp_values_col1":"5", "tmp_values_col2":"sport", "tmp_values_col3":"michael"}
...
Caused by: org.elasticsearch.hadoop.rest.EsHadoopInvalidRequest:
Access denied by ROR!!! null .... did not succeed due to VERTEX_FAILURE. failed Vertices:1
And here what is the es.log content on server xx.xxx.xx.55 where Ee+ROR are running:
... 35mFORBIDDEN by default req={...., HIS: [Accept all req from hosts->[hosts->false]]}
This test case does not work properly, because it should allow to index/write into ES+ROR, but it does not and there is the "Access denied by ROR!!!" (defined in readonlyrest.yml) in the response.
Am I missing something or it might be related to es-hadoop connector behavior when making requests from Hadoop/Hive to ES with enabled ROR plugin ?
Thanks in advance