如何设置 Apache solr 管理员密码 [英] How to set Apache solr admin password

查看:30
本文介绍了如何设置 Apache solr 管理员密码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对 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-role

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