Sunday, October 19, 2014

Explaining Iaas, Paas, SaaS

Very well explained IaaS/PaaS/SaaS with a simple Pizza example.

No matter which service we use; ultimately we have to pay for the Service that we are using.






Sunday, August 17, 2014

[elasticsearch] Install and access head plugin in elasticsearch

There are many customized plugins that comes with elasticsearch. In this article we will see how to install and then how to use the head plugin with elasticsearch.


Here are few steps that we need to follow:

Step1:
To install head plugin from site use following command:
bin/plugin --install mobz/elasticsearch-head
 You will be able to install the plugin using above only when you have internet connectivity and your firewall alows you to download and install

Else you can manually download the elasticsearch-head.zip plugin from https://github.com/mobz/

Run the following command
bin/plugin --url file:///d:\elasticsearch-head.zip --install mobz/elasticsearch-head

Step 2:
Restart the elasticsearch instance and you will be able to access it as

http://localhost:9200/_plugin/head/

Sunday, August 10, 2014

[SOLR] How to join fl default parameters and request parameters?



If I have set of fields, specified in fl of some SearchRequestHandler configuration in xml, then fl specified in query request parameter will override fl specified in SearchRequestHandler configuration in xml.
I want that SOLR to do Join of fl parameters from query and from SearchRequestHandler instead of overriding it.
For example:
If in query I have fl=field1,field2 and in SearchRequestHandler configuration; I have fl=field3,field1 then join of these two as fl=field1,field2,field3. 
For this issue you can use following solution:
You can use <lst name="appends"> in your requestHandler definition to make Solr append the values to the query instead of replacing them. Since fl can be added several times to the same request, this works as you're extending the list of fields to retrieve.


<requestHandler name="/select" class="solr.SearchHandler">
    <lst name="appends">
        <str name="fl">cat</str>
    </lst>
</requestHandler>



This solution will help you when you have too many fl fields that needs to defined and few of them changes as per the query.

Sunday, August 3, 2014

[SOLR] Implementing Facet with multiple categories along with their count

How can we facet on more than two categories ( ‘project’ and ‘type’ as discussed below) and at the same time get the combination facets and their count.

Example : http://search-lucene.com/

When you open URL, http://search-lucene.com/?q=facets you can see the facets on right hand side as 'Project','type','date','author' and their corresponding values with count in brackets.

For instance, let’s say you select 'solr(32857)' under 'Project' facet, still we can see other values under 'Project' facet like ElasticSearch etc. along with their respective count. 







Further when we Select 'mail # user(23138)' under “type” section , again we can see other values under “type” section with their corresponding count in brackets and their corresponding values in “Project” facet gets changed accordingly (namely the count ). 




Observe how solr(32857) changed to Solr (22969) post selection of mail # user along with the other values of ‘Project’ (like ElasticSearch etc.) and ‘type’ (issue, javadoc etc.,) with a change in their count values.

To achieve similar functionality you can use following solution:

Use Tagging and excluding Filters: http://wiki.apache.org/solr/SimpleFacetParameters#Tagging_and_excluding_Filters

select?q=solr%20facets&fq={!tag=projectTag}Project:"solr"&fq={!tag=typeTag}type:"mail # user"&facet=true&facet.field={!ex=projectTag}project&facet.field={!ex=typeTag}type&wt=json&indent=true

Using the above solution I am able to implement the faceting solution mentioned in above website using SOLR.

Hope this is useful information for your all!!!!



Sunday, July 27, 2014

Crawl your website using Nutch Crawler without Indexing the HTML content into SOLR

This article will help you in resolving following issue:

1) If you want to crawl the website using Nutch Crawler without indexing the HTML content into SOLR here are the changes that you need to perform the crawl script of nutch package.

You need to remove the following piece of code:

SOLRURL="$3"

if [ "$SOLRURL" = "" ]; then echo "Missing SOLRURL : crawl <seedDir> <crawlDir> <solrURL> <numberOfRounds>" exit -1;fi


echo "Indexing $SEGMENT on SOLR index -> $SOLRURL" $bin/nutch index -D solr.server.url=$SOLRURL $CRAWL_PATH/crawldb -linkdb $CRAWL_PATH/linkdb $CRAWL_PATH/segments/$SEGMENT if [ $? -ne 0 ]
then exit $?
fi

