如何设置Apache Solr管理员密码 [英] How to set Apache solr admin password
问题描述
我对solr不太熟悉.我已经成功安装了solr.它正在使用码头网络服务器.我的Solr版本是4.10.3.它的管理页面不受密码保护.任何人都可以访问它.我想在solr admin上应用paaword.我将如何做?
I an not very familiar with solr. I have installed solr successfully. It is using jetty webserver. My solr version is 4.10.3. It admin page is not protected by password. Anyone can access it. I want to apply a paaword on solr admin. How I will do it?
推荐答案
低于5的版本
如果您使用的是solr-webapp,则需要修改 web.xml 文件并添加以下行:
If you are using solr-webapp then you need to modify web.xml file and add these lines:
<security-constraint>
<web-resource-collection>
<web-resource-name>Solr Lockdown</web-resource-name>
<url-pattern>/</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>solr_admin</role-name>
<role-name>admin</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>Solr</realm-name>
</login-config>
对于Jetty服务器,您需要在/example/etc/webdefault.xml
For Jetty server, you need to add below lines in /example/etc/webdefault.xml
<security-constraint>
<web-resource-collection>
<web-resource-name>Solr authenticated application</web-resource-name>
<url-pattern>/</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>**admin-role**</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>Test Realm</realm-name>
</login-config>
更新/example/etc/jetty.xml 文件
<Call name="addBean">
<Arg>
<New class="org.eclipse.jetty.security.HashLoginService">
<Set name="name">Test Realm</Set>
<Set name="config"><SystemProperty name="jetty.home" default="."/>/etc/realm.properties</Set>
<Set name="refreshInterval">0</Set>
</New>
</Arg>
</Call>
/example/etc/realm.properties
:
admin: s3cr3t, admin-role
用户名= admin 密码= s3cr3t . 角色名称= admin-角色
Username = admin password = s3cr3t. Role name = admin-role
Solr版本5 +
在最新的Solr版本中,文件夹结构已更改.您将在以下文件夹路径中找到所有文件.
In latest Solr version folder structure got changed. You will find all files in below folder-path.
{SOLR_HOME}/server/etc/jetty.xml {SOLR_HOME}/server/etc/webdefault.xml
{SOLR_HOME}/server/etc/jetty.xml {SOLR_HOME}/server/etc/webdefault.xml
在{SOLR_HOME}/server/etc/realm.properties
处创建新的凭据文件:
Create new credential file at {SOLR_HOME}/server/etc/realm.properties
:
admin: s3cr3t, admin-role
有关更多信息,您可以帮助solr Wiki文档
For more info you can help solr wiki docs
这篇关于如何设置Apache Solr管理员密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!