Thursday, 8 June 2017

// // 1 comment

Tab Completion Is Not Working In "oh-my-zsh" theme

Tab Suggestions are not working in oh-my-zsh theme


After installing oh-my-zsh theme, sometimes Tab completion do not works. If this is the case with you, follow the below steps:

  1. First open the oh-my-zsh.sh file in editor.
    vim ~/.oh-my-zsh/oh-my-zsh.sh
  2. Now find the 14th line in this file with below content:
    :${ZSH_DISABLE_COMPFIX:=true}
  3. Change the value to false from true, like below and save the file.
    :${ZSH_DISABLE_COMPFIX:=false}
  4. Now execute below command:
    source ~/.zshrc
  5. Restart your terminal, you must seen some directories that are not secure. Secure them using below command:
    sudo chmod 755 <insecure_directory_name>
  6. Again open the oh-my-zsh.sh file, and turn the value to true from false and save the file.
    :${ZSH_DISABLE_COMPFIX:=true}
  7. execute below command again:
    source ~/.zshrc
Now, your problem is solved. Tab suggestions are working normal.

If after logout from zsh and again login into it, causes the same problem then keep the value false only in 14th line of oh-my-zsh.sh and source the .zshrc file. Your problem will be solved permanently.
Read More

Tuesday, 6 June 2017

// // Leave a Comment

The filesystem is already 78642683 (4k) blocks long. Nothing to do! | resize2fs

Error | The filesystem is already 78642683 (4k) blocks long. Nothing to do!


If you are getting this error while running resize2fs command in linux for ext4 volume, run growpart command and then run resize2fs command as shown below:


sudo growpart /dev/xvda 1
sudo resize2fs /dev/xvda1

Read More

Monday, 5 June 2017

// // Leave a Comment

aws cli Command To list Instances With Particular Tag

Command To list AWS Instances With Particular Tag

AWS CLI Command To List Instance Having Particular Tag


AWS CLI provides to list instances on the basis of various filters and you can get specific details about the instances based on those filters. If you haven't setup aws-cli, here is a tutorial to install and configure aws-cli.
Below is the command to list only instance-id of all the instances having a Tag "Monitor" with value "True".

aws ec2 describe-instances --filters Name=tag:Monitor,Values=True --query 
'Reservations[].Instances[].[InstanceId]' --output text

Here we are only listing the Instance-Id, But you may also list other information like Private IP address as shown below:

aws ec2 describe-instances --filters Name=tag:Monitor,Values=True --query 
'Reservations[].Instances[].[InstanceId,PrivateIpAddress]' --output text

We have also specified output to be in text format, which will display two columnar data, one column for InstanceId and other for PrivateIpAddress. If you don't want columnar type output want the output then just remove the "--output text" from the command:


aws ec2 describe-instances --filters Name=tag:Monitor,Values=True --query 
'Reservations[].Instances[].[InstanceId,PrivateIpAddress]'

Read More

Saturday, 27 May 2017

// // Leave a Comment

Calculating IOPS Used By EBS Volume

Calculating IOPS Used By EBS Volume

How To Calculate IOPS Used By EBS Volumes In AWS?


For GP2 volumes:

Data is collected every 5 minutes, so there is no data available for every minute.
For example, if you see Max of volumeReadOps and volumeWriteOps for a period of 5 mins and 1 min, the value would remain same. If you also see Sum of volumeReadOps and volumeWriteOps for a period of 5 mins and 1 min, the value would again remain same. Below is an observation of this:
statistics - maximum
period - 1 min
value - 285491
statistics - maximum
period - 5 min
value - 285491
statistics - maximum
period - 15 min
value - 285491
statistics - sum
period - 1 min
value - 285491
statistics - sum
period - 5 min
value - 285491
statistics - sum
period - 15 min
value - 830694

So, If you want to calculate the IOPS consumed here, then, divide the IOPS with 300 (that is 5*60) in case you are taking max/sum of 1 or 5 min. The calculation would be 285491/300 = 951.63
If you are considering sum of 15 min, then divide the IOPS with 900 (that is 15*60) which is 830694/900 = 922.99

Above values are being considered when the IOPS were happening on peak. You may consider the data for last 2 week or may be 3 week and choose the window for the peak duration and for that peak calculate the IOPS.

For IO1 Volumes:

The data for IO1 type of volume is sent per minute by default which means you should calculate the IOPS used by your volume by dividing the IOPS by 60 if you choose 1 min duration for sum/max. If you are choosing sum/max for 5 min duration then you should divide the IOPS by 300 (that is 5*60).

