Create a New Solr Index Collection
When you set up a new sensor, you must create either a new index template if you are using Elasticsearch or a new index schema if you are using Solr.
-
Create a
schema.xmlfile by copying an existingschema.xmlfile from another sensor and then replace the existing fields with the fields supported by your new sensor.You can leave the common fields and type definitions in the newschema.xmlfile.For example:tail -n10 /usr/$METRON_HOME/config/schema/$SENSOR_DIRECTORY/schema.xml <field name="ip_src_addr" type ="ip" indexed="true" stored="true: /> <field name="ip_src_port" type ="pint" indexed="true" stored="true: /> <field name="ip_src_addr" type ="ip" indexed="true" stored="true: /> <field name="ip_dst_port" type ="pint" indexed="true" stored="true: />Theschema.xmlfile describes the document fields, their types, and how they are indexed. -
Create a
Solrconfig.xmlfile by copying one from an existing sensor.TheSolrconfig.xmlfile does not vary based on the content of the index. -
Ensure that the Solr user has permission to access both the
schema.xmlandsolrconfig.xmlfiles. -
Navigate to the $SOLR_USER and add the
schema.xmlfile and theSolrconfig.xmlfile to the/usr/hcp/$METRON_HOME/config/schemadirectory. -
As the $SOLR_USER, use
create_collection.shto create the collection for your new sensor:export SOLR_HOME='opt/lucidworks-hdpsearch/solr/ export SOLR_USER=solr export METRON_HOME=/usr/hcp/current/metron export ZOOKEEPER=localhost:2181/solr sudo -E su $SOLR_USER -c $METRON_HOME/bin/create_collection.sh $1 ./create_solr_collection.sh $SENSOR_NAMEYou can ignore the error logs. -
Display the Solr UI to view your new collection.
Refer to Solr Index Schemas for more information.
