Search code examples
solrsolrjsolrcloud

Solr DataSource Request Parameters Not Being Recognized


I'm trying to make the username/password for a Solr (7.5) data import handler to be dynamic, following the guidance here.

Here's my data config:

<dataConfig>
   <dataSource 
    driver="com.mysql.jdbc.Driver" 
    url="jdbc:mysql://mysqlconnectionstring" 
    user="${dataimporter.request.jdbcuser}" 
    password="${dataimporter.request.jdbcpassword}"/> ...

And solrconfig:

<requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">
    <lst name="defaults">
        <str name="config">data-config.xml</str>
    </lst>
</requestHandler>

However, when I execute the dataimport command (e.g. http://mysolr.something/solr/dataimport?command=full-import&jdbcuser=foo&jdbcpassword=bar), I get (partial) responses like this:

"initArgs": [
"defaults",
[
  "config",
  "data-config.xml",
  "datasource",
  [
    "driver",
    "com.mysql.jdbc.Driver",
    "url",
    "jdbc:mysql://mysqlconnectionstring",
    "user",
    "",
    "password",
    ""
  ]
]

]

If I look in the solr logs, I see entries like this:

18:56:32.076 [qtp1076770748-18] INFO org.apache.solr.handler.dataimport.DataImporter - Loading DIH Configuration: data-config.xml

18:56:32.087 [qtp1076770748-18] INFO org.apache.solr.handler.dataimport.DataImporter - Data Configuration loaded successfully

18:56:32.087 [qtp1076770748-18] INFO org.apache.solr.handler.dataimport.DataImporter - Getting configuration for Global Datasource...

18:56:32.087 [qtp1076770748-18] INFO org.apache.solr.handler.dataimport.DataImporter - Adding properties to datasource: {password=, driver=com.mysql.jdbc.Driver, user=, url=jdbc:mysql://mysqlconnectionstring}

I just don't know what I am missing here, why won't it read the username/password from the request and populate the datasource from that?


Solution

  • It turns out the problem was with my kubernetes statefulset controlling the k8s cluster: it was holding on to old config somehow and this seems to work fine now that I explicitly deleted all pods in the statefulset.