Inference:

If calculated IOPS is equal or approximately equal to the IOPS given by you and the volume is constantly running at this IOPS, then, probably your disk may be a bottleneck for the performance of your application. If you see any performance issue and constant utilisation of IOPS then you might need to modify the volume with more IOPS. Here I have used "probably" as this could be one of the reason for low performance but not definitely. There could be some other bottlenecks too like CPU, so do your debugging and research before making a conclusion.



Read More

Sunday, 14 May 2017

// // 1 comment

GP2 Vs PIOPS | How to Choose Type of AWS EBS Volume

How To Calculate IOPS Consumed by EBS Volume

How to Choose Type of AWS EBS Volume

Save Cost using GP2 Volumes Instead of Provisioned IO Volume

Skip to end of metadata

Aim:

  • Understanding GP2 volume 
  • Understanding IO1 Volume 
  • Which one is cost and performance effective 
  • How much IOPS do you need? 
  • Which one to choose, GP2 or IO1

Understanding GP2:

  • Cost effective (Explained below) 
  • Range in size from 1 GiB to 16 TiB 
  • Max throughput - 160 MB/s 
  • Baseline performance of 3 IOPS/GiB 
  • Baseline throughput can be increased by increasing volume size 
  • Maximum throughput of 160 MiB/s 
  • Ability to burst to 3,000 IOPS 
  • Refills at the rate of 3 IOPS and can go max upto 54,00,000 I/O credits 
  • More IO credits, the more time it can burst beyond its baseline capacity 
  • Larger GP2 volume refills the credits more quickly 
  • Initial credits - 54,00,000 I/O credits 
  • Volume accumulated 180K IOPS can burst upto 1 min (180000/3000 = 60s = 1 min)

Understanding IO1:

  • For IO intensive workloads like databases 
  • Range from 4 GB to 16 TB 
  • Max throughput - 320 MB/s 
  • IOPS can be specified directly irrespective of the volume size 
  • No credit balance

Which one is cost and performance effective?

  • Performance:GP2
    100 GB volume (300 IOPS) [Baseline throughput - 128 MB/s]
    can burst upto 3000 IOPS


    IO1
    100 GB volume (300 IOPS) [Baseline throughput - 75 MB/s ]
    No burst available

  • Cost:GP2 - 100 GB volume (300 IOPS) - $7/month
    IO1 - 100 GB volume (300 IOPS) - $32/month

How much IOPS do you need?     

  • Check cloudwatch metrics 
  • Observe the sum of volumereadops and volumewriteops for a given period(peak) of time. 
  • Calculate it for one second, this would be the IOPS you need
  • Example:

           
    Read operations - 830694
    For one sec = 830694/(15*60) = 923 ops/s

    Write operations - 87500
    For one sec = 87500/(15*60) = 97.22 ops/s

    Total IOPS = 923 + 97.22 = 1020 IOPS

    At max the IOPS consumed by the volume is 1020, hence we should provision at least 1020 IOPS

Which one to choose, GP2 or IO1

  • You have the answer now
Read More

Friday, 14 April 2017

// // Leave a Comment

An error occurred while installing json (1.8.1), and Bundler cannot continue.

Not able to install gem json -v '1.8.1'

Install json gem on Ubuntu

When you install bundler using apt-get repository of ubuntu, it does not install latest version of bundler. It causes trouble sometimes with some gems installation process. One scenario is described below:

If you have some gems defined in your Gemfile that have dependency over json gem, then while running 

$ bundle install

you may encounter following error:

DEBUG [gk760254] An error occurred while installing json (1.8.1), and Bundler cannot continue.
DEBUG [gk760254] Make sure that `gem install json -v '1.8.1'` succeeds before bundling.

To solve this error follow:

$ bundle update
$ bundle install

First command will update the version of bundle which will solve the error and you will be able to install all required gems successfully.
Read More

Thursday, 30 March 2017

// // Leave a Comment

Delete Unassigned Shards Indexes | Elasticsearch

Bash Script To Delete Unassigned Shards Indexex



#!/bin/bash
IFS=$'\n'
for line in $(curl -s 'localhost:9200/_cat/shards' | fgrep UNASSIGNED); do
 INDEX=$(echo $line | (awk '{print $1}'))
 SHARD=$(echo $line | (awk '{print $2}'))
 #echo $INDEX
 curl -XDELETE localhost:9200/$INDEX
done

Read More