Tuesday 27 March 2018

Beginners guide for solr installation

Check Java version

1. You can install Solr in any system where a suitable Java Runtime Environment (JRE) is available, as detailed below. You will need the Java Runtime Environment (JRE) version 1.8 or higher. At a command line, check your Java version with below command
[root@ABC]# java -version
openjdk version "1.8.0_151"
OpenJDK Runtime Environment (build 1.8.0_151-b12)
OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode)

Download Solr

Download solr from http://lucene.apache.org/solr/ and extract with below command

tar zxf solr-x.y.z.tgz

Now enter to solr directory with cd command and start solr with below command

Start Solr

cd solr-x.y.gz/
bin/solr start

Now you can access solr in browser with port 8983

You will need to create a core to upload some data. Core creation command will be as follows.

bin/solr create -c CORE_NAME
You can now loacate new core in web interface also you can add some fields. To upload/insert data into solr you need to create data in json format. Lets take a below example to upload data in solr.

$ curl http://localhost:8983/solr/demo/update -d '
[
 {"id" : "book1",
  "title_t" : "The Way of Kings",
  "author_s" : "Brandon Sanderson"
 }
]'

now you can check inserted data on web interface,

$ curl http://localhost:8983/solr/demo/get?id=book1
{
  "doc": {
    "id" : "book1",
    "author_s": "Brandon Sanderson",
    "title_t" : "The Way of Kings",
    "_version_": 1410390803582287872
  }
}

1 comment:

Unknown said...

Thank you very much to sharing your Knowledge

Could not start a new session. Response code 500. Message: Failed to read marionette port

There is bug in firefox binary installed using apt/snap, I faced same issue when I installed firefox from apt package respository. I solved ...