Sunday, December 25, 2016

Elastic Search : Basic concepts and how to do setup

About Elastic search:
-Near real time search platform
-Each index can be horizontally splitted into multiple shards.
Each shards can have own replicas.
Replication helps in
-High availability
-Scale out search /throughput, as  search can be executed on replicas in parallel

Steps to setup elastic search:
1. Adding Schema:
PUT / INDEX_NAME
"mappings": {
         "Index_name": {
}
,
      "settings": {
         "index": {
            "number_of_replicas": "1",
            "number_of_shards": "1"
         }
      }
   }


2. Add Domain Schema (equivalent to table)



PUT /index_name
{
      "mappings": {
         "index_type": {
            "properties": {
               "firstName": {
                  "type": "string"
               },
 "secondName": {
                  "type": "string"
               },
 "location": {
                  "type": "string"
                  "index": "not_analyzed"
               }
}
}

3.Add data
PUT index_name/index_type/documentId1
{
                     "firstName" :" hello",

                     "secondName": "world"
                           "location"": "Malesia-Singapore"
}

GET INDEX_NAME/ INDEX_TYPE/Id
PUT INDEX_NAME / INDEX_TYPE /1
{
   "body": "here"
}
DELETE index_name/index_type/<id>


   Query search  :           
  GET INDEX_NAME 
  {
  "query" : {
    <json_query>
  }


}

All search:


GET INDEX_NAME/INDEX_TYPE/_search{

GET _search
{
  "query": {
    "match_all": {}
  }
}

Executing term query
get index_name/index_type/_search
{
  "query": {
    "term": {
      "location": "Malesia-Singapore"
    }
  }

}


Saturday, December 24, 2016

Springboot User doc


Running in debug mode:
export MAVEN_OPTS="-Xms2g -Xmx2g -XX:MaxPermSize=2g -Duser.timezone=IST -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8091,server=y,suspend=n"

Quick Gemfire Setup

In this blog, we will walk through Gemfire setup and issues encountered  in running on production.

Steps to install in local sandbox:
-Download Pivotal_GemFire_820_b17919_Linux
-Search for any process name with locator running , kill it
-Start gfsh client
  gfsh
-Add locator
start locator --name=locatorTest

Configure pdx serialization rule
configure pdx --auto-serializable-classes=com\.thetechiehouse\.blogspot\.services\.sampleapp\.vo\..* --read-serialized=true --disk-store
Start server:
start server --name=server1 --classpath=<absolutepath>sample-app-service.jar --server-port=40411

Create a replicated, persistent region:
create region --name=region1 --type=PARTITION_PERSISTENT
List regions:
list regions

To view specific about regions:
describe region --name= region1

List members of your cluster:
list members

-Start gemfire pulse monitoring tool:
start pulse

Issue debugging on Production :

Important commands:
-show missing-disk-storeslist members
-list regions

-query --query= “select * from /regionForSampleService

Issue:
Contents/Home/jre/lib/libinstrument.dylib. One of the two will be used. Which one is undefined.
Exception in thread "main" java.lang.NullPointerException
    at com.gemstone.gemfire.internal.InternalDataSerializer.readPdxSerializable(InternalDataSerializer.java:3157)
    at com.gemstone.gemfire.internal.InternalDataSerializer.basicReadObject(InternalDataSerializer.java:2979)
    at com.gemstone.gemfire.DataSerializer.readObject(DataSerializer.java:3210)

Solution :-Delete all locator and server related folders, if you are already having.

More:http://gemfire.docs.pivotal.io/gemfire/getting_started/15_minute_quickstart_gfsh.html