Hot questions for Using Cassandra in solr

Question:

I am unable to start the solr aspect of DSE search and i get the following exception message when i execute, when i execute bin/dse cassandra start the cassandra service is started but not solr, does anyone have any guidance to offer me i know i have missed something:

bin/dse cassandra -s

message:

Cannot start node if snitch's data center (Solr) differs from previous data center (Cassandra). Please fix the snitch configuration, decommission and rebootstrap this node or use the flag -Dcassandra.ignore_dc=true.
at org.apache.cassandra.db.SystemKeyspace.checkHealth(SystemKeyspace.java:629) ~[cassandra-all-2.1.12.1046.jar:2.1.12.1046]
at org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:290) [cassandra-all-2.1.12.1046.jar:2.1.12.1046]
at com.datastax.bdp.server.DseDaemon.setup(DseDaemon.java:329) [dse-4.7.7.jar:4.7.7]
at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:564) [cassandra-all-2.1.12.1046.jar:2.1.12.1046]
at com.datastax.bdp.DseModule.main(DseModule.java:75) [dse-4.7.7.jar:4.7.7]

Answer:

Recent versions of DataStax Enterprise do not allow you to change the workload of an existing node with existing data. In order to start this node, either remove all data in the data folder (effectively, start clean) or use the -Dcassandra.ignore_dc=true flag (as it says in the error).

Question:

I need to add a property to return a timestamp, I use below example to test print a sample date in "dataimport.properties" file to get last modified time. And it's not working

dataconfig.xml:

<dataConfig>
<dataSource type="JdbcDataSource"    
driver="org.apache.cassandra.cql.jdbc.CassandraDriver"    
url="jdbc:cassandra://localhost:9160/sample"    
user="cassandra"
password="cassandra" 
autoCommit="true"/>    
<document name="content">    
<entity name="defaults" query="SELECT id from sample.contacts" 
deltaImportQuery="select id from sample.contacts where modifiedtime >'${dataimporter.defaults.last_index_time}'  allow filtering" 
deltaQuery="select id from sample.contacts where modifiedtime > '${dataimporter.last_index_time}' limit 1 allow filtering "
autoCommit="true">    
<field column="id" name="id" />  
</entity>   
</document>    
<propertyWriter dateFormat="yyyy-MM-dd" type="SimplePropertiesWriter"   directory="conf" filename="dataimport.properties"  locale="en-US"/>
</dataConfig>`

Answer:

Try this

<propertyWriter dateFormat="yyyy-MM-dd" type="SimplePropertiesWriter" />

You will start getting your last_index_time in desired format (yyyy-MM-dd) in conf/dataimport.properties.

Question:

I have created a DataImportHandler in Apache SOLR to retrieve data from Cassandra database. My configuration as follows

solrconfig.xml:

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

dataconfig.xml:

<dataConfig>
  <dataSource type="JdbcDataSource"     driver="org.apache.cassandra.cql.jdbc.CassandraDriver"
    url="jdbc:cassandra://192.92.12.2:9160/test"
    user="user1"
    password="passpass"
    autoCommit="true"/>
  <document name="content">
    <entity name="test" query="SELECT id from test.contacts" autoCommit="true">
      <field column="id" name="id" />
    </entity>
  </document>
</dataConfig>

schema.xml:

<field name="id" type="string" indexed="true" stored="true" required="true" />

When I execute using solr admin getting the below response

{
  "responseHeader": {
    "status": 0,
    "QTime": 0
  },
  "initArgs": [
    "defaults",
    [
      "config",
      "dataconfig.xml"
    ]
  ],
  "command": "status",
  "status": "idle",
  "importResponse": "",
  "statusMessages": {
    "Time Elapsed": "0:12:6.182",
    "Total Requests made to DataSource": "0",
    "Total Rows Fetched": "0",
    "Total Documents Processed": "0",
    "Total Documents Skipped": "0",
    "Full Dump Started": "2016-09-05 10:52:52",
    "Full Import failed": "2016-09-05 10:52:52"
  }
}

I can't identify what is the issue in this configuration.


Answer:

1) Removed schema.xml and included the content in managed-schema in /conf directory.

2) Added below dependency libraries.

And finally got output.