简体   繁体   中英

configure starting solr server with command line

I need to start solr server with command line to index my databases.. but the database is variant.. I was able to index some database :

I configure some db-data-config.xml file and I use that to import data :

<dataSource type="JdbcDataSource" 
         name="dsDB"
         driver="com.mysql.jdbc.Driver"
         url="jdbc:mysql://localhost/testmm_3"
         user="xxxx"
         password="xxxx" /> 
<document>
    <entity name="entity1" dataSource="dsDB" query="select DocID as 'id', DocName  from table1 ;">
        <field column="id" name="id" />
        <field column="DocName" name="DocName" />
        <entity name="entity2" dataSource="dsDB"  query="select * from table2 where table1_DocID=${entity1.id}">
        </entity>           
    </entity>

I add same field in my schema.xml file.

I start the solr server with this commande line

/xxx/xx > java -jar -Dsolr.data.dir="ouputIndexedData_Folder\data" start.jar

Now i need to start solr server but with connection to ANOTHER database.. i mean this line

<dataSource type="JdbcDataSource"
 ...
 url="jdbc:mysql://localhost/testmm_3"

I don't need to modify manualy this line. How can i do that? Thank you!

You could always provide a different -confdir as a command line parameter.

This means you have on default configuration of the db-data-config.xml which is read when you run:

java -jar -Dsolr.data.dir="ouputIndexedData_Folder\\data" start.jar

For the other case you could do something like this:

java -jar -Dsolr.data.dir="ouputIndexedData_Folder\\data" start.jar -configdir "path-to-alternative-config\\db-datat-config.xml"

Suggest you experiment a bit, but the docs are quite good when it comes to configuring the Solr start up: solr-command-line-opts .

Good luck :)

To set the launch solr server with a configuration file, I use this command

>Xxx\Xxx\Solr\example>java  -Dsolr.allow.unsafe.resourceloading=true -jar start.jar -config="XXX\XXXX\db-data-config.xml"

This command work fine.

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