Solr config, encrypting data config file

后端 未结 2 1319
野趣味
野趣味 2021-01-20 19:12

How can I encrypt the data config portion here?:

 


        
相关标签:
2条回答
  • 2021-01-20 19:58

    A more secure option, I would suggest is to configure a JNDI in your webserver.

    How to configure a JNDI? This Page explains how to do so with Tomcat. It can be done for other popular webservers as well.

    You can use the JNDI name in your data config file as follows:

    < dataSource name="xyz" jndiName="jdbc/xyz" type="JdbcDataSource"/>
    
    0 讨论(0)
  • 2021-01-20 20:03

    See: https://wiki.apache.org/solr/SolrConfigXml#System_property_substitution

    You can keep them as properties in the file <solr.home>/conf/solrcore.properties and refer them in your data config. So your data-config.xml will be like:

    <dataSource type="JdbcDataSource"
                driver="com.microsoft.sqlserver.jdbc.SQLServerDriver"    
                url="jdbc:sqlserver://${jdbc.host}:${jdbc.port}/${db.name}" 
                user="${jdbc.username}" 
                password="${jdbc.password}"/>
    

    where everything in ${...} is a property in solrcore.properties like:

    jdbc.host=http://127.0.0.1
    jdbc.port=3306
    db.name=emp
    ...
    
    0 讨论(0)
提交回复
热议问题