1

I've a requirement where there will be one instance of SOLR with multiple cores. The data is being pulled from database. We have 3 different search criteria, each business entity have millions of rows. So we created 3 cores. Now the problem is that datasource (Database) is same and only the SQL/tables for retrieving is different. I want to share this connection string across the cores. Each core has data-config.xml in which this connection string is specified. I'd like to specify the connection string at one place only. How to achieve this?

Thanks in advance,

Unni

unniks
  • 166
  • 7

2 Answers2

1

in data-config.xml

<dataConfig>
            <dataSource 
               jndiName="jdbc/somename" 
               type="JdbcDataSource" 
               readOnly="true" 
              />
... Rest your code
</dataConfig>

In etc/jetty.xml

<New id="jdbc" class="org.eclipse.jetty.plus.jndi.Resource">
    <Arg>jdbc/somename</Arg>
    <Arg>
        <New class="com.mysql.jdbc.jdbc2.optional.MysqlDataSource">
            <Set name="Url">jdbc:mysql://localhost:3306/yourdb</Set>
            <Set name="User">user name</Set>
            <Set name="Password"></Set>
        </New>
    </Arg>
</New>  
unniks
  • 166
  • 7
0

You need to define your datasource in solrconfig.xml:

       <lst name="defaults">
            <str name="config">data-config.xml</str>
            <lst name="datasource">
                <str name="type">JdbcDataSource</str>
                <str name="driver">oracle.jdbc.driver.OracleDriver</str>
                <str name="url">jdbc:oracle:thin:@localhost:1521:xe</str>
                <str name="user">wbdbuser</str>
                <str name="password">wbdbuser</str>
            </lst>
      </lst>
Hamad
  • 5,096
  • 13
  • 37
  • 65
Esha
  • 151
  • 8