SOLR:There are no SolrCores running Error Message

2019-04-12 04:12发布

问题:

I m very new to SOLR.

I have added the following to the corresponding xml files. But when I try to open my server page that is http://localhost:8080/solr/#/ in my machine it comes up with a message saying that "There are no SolrCores running.Using the Solr Admin UI currently requires at least one SolrCore.".

solarconfig.xml: [the request handler]

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

data-config.xml

<dataConfig>
  <dataSource type="JdbcDataSource" driver="com.microsoft.sqlserver.jdbc.SQLServerDriver" url="jdbc:sqlserver://127.0.0.1:8080;databaseName=myDB" user="xxx" password="xxx" />
    <document>
      <entity name="sep" processor="SolrEntityProcessor" url="http://127.0.0.1:8080/solr/#/collection1" query="*:*"/>
      <entity name="Data" query="select id, firstname, lastname from tblPlayers">
        <field column="DocumentId" name="DocumentId" />
        <field column="Data" name="Data" />
      </entity>
    </document>
</dataConfig>

I guess the requestHandler just points to the data-config.xml, so is there anything wrong with my data-config.xml.

And which is the port that I ve to specify in the data-config.xml relating to the DB.

Thanks in advance.

回答1:

The error message has nothing to do with dataimport. it tells you that you need to have at least one core. It seems to me you're using a solr 4.x. If so, you can find a valid configuration in the download bundle (the core is called "collection1"). There's a multicore example too.

Regarding the dataimport, looking at the file it's not clear to me what you want to know with your question about database port...if you were wondering about where put database connection details well, the answer is the "url" attribute of the datasource element...you must specjfy a valid jdbc url, which is supposed to contain at least database address, port and / or alias.