简体   繁体   中英

Getting Solr Admin user password as a system variable

Is there default solr enviroment property that is available to get the solr admin user () and password (). so that i can use this property instead of hardcoding the admin user and password in my solr db-data-config.xml below. I know I could define a property that can solve this purpose but wanted to know if there is any property already available

below

<entity name="test" processor="SolrEntityProcessor" url="http://<adminuser>:<password>@<server>:<port>/solr/test_core/" query="*:*"
fl="*">

DIH Request Parameters Request parameters can be substituted in configuration with placeholder ${dataimporter.request.paramname} , as in this example: You can define the datasource as below.

<dataSource driver="org.hsqldb.jdbcDriver"
            url="${dataimporter.request.jdbcurl}"
        user="${dataimporter.request.jdbcuser}"
        password="${dataimporter.request.jdbcpassword}" />

These parameters can then be passed to the full-import command or defined in the section in solrconfig.xml .

http://localhost:8983/solr/dih/dataimport?command=full-import&jdbcurl=jdbc:hsqldb:./example-DIH/hsqldb/ex&jdbcuser=sa&jdbcpassword=secret

DIH can use jndi and encrypted password in order to connect to database.

<dataSource name="informixmydb"
   type="JdbcDataSource"
   jndiName="java:/comp/env/jdbc/mydb" />

According to the embeded jetty version, you will need to add two jars in jetty. For instance

You will need to configure jndi authentication in the /opt/solr/solr/server/etc/jetty.xml file

<!-- ======================================================== -->
<!--                      Configure JNDI                      -->
<!-- ======================================================== -->

<New id="informixDepluxDs" class="org.eclipse.jetty.plus.jndi.Resource">
  <Arg></Arg> <!-- is Configure node id value -->
  <Arg>java:comp/env/jdbc/deplux2</Arg>
  <Arg>
    <New class="com.informix.jdbcx.IfxConnectionPoolDataSource">
      <Set name="User">solr</Set>
      <Set name="password">
        <Call class="org.eclipse.jetty.util.security.Password" name="deobfuscate">
          <Arg>OBF:*****</Arg>
        </Call>
      </Set>
      <Set name="ServerName">xxxxxx</Set>
      <Set name="IfxIFXHOST">xxxxxx</Set>
      <Set name="DatabaseName">mydb</Set>
      <Set name="PortNumber">15032</Set>
    </New>
  </Arg>
</New>
<New id="informixxxxxx" class="org.eclipse.jetty.plus.jndi.Resource">
  <Arg></Arg>
  <Arg>java:comp/env/jdbc/mydb</Arg>
  <Arg>
    <New class="com.informix.jdbcx.IfxDataSource">
      <Set name="IfxIFXHOST">xxxxxx</Set>
      <Set name="ServerName">xxxxxx</Set>
      <Set name="User">solr</Set>
      <Set name="password">
        <Call class="org.eclipse.jetty.util.security.Password" name="deobfuscate">
          <Arg>OBF:*****</Arg>
        </Call>
      </Set>
      <Set name="DatabaseName">mydb</Set>
      <Set name="PortNumber">15032</Set>
      <Set name="DataSourceName">java:comp/env/jdbc/mydb</Set>
    </New>
  </Arg>
</New>

Password can be encrypted

java -cp ../lib/jetty-util-9.4.10.v20180503.jar org.eclipse.jetty.util.security.Password username password.

( https://www.eclipse.org/jetty/documentation/current/configuring-security-secure-passwords.html )

Regards

Dominique

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM