Created
November 22, 2012 21:06
-
-
Save jarib/4132921 to your computer and use it in GitHub Desktop.
elasticsearch helper for os x
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
#!/bin/bash | |
ES_HOST=http://localhost:9200 | |
ES_LOG=/usr/local/var/log/elasticsearch/elasticsearch_${USER}.log | |
ES_PLIST=~/Library/LaunchAgents/homebrew.mxcl.elasticsearch.plist | |
case $1 in | |
log ) | |
tail -1000f $ES_LOG | |
;; | |
start ) | |
launchctl load -wF $ES_PLIST | |
;; | |
stop ) | |
launchctl unload -wF $ES_PLIST | |
;; | |
reload ) | |
$0 stop && $0 start | |
;; | |
status ) | |
curl -s --max-time 3 ${ES_HOST}/_status | json_reformat | |
curl -s --max-time 3 ${ES_HOST}/_cluster/health | json_reformat | |
curl -s --max-time 3 ${ES_HOST}/_cluster/nodes | json_reformat | |
;; | |
bigdesk ) | |
open ${ES_HOST}/_plugin/bigdesk/ | |
;; | |
bigdesk ) | |
open ${ES_HOST}/_plugin/paramedic/ | |
;; | |
config ) | |
$EDITOR $ES_PLIST | |
;; | |
clear-log ) | |
cat /dev/null > $ES_LOG | |
;; | |
clear-index ) | |
curl -X DELETE $ES_HOST/_all | |
;; | |
* ) | |
echo "Usage: $0 {start|stop|reload|status|log|bigdesk|paramedic|config|clear-log|clear-index}" | |
;; | |
esac | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment