0

我有一个需要使用 ElasticSearch 的网络应用程序,但我的主机不允许使用 Java 应用程序。

是否可以将 ElasticSearch 服务器放在其他机器(远程)上,以便 webapp 对远程服务器进行查询?如果是,ElasticSearch 有办法保护 ElasticSearch 服务器中的数据吗?如何保护其他用户向这个远程 ElasticSearch 服务器进行查询?

此致,

4

1 回答 1

0

Yes. If you don't have the option to move your application to another server that permits Java, you can access the remote server using JSON calls or a client if available for your platform (http://www.elasticsearch.org/guide/en/elasticsearch/client/community/current/clients.html).

To make things secure, you can install the jetty plugin (https://github.com/sonian/elasticsearch-jetty), configure SSL, authentication and maybe add a IP restriction like creating a jetty-iprestriction.xml with the content bellow and adding a reference to it in elasticsearch.yml.

<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">

<Configure id="ESServer" class="org.eclipse.jetty.server.Server">


<Set name="handler">
  <New id="Handlers" class="org.eclipse.jetty.server.handler.HandlerCollection">
    <Set name="handlers">
     <Array type="org.eclipse.jetty.server.Handler">
   <Item>

     <New class="org.eclipse.jetty.server.handler.IPAccessHandler">
       <Call name="addWhite">
         <!-- allowed server ip -->
         <Arg>xxx.xxx.xxx.xxx</Arg>
       </Call>
      <Set name="handler">
       <New class="com.sonian.elasticsearch.http.jetty.handler.JettyHttpServerTransportHandler"
             id="HttpServerAdapterHandler">
            <Set name="transport"><Ref id="ESServerTransport"/></Set>
        </New>
       </Set>
     </New>

   </Item>
       <Item>
         <New id="DefaultHandler" class="org.eclipse.jetty.server.handler.DefaultHandler"/>
       </Item>
       <Item>
         <New id="RequestLog" class="org.eclipse.jetty.server.handler.RequestLogHandler"/>
       </Item>
     </Array>
    </Set>
  </New>
</Set>

</Configure>
于 2013-10-08T12:34:35.210 回答