| Next revision | Previous revision |
| solr [2018/02/14 10:06] – created admin | solr [2018/02/15 09:17] (current) – admin |
|---|
| ====== Solr ====== | ====== Apache Solr Server ====== |
| |
| ===== Create a User and set password ===== | ===== Install Solr ===== |
| | |
| | https://tecadmin.net/install-apache-solr-on-ubuntu/ |
| | |
| | ===== Useful commands ===== |
| | |
| | List of Commands: |
| | |
| | https://lucidworks.com/2015/08/17/securing-solr-basic-auth-permission-rules/ |
| | |
| | Indexing files using Tika: |
| | |
| | https://lucene.apache.org/solr/guide/6_6/uploading-data-with-solr-cell-using-apache-tika.html#UploadingDatawithSolrCellusingApacheTika-TryingoutTikawiththeSolrtechproductsExample |
| | |
| | ==== Create User and set password ==== |
| |
| <code bash> | <code bash> |
| curl --user solr:SolrRocks http://localhost:8983/solr/admin/authentication -H 'Content-type:application/json' -d '{"set-user": {"tom" : "TomIsCool","harry":"HarrysSecret"}}' | curl --user USERNAME http://localhost:8983/solr/admin/authentication -H 'Content-type:application/json' -d '{"set-user": {"tom" : "TomIsCool","harry":"HarrysSecret"}}' |
| </code> | </code> |
| | |
| | ==== Delete User ==== |
| | |
| | <code bash> |
| | curl --user USERNAME http://localhost:8983/solr/admin/authentication -H 'Content-type:application/json'-d '{ |
| | "delete-user": ["tom","harry"]}' |
| | </code> |
| | |
| | ==== Create Core ==== |
| | |
| | <code bash> |
| | sudo su - solr -c "/opt/solr/bin/solr create -c mycol1 -n data_driven_schema_configs" |
| | </code> |
| | |
| | ==== Delete Core ==== |
| | |
| | <code bash> |
| | curl --user USERNAME -X GET http://localhost:8983/solr/admin/cores?wt=json&action=UNLOAD&core=MY_CORES_NAME -H "Content-Type: application/json" |
| | </code> |
| | ====== Basic Auth ====== |
| | |
| | <note>User **solr** – Password: **SolrRocks**</note> |
| | |
| | Create file /var/solr/data/security.json and add the following content: |
| | |
| | <code javascript> |
| | { |
| | "authentication":{ |
| | "blockUnknown":true, |
| | "class":"solr.BasicAuthPlugin", |
| | "credentials":{"solr":"IV0EHq1OnNrj6gvRCwvFwTrZ1+z1oBbnQdiVC3otuq0= Ndd7LKvVBAaZIF0QAVi1ekCfAJXr1GGfLtRUXhgrF8c="}, |
| | "":{"v":0}}, |
| | "authorization":{ |
| | "class":"solr.RuleBasedAuthorizationPlugin", |
| | "permissions":[{ |
| | "name":"security-edit", |
| | "role":"admin"}], |
| | "user-role":{"solr":"admin"}}} |
| | </code> |
| | |
| | <note important>This is required to run **/opt/solr/bin/solr**-Command when BasicAuthPlugin is enabled</note> |
| | In /etc/default/solr.in.sh set the Following: |
| | |
| | <code> |
| | SOLR_AUTH_TYPE="basic" |
| | SOLR_AUTHENTICATION_OPTS="-Dbasicauth=MY_SOLR_USER:MY_PASSWORD" |
| | </code> |
| | |