Thursday, November 21, 2019

Elastic Search - recovery of shards

In order to understand the status of the Elastic Cluster shard recovery (how many shards and in what percentage of data are still to be consumed by the elastic node):



watch -n 1 -d "curl -sS localhost:9200/_cat/recovery | grep -v done | sort"


curl -sS localhost:2013/_cat/recovery | grep -v done | sort
chat_events_2018_10        0  1080986 replica index    svpr-els219 svpr-els222 n/a n/a 99  99.0%  9245443931 99.4%  99  9245443931  0       100.0% 0
chat_events_2018_10        12 880628  replica index    svpr-els219 svpr-els225 n/a n/a 118 80.5%  9507834833 50.9%  118 9507834833  0       100.0% 0
chat_events_2018_10        4  1080998 replica index    svpr-els217 svpr-els222 n/a n/a 120 98.3%  9212348531 84.1%  120 9212348531  0       0.0%   549128
chat_events_2018_10        6  48448   gateway translog avpr-els217 avpr-els217 n/a n/a 0   100.0% 0          100.0% 120 9111543410  314413  -1.0%  -1
chat_events_2018_10        7  37318   gateway translog svpr-els239 svpr-els239 n/a n/a 0   100.0% 0          100.0% 119 9355121451  215907  -1.0%  -1
chat_events_2018_11        15 246460  replica index    svpr-els221 svpr-els230 n/a n/a 94  92.6%  7473306012 59.9%  94  7473306012  0       0.0%   207497
chat_events_2018_12        17 561707  replica index    svpr-els217 svpr-els225 n/a n/a 78  83.3%  5985100320 0.1%   78  5985100320  0       100.0% 0
chat_events_2019_01        10 403900  replica index    svpr-els222 svpr-els230 n/a n/a 162 68.5%  5824180424 0.3%   162 5824180424  0       0.0%   166305
chat_events_2019_02        1  377381  replica index    svpr-els222 svpr-els228 n/a n/a 154 72.1%  5509742229 0.2%   154 5509742229  0       0.0%   122191
chat_events_2019_02        16 561676  replica index    svpr-els220 svpr-els245 n/a n/a 150 95.3%  4684545993 80.1%  150 4684545993  0       0.0%   122191
chat_events_2019_03        3  936237  replica index    svpr-els217 svpr-els242 n/a n/a 158 75.9%  5212773307 7.8%   158 5212773307  0       0.0%   1527414

Sunday, October 6, 2019

lpnova - create OpenStack VM

Clone (clone server similar to avor-wto134 - 2 instances)
lpnova --clone avor-wto134 -H avor-wto -Q 2 -D virginia -U fawzea

in case of failure (because of F5 for ex , assuming avor-wto109 and 122 was created but failed in the middle) 

lpnova --clone avor-wto134 -H avor-wto109 -H avor-wto122   -D virginia -U fawzea --load 

Tuesday, September 24, 2019

Puppet sandbox


In order to check your puppet script in a sandox, go to any linux server and create the following directory structure:



Create dir


/tmp/mypuppet/


Under this directory 


./modules./modules/test./modules/test/templates./modules/test/templates/test.erb./modules/test/manifests./modules/test/manifests/init.pp



Here's your manifest: 
./test.pp

puppet apply --modulepath /tmp/mypuppet/modules .  test.pp

In my example , this was the manifest:

test.pp :
node qtvr-wto134 {class { 'test::config': }
} 

the modules modules/test/manifests/init.pp :


class test::config ($routingRulesList = ['zzffline1', 'zzffline2', 'zzffline3'],) {
file { "/home/michael_puppet_sandbox/mypuppet/locations.include":ensure => present,content => template("test/test.erb"),}
}

 and the template modules/test/templates/test.erb :
<% @routingRulesList.each do |routingRule| -%><%=routingRule%><% end %>


and then click on

 puppet apply --modulepath /tmp/mypuppet/modules .  test.pp 


The command puppet apply --modulepath /tmp/mypuppet/modules . test.pp  will create the following output file :



puppet apply --modulepath /tmp/mypuppet/modules . test.pp
zzffline1zzffline2zzffline3

Thursday, February 7, 2019

Run specific Junit unit test on Maven

How to run specific test within Maven mvn 

  1. Click on the module Run... button
  2. Add your own argument : for ex, instead of clean deploy , write
     test  -Dtest=**PeriodicFlow*Test#simpleChatAndCheckChatExposureLatencyAndMCS  -DfailIfNoTests=false
    This argument stands for 
    For running the Java Test file PeriodicFlow (like PeriodicFlowAlphaTest , PeriodicFlowColoTest etc ) 
    and will run only this test method simpleChatAndCheckChatExposureLatencyAndMCS
  3. you can also run an entire file / package etc ...

Thursday, October 11, 2018

Working environment ... for mac / apple

Clipboard manager
https://clipy-app.com/

KeepPass
https://www.keepassx.org/downloads

CheatSheet
https://www.mediaatelier.com/CheatSheet/

BetterTouch (no free)
https://folivora.ai/downloads



brew cask install minikube

+ you'll need to install virtualbox:
brew cask install virtualbox

When starting the minikube use the bellow command
minikube start --kubernetes-version=v1.6.3 --cpus=4 --memory=4096 --disk-size=20g; eval $(minikube docker-env)

If you get the following error during the installation:Error: Unknown command: cask
​Run the following first, and then re-run the installation.
cd $(brew --repo); git fetch; git reset --hard origin/master; brew update​



Thursday, March 8, 2018

for loop example - for remote ssh

instead of mcollective:

for server in qtvr-els03  qtvr-els04  qtvr-els05  qtor-els601  qtor-els602  qtor-els603  qtvr-els005  qtvr-els0029 ; do ssh root@$server "hostname; /etc/init.d/elasticsearch status "; done


Or also
for server in `zoom --HF lpcluster=z2_elasticsearch_agent_manager_01 -f hostname`; do ssh $server 'echo $HOSTNAME'; done;



in another word:

for server in server1 server2 server3 ; do ssh root@$server "hostname; echo do something"; done


Very useful!

Tuesday, November 28, 2017

SSH Login without password

If you want to access a remote terminal without being required to type your password, you have to do the following:


ssh-keygen
You can accept all the default
This will create a file with a public key under your $HOME directory

$HOME/.ssh/id_rsa.pub
this look as following :
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDgDnpDHO5U/Ba8xKZezlm7OpwbV0WBvJXelshOO2LZJxZCI8h5QRlbjYws5Gy+oxuNftQHliXFFfHJlFtRk4xo27JkdeYmrI33qHjDSZ4fWx4RJA1HODBqcmscisMrv4D8ELdP0pFXkL8+GM8l2bxu8U1HS2yuC//33mxn7auo2GJUr1vOGzsLtp7qS/kdLqf2Vo4YG6MtNmEw8Y+tlbSe0zO0uRR7sTj9aq+YM+KtLU2xxzzffsiAMqlxXnZd6c/PmVsJ/1d1ypk3Xrx69R7OlTB5rWApqB/eK9Mc53uCqUhFrzkKWWNyoP3/jEwJGJTfpuhL4gYmJtKdAl3RuXl4EB

Then, in order to enable ssh to a remote host without being required to type a password, you just have to add this public key to the remote host :

Type: 
ssh-copy-id -i ~/.ssh/id_rsa.pub remote-host
like for ex 
ssh-copy-id -i ~/.ssh/id_rsa.pub root@qtvr-els003 

This will automatically append your public key into the remote file (but this is something you can do manually as well) 

[root@qtvr-els0003 ~]# cat ~/.ssh/authorized_keys
# HEADER: This file was autogenerated at Mon Oct 30 10:42:29 +0200 2017
# HEADER: by puppet.  While it can still be managed manually, it
# HEADER: is definitely not recommended.
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAuTtqxO/t+gebf+INEaBQwUmfckztextfJTBA3BstQifX6aqtnelgf9Mqu3OtjFhg3ddgErz2ft1aF6x/rF8Q0kzq8OR8ohmZrIPW+ZjxbOc9uvW1sniChCJFCtua+Hmm84zlIHwwwM0nK1jzBazVJ/zQR4jtY3V9F/sIVGTxowgiSNlszveeWWs0EN6xc5Uh7vE4ZICoXMKEkNhb30k9WZ0H2sNALzAghgmjSUv7CK/fGZ1UHG0Kh6z7J9aensCOHEKS5carGBFjrtfCI/ArCxwwwwqMg/ukJ8fWd2ekVNwKrm+J0iCVBlZ9pA6wV2BkJF77ZBlfPlW6q5T7r8Q23kJ2M5w== root@tlvmanager.tlv.lpnet.com
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDgDnpDHO5U/Ba8xKZezlm7OpwbV0WBvJXelshOO2LZJxZCI8h5QRlbjYws5Gy+oxuNftQHliXFFfHJlFtRk4xo27JkdeYmrI33qHjDSZ4fWx4RJA1HODBqcmscisMrv4D8ELdP0pFXkL8+GM8l2bxu8U1HS2yuC//33mxn7auo2GJUr1vOGzsLtp7qS/kdLqf2Vo4YG6MtNmEw8Y+tlbSe0zO0uRR7sTj9aq+YM+KtLU2xxzzffsiAMqlxXnZd6c/PmVsJ/1d1ypk3Xrx69R7OlTB5rWApqB/eK9Mc53uCqUhFrzkKWWNyoP3/jEwJGJTfpuhL4gYmJtKdAl3RuXl4EB


For MAC OS User: 
I found this link for installing the ssh-copy-id command, which was missing from my laptop: 

https://stackoverflow.com/questions/25655450/how-do-you-install-ssh-copy-id-on-a-mac

Basically, download the code from here and make it accessible for all users: 

sudo curl https://raw.githubusercontent.com/beautifulcode/ssh-copy-id-for-OSX/master/ssh-copy-id.sh -o /usr/local/bin/ssh-copy-id sudo chmod +x /usr/local/bin/ssh-copy-id