在Ubuntu14上安裝了Solr6.1並從MySql表中導入了數據。有人可以指導我如何確保mydomain/ip:8983/solr來自公衆。如何確保solr 6管理頁面
我試着在https://cwiki.apache.org/confluence/display/solr/Basic+Authentication+Plugin上給出指令,但在添加security.json時zookeepr連接失敗。
在Ubuntu14上安裝了Solr6.1並從MySql表中導入了數據。有人可以指導我如何確保mydomain/ip:8983/solr來自公衆。如何確保solr 6管理頁面
我試着在https://cwiki.apache.org/confluence/display/solr/Basic+Authentication+Plugin上給出指令,但在添加security.json時zookeepr連接失敗。
首先去你webdefault.xml
目前在etc
目錄。在你的web.xml中放入下面的行。
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>samplerealm</realm-name>
</login-config>
<security-constraint>
<web-resource-collection>
<web-resource-name>Secure resources</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>user</role-name>
</auth-constraint>
</security-constraint>
在etc
文件夾中創建一個samplerealm.txt
文件,並添加follwing內容到該文件user1: user1pass,user
。這裏user1是你的用戶名,user1pass是你剛纔在web.xml
中定義的角色user
的密碼。之後去到jetty.xml
文件在您etc
文件夾,查找下面略低於該行線<Configure id="Server" class="org.eclipse.jetty.server.Server">
粘貼以下代碼:
<Call name="addBean">
<Arg>
<New class="org.eclipse.jetty.security.HashLoginService">
<Set name="name">samplerealm</Set>
<Set name="config"><SystemProperty name="jetty.home" default="."/>/etc/samplerealm.txt</Set>
<Set name="refreshInterval">0</Set>
</New>
</Arg>
</Call>
之後,停止並重新啓動Solr的服務器。當您現在訪問solr頁面時,它會要求您提供憑據。如您的示例realm.txt文件中所聲明的,將user1作爲您的用戶名並將user1pass作爲密碼。稍後,您可以根據需要更改密碼。這就是你如何在Solr中進行http基本認證。它工作100%。讓我知道如果這有助於:)
您可以啓用SSL。我不確定這是否是所需的安全性 - 您必須提供更多信息。
使用SSL,您至少能夠加密SolrCloud和客戶端之間的通信以及Solr節點間通信。
鏈接啓用SSL:https://cwiki.apache.org/confluence/display/solr/Enabling+SSL
沒有SSL,我們不能沒有SSL –
謝謝,它按需工作 –
耶! :) 樂於幫助 。 –
我不明白我是否必須更新web.xml或webdefault.xml。在webdefault.xml中已經有它需要刪除它嗎? –
Alessandra