Tuesday, November 5, 2019

How to increase Elasticsearch Shard recovery Speed

To Increase Shard recovery speed do this:

Increase node recovery speed

PUT http://es:9200/_cluster/settings

"persistent" : {
"indices.recovery.max_bytes_per_sec": "200mb",
"indices.recovery.max_concurrent_file_chunks": 5,
"cluster.routing.allocation.node_concurrent_recoveries" : 5



Wednesday, January 23, 2019

Shell Script to SSH into servers

This is a simple script that can ssh into a server by typing the password for you.

Filename: login
eval spawn ssh username@servername
expect "assword:"
send "server_password\r"

# to run the script
# ./login
In this below script you can pass arguments to the shell script
Filename: login
set num [lindex $argv 0];
eval spawn ssh username@servername-$num
expect "assword:"
send "server_password\r"

# make sure to give executable permission to script.

chmod +x login

# to run the script and login to server-01.

./login 01

Now add the script path to your .bashrc file as alias, so that you can access this script from any path.

# vi ~/.bashrc

alias login='/path/to/script/file/login'

After updating the .bashrc file, you will have to source.
source ~/.bashrc

Now call the script from anywhere in your shell.
login 01