Friday, February 10, 2017

Elastic search version

Fetch the elastic search version using

$ curl 'http://localhost:9200/?pretty'
{
  "status" : 200,
  "name" : "Midnight Sun",
  "cluster_name" : "elasticsearch",
  "version" : {
    "number" : "1.6.2",
    "build_hash" : "622039121e53e5f520b5ff8720fdbd3d0cb5326b",
    "build_timestamp" : "2015-07-29T09:24:47Z",
    "build_snapshot" : false,
    "lucene_version" : "4.10.4"
  },
  "tagline" : "You Know, for Search"
}

The elastic search version is 1.6.2

After upgrading to 5.x version of elastic search

$ curl -XGET 'http://localhost:9200'
{
  "name" : "3bsjSYM",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "zGjQ_4rBS1aoM-VzJ_hZCA",
  "version" : {
    "number" : "5.2.0",
    "build_hash" : "24e05b9",
    "build_date" : "2017-01-24T19:52:35.800Z",
    "build_snapshot" : false,
    "lucene_version" : "6.4.0"
  },
  "tagline" : "You Know, for Search"
}

The new elastic search version 5.2.0

Thursday, February 9, 2017

Check if the file is on a NFS mount or on local filesystem mount

How to know if the file is available on a NFS mount or is part of the local filesystem mount?

df -PT <filename>

Eg: df -PT my_application.log
Filesystem    Type 1024-blocks      Used Available Capacity Mounted on
nfsbackup100.in.local:/my_app_log nfs 734003200 610560920 123442280      84% /a/nfsbackup30/my_app_log

So the above file my_application.log belongs to NFS mount

Wednesday, February 8, 2017

Elastic search Cluster: Identify Masternode

Use the following queries to identify the master node in an Elasticsearch cluster

There are many ways to identify the master node

Method1:

curl -XGET 'http://localhost:9200/_cat/nodes?pretty=true'

The entry of master node will be denoted by *

xyz.local 100.72.76.15 50 65 0.87 d * xyz

Method2:


1. Get the logical ID of the master node

curl -XGET 'http://localhost:9200/_cluster/state/master_node?pretty=true'

{
  "cluster_name" : "xxxxxx",
  "master_node" : "<Logical ID of master node>"
}

2. From the logical ID of the master_node obtained in step 1, identify the host

curl -XGET 'http://localhost:9200/_nodes/<logical ID of master node>/name?pretty=true'

{
  "cluster_name" : "xxxxxx",
  "nodes" : {
    "<Logical ID of master node" : {
      "name" : "<server_name>",
      "transport_address" : "inet[/100.72.76.19:9300]",
      "host" : "<server FQDN>",
      "ip" : "100.72.76.15",
      "version" : "1.7.1",
      "build" : "b88f43f",
      "http_address" : "inet[/100.72.76.19:9200]"
    }
  }
}

Tuesday, February 7, 2017

Elastic search: Shards and Replicas Performance

1. Having more shards enhances the indexing performance and allows to distribute a big index across machines.

2. Having more replicas enhances the search performance and improves the cluster availability

Monday, February 6, 2017

HTTP status code 200 and 204

The response code 200 literally means "OK" and is the code most often used when responding to a GET request. A POST request, however, may result in code 204 ("No Content") being sent back, meaning "Everything went OK but I don't really have anything to show you."

Ref: https://www.jeffknupp.com/blog/2014/03/03/what-is-a-web-framework/

Thursday, February 2, 2017

Daemon process

Daemon process -
  • detached from its parent, 
  • all standard I/O redirected to /dev/null, and 
  • the current directory changed to the root, / .

Wednesday, February 1, 2017

List files by their size - bash

To list files by their size

ls -Sl

To list top 5 files by their size

ls -S |  head -n 5