echo "Cleanup on SOLR index -> $SOLRURL" $bin/nutch clean -D solr.server.url=$SOLRURL $CRAWL_PATH/crawldb if [ $? -ne 0 ]
then exit $?
fi

Hope This Helps!!!

Sunday, July 13, 2014

[SOLR] RELOAD solrconfig.xml and schema.xml without restarting the SOLR

Most of the time we get answer that we need to restart the SOLR instance if we make a change in schema.xml and solrconfig.xml.

But now with SOLR4.0 onwards, this can be achieved using RELOAD command.

Command:
http://localhost:8983/solr/admin/cores?action=RELOAD&core=core0

Now, If you make changes to your solrconfig.xml or schema.xml files and you want to start using them without stopping and restarting your SOLR instance. 
Then just execute the RELOAD command on your core.

NOTE:
However there are few configuration changes which still needs, the restart of SOLR instance, 
1) IndexWriter related settings in <indexConfig>
2) Change in <dataDir> location

Hope this Helps!!!

Reference:
https://wiki.apache.org/solr/CoreAdmin#RELOAD



Sunday, July 6, 2014

Unix Commands : Tricks and Tips


  1. Update a file into a JAR file

I want to update the application.properties file in myproject.jar file.

jar -uf myproject.jar application.properties

This command will update application.properties in myproject.jar
Note that for -u  application.properties must already exist in the jar file, and will only be overwritten if it's newer than the one in the jar.

Work-Life Balance in IT Industry


In IT Industry this is what we call as Work-Life Balance





Sunday, June 29, 2014

Zookeeper Cluster Setup

Today we are going to create a zookeeper cluster with 5 instances.

1) Required / Installed software
    1.a) Java - jdk1.7.* (/usr/java)
    1.b) Zookeeper – zookeeper-3.4.6 (/opt/install/zookeeper)
    1.c) Port selection for zookeeper deployment

          1.c.i ) On Different Servers
Server ID
Server IP
Client Port
Quorum Port
Leader Election Port
1
10.10.10.1
2181
2888
3888
2
10.10.10.2
2181
2888
3888
3
10.10.10.3
2181
2888
3888
4
10.10.10.4
2181
2888
3888
5
10.10.10.5
2181
2888
3888


          1.c.ii ) On Same Servers
Server ID
Server IP
Client Port
Quorum Port
Leader Election Port
1
10.10.10.1
2181
2888
3888
2
10.10.10.1
2182
2889
3889
3
10.10.10.1
2183
2890
3890
4
10.10.10.1
2184
2891
3891
5
10.10.10.1
2185
2892
3892
     


2) Installation folder structure
    2.a) Zookeeper Server
                /opt/install/zookeeper/zookeeper1/
                /opt/install/zookeeper/zookeeper2/
                /opt/install/zookeeper/zookeeper3/
                /opt/install/zookeeper/zookeeper4/
                /opt/install/zookeeper/zookeeper5/

    2.b) Data Directory
                /opt/install/zookeeper/data/zookeeper1/
                /opt/install/zookeeper/data/zookeeper2/
                /opt/install/zookeeper/data/zookeeper3/
                /opt/install/zookeeper/data/zookeeper4/
                /opt/install/zookeeper/data/zookeeper5/

    2.c) Logs Directory
                /opt/install/zookeeper/logs/zookeeper1/
                /opt/install/zookeeper/logs/zookeeper2/
                /opt/install/zookeeper/logs/zookeeper3/
                /opt/install/zookeeper/logs/zookeeper4/

                /opt/install/zookeeper/logs/zookeeper5/

3) Download a Zookeeper
    3.a) Currently we are using zookeeper-3.4.6.
    3.b) From website http://zookeeper.apache.org/releases.html
    3.c) Download the latest version of zookeeper software and untar it to /tmp/zookeeper.
    3.d) The following steps need to be done for all the zookeeper instances.
    3.e) Copy /tmp/zookeeper/zookeeper-3.4.6/* to /opt/install/zookeeper/zookeeper1/
    3.f) Copy $ZOO_HOME1/conf/zoo_sample.cfg as zoo.cfg 
    3.g) Edit zoo.cfg and have the following properties

tickTime=2000                                                              
initLimit=10                                                                   
syncLimit=5                                                                   
(make sure directory is present)                                     
dataDir=/opt/install/zookeeper/data/zookeeper1/           
# the port at which the clients will connect                       
clientPort=2181                                                              
(make sure directory is present)                                     
dataLogDir=/opt/install/zookeeper/logs/zookeeper1/       
#                                                                                     
server.1=10.10.10.1:2888:3888                                       
server.2=10.10.10.2:2888:3888                                       
server.3=10.10.10.3:2888:3888                                       
server.4=10.10.10.4:2888:3888                                       
server.5=10.10.10.5:2888:3888                                       
                               
4) Create “myid” file in data directory. 
    4.a) Edit it and write only “1” on server1
    4.b) Edit it and write only  “2” on server2
  4.c) Edit it and write only “3” on server3
  4.d) Edit it and write only  “4” on server4 
4.e) Edit it and write only “5” on server5

5) Start the zookeeper. 

        ($ZOO_HOME/bin/zkServer.sh start on each of the zookeeper instance)
        $ /opt/install/zookeeper/zookeeper1/bin/zkServer.sh start
        $ /opt/install/zookeeper/zookeeper2/bin/zkServer.sh start
        $ /opt/install/zookeeper/zookeeper3/bin/zkServer.sh start
        $ /opt/install/zookeeper/zookeeper4/bin/zkServer.sh start
        $ /opt/install/zookeeper/zookeeper5/bin/zkServer.sh start

        Sample Output:
        JMX enabled by default
        Using config: /opt/install/zookeeper/zookeeper1/bin/../conf/zoo.cfg
        Starting zookeeper ... STARTED


6) To STOP the Zookeeper instances
        $ /opt/install/zookeeper/zookeeper1/bin/zkServer.sh stop
        $ /opt/install/zookeeper/zookeeper2/bin/zkServer.sh stop
        $ /opt/install/zookeeper/zookeeper3/bin/zkServer.sh stop
        $ /opt/install/zookeeper/zookeeper4/bin/zkServer.sh stop
        $ /opt/install/zookeeper/zookeeper5/bin/zkServer.sh stop


7) To Check the Zookeeper Status
        $ /opt/install/zookeeper/zookeeper1/bin/zkServer.sh status
        $ /opt/install/zookeeper/zookeeper2/bin/zkServer.sh status
        $ /opt/install/zookeeper/zookeeper3/bin/zkServer.sh status
        $ /opt/install/zookeeper/zookeeper4/bin/zkServer.sh status
        $ /opt/install/zookeeper/zookeeper5/bin/zkServer.sh status

        Sample Output
        JMX enabled by default
        Using config: /opt/install/zookeeper/zookeeper2/bin/../conf/zoo.cfg
        Mode: leader

        JMX enabled by default
        Using config: /opt/install/zookeeper/zookeeper2/bin/../conf/zoo.cfg
        Mode: follower


Sunday, June 22, 2014

Passwordless SSH and SCP to Unix Server

In this article we will see how we can do SCP and SSH to remote server without giving any password. 
This helps while we are writing a bash script for doing ssh and scp.

Run this command on LocalMachine
$ ssh-keygen -t dsa

Add following lines to your .bash_profile on your LocalMachine:
# So that ssh will work, take care with X logins - see .xsession
[[ -z $SSH_AGENT_PID && -z $DISPLAY ]] &&
exec -l ssh-agent $SHELL -c "bash --login"

Run these command on LocalMachine
$ ssh-copy-id RemoteServer
$ scp ~/.ssh/id_dsa.pub RemoteServer:.ssh/id_dsa.pub.LocalMachine

Run these command on RemoteServer
$ cat ~/.ssh/id_dsa.pub.LocalMachine >> ~/.ssh/authorized_keys
$ rm ~/.ssh/id_dsa.pub.LocalMachine
$ chmod 600 ~/.ssh/authorized_keys
$ chmod 700 ~/.ssh

After executing the above commands we will be able to SCP or SSH to RemoteServer from LocalMachine.

Password Protected Solr Admin Page

As we all know Solr Admin Page is not password protected and anyone can get into Solr Admin Page. However this article will ...