How to stop Solr servers properly - solr

I'm using SolrCloud and I wanted to know, if there exists a proper way to stop/shutdown solr servers.
Currently I am using the kill command in shell to kill the Solr process (using its PID) but it's not very nice !
Is there a way to stop Solr servers knowing their ports for example or something else?
I have found this post : How to stop solr with command line
I guess that there are differents ways to stop Solr, can someone recommend me the alternative approaches to do it with SolrCloud?
Thanks.

Related

Connecting to SolrCloud with SolrJ and Zookeeper with ACL

I'm trying to connect an application using SolrJ to a SolrCloud cluster via ZooKeeper which is secured using ACLs.
No problem you say? Right, we can just use the specific Java Properties (e.g. -DzkACLProvider etc.) and be done with it. Unfortunately we do not want to set these options with system properties because they would also contain the password. Our preferred way would be to provide these flags via environment variables. Looking into the SolrJ code this looks impossible without implementing some wrappers/extensions of SolrJ classes.
I've come so far that I think that maybe we're just doing it wrong, especially because I don't find any questions regarding this. Is this even the right way to do this? Should we even connect via Zookeeper? Or would you normally just connect to a loadbalanced SolrCloud HTTP endpoint and not connect to Zookeeper at all?
I'm thankful for any input!

How to get the running status of solr using solrj/ java code

I need the status about if solr has started running, whether the indexing is going on or it has been stopped unexpectedly or finished. Also about the results of the query I have given. Like that for every action performed there in the interface, I need to know it via java code.
To check Solr is running, whether solr is responding.
You can use the ping service of solr
refer solr ping

Is there any way to index kafka outputs in Apache solr?

I'm new to Apache solr and I want to index data from kafka into solr. Can anyone give simple example of doing this ?
The easiest way to get started on this would probably be to use Kafka Connect.
Connect is part of the apache Kafka package, so should already be installed on your Kakfa node(s). Please refer to the quickstart for a brief introduction on how to run connect.
For writing data to Solr there are two connectors that you could try:
https://github.com/jcustenborder/kafka-connect-solr
https://github.com/MSurendra/kafka-connect-solr
While I don't have any experience with either of them, I'd probably try Jeremy's first based on latest commit and the fact that he works for Confluent.

Solr cloud distributed search on collections

Currently I have a zookeeper instance controlling replication on 3 physical servers. It is the solr integrated zookeeper. 1 shard, 1 collection.
I have a new requirement in which I will need a new static solr instance (1 new collection, no replication). Same schema as previous collection. A copy of this instance will also be placed on the 3 physical servers mentioned above. A caveat is that I need to perform distributed searches across the 2 collections and have the results blended.
Thanks to javacreed I now know that sharding is not in my solution. Previous questions answers here and here.
In my current setup I run the following command on the server running zookeeper -
java -Dbootstrap_confdir=solr/myApp/conf -Dcollection.configName=myConfig -DzkRun -DnumShards=1 -jar start.jar
Am I correct in saying that this will not change and I will now also manually start the non replicated collection. I really only need to change my search queries to include the 'collection' parameter? Something like -
http://localhost:8983/solr/collection1/select?collection=collection1,collection2
This example is from Solr documentation. I am slightly confused as to whether it should be ...solr/collection1/select?... or ...solr/collection2/select?... or if it even matters?
Thanks
Thanks for your kind word stewart.You can search it directly on solr as
http://localhost:8983/solr/select?collection=collection1,collection2
There is no need to mention any collection path since you are defining them in the collection parameters.

How to setup Solr on a live VPS?

I follow the instruction on http://lucene.apache.org/solr/tutorial.html and I can setup Solr on my PC.
Now when I come to my VPS I cannot overcome the step: $ java -jar start.jar
Afer running that command, search service is available at http: //x.x.x.x:8983/solr/select .
But, Whenever I close the SSH client, the service on http: //x.x.x.x:8983/solr/select is also closed. So I can't search any more.
What should I do?
My VPS has 512MB RAM and run mainly lighttpd, php and mySQL. Do you think Solr is suitable for me, or Sphinx is a better choice? I need faceted search on my site.
Thanks for any help.
I think you challenge is that when you start up Solr, you are starting it up as a console process, not as a daemon. So when you log out, it kills the Java process! There are a number of ways around this, from using a tool like "screen" to preserve your running console processes when you log out, to using commands like nohup or java -jar start.jar & to send those processes to the background.
However, what you really need to do is install Tomcat or Jetty as a daemon service on your VPS. You may be able to have your VPS hosting provider do this for you.
As far as your hardware setup, I think unless you have a ginormous index, or really busy site, 512 of RAM should be plenty to run a LAMP style website and Solr. One nice thing about Solr being HTTP based is you can quickly move your Solr server to another VPS as your load increases!
I would contact your VPS provider and ask them if Java is supported/recommended.. If so, you are good to go, if not, then you need a good Java supporting VPS!
I would recommend running Solr with Tomcat. That way you can run multipe Solr configurations with ease.
You can control your Solr installation from the Tomcat manager (stopping/starting).
To store Tomcat logging under your Solr directory check: http://globalgateway.wordpress.com/2010/01/06/configuring-solr-1-4-logging-with-log4j-in-tomcat/
Thank you very much. I decided to use Jetty as a daemon service to serve Solr because of its lightweight and ease to embed. It works very well on my VPS (althought this daemon use too much RAM - 50%).
My VPS is clean I and I can setup Java without any problem.

Resources