Last active
October 14, 2016 14:46
-
-
Save WarFox/b0559c25efbd5737d47995c60eea5ce4 to your computer and use it in GitHub Desktop.
Install Kibana on multiple remote servers.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
kibana_nodes=(server1 server2 server3) | |
elasticsearch_url=http://myelasticsearch.com | |
function install_kibana { | |
echo "install kibana" | |
sudo rpm -i https://download.elastic.co/kibana/kibana/kibana-4.6.1-x86_64.rpm | |
} | |
function install_timelion { | |
echo "install timelion" | |
sudo /opt/kibana/bin/kibana plugin -i elastic/timelion | |
} | |
function install_sense { | |
echo "install sense" | |
sudo /opt/kibana/bin/kibana plugin -i elastic/sense | |
} | |
function update_elasticsearch_url { | |
echo "update elasticsearch url" | |
sed -i "s/elasticsearch.url: http:\/\/localhost:9200\//elasticsearch.url: ${elasticsearch_url}" /opt/kibana/conf/kibana.yml | |
} | |
function restart_kibana { | |
sudo service kibana restart | |
} | |
function install_kibana_on_nodes { | |
echo "install kibana on nodes" | |
for node in "${kibana_nodes[@]}" | |
do | |
echo $node | |
ssh ec2-user@$node "$(typeset -f); install_kibana; install_timelion; install_sense; update_elasticsearch_url; restart_kibana;" | |
done | |
} | |
install_kibana_on_nodes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment