forked from stephen-mw/Logstash1.2_kibana3_auto_install
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap
executable file
·84 lines (63 loc) · 2.4 KB
/
bootstrap
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/bash
set -e
# This script will automatically install and configure Logstash and Kibana
# Keep track of if we're running a travis build
TRAVIS=$1
# Grab the fullpath of our root directory
ROOT=$(cd `dirname ${BASH_SOURCE[0]}` && echo $PWD)
apt-get clean
apt-get update
# We need the newest version of redis so we can use the batch function
apt-get install -y --force-yes python-software-properties unzip software-properties-common
add-apt-repository -y ppa:rwky/redis
apt-get update
apt-get install -y --force-yes redis-server openjdk-7-jre-headless rubygems nginx
# Redis serves as the queue for logstash logs
sed -ie 's#bind 127.0.0.1#bind 0.0.0.0#' /etc/redis/redis.conf
# This keeps redis background dumping from crashing if you run low
# on system memory.
if [[ -z "${TRAVIS}" ]]; then
echo "vm.overcommit_memory = 1" >> /etc/sysctl.conf
sysctl -p
fi
/etc/init.d/redis-server restart
# Install and configure elasticsearch
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.3.deb -O /tmp/elasticsearch.deb
dpkg -i /tmp/elasticsearch.deb
rm /tmp/elasticsearch.deb
# These configurations are for a large, 192GB Dell R720. You'll need to adjust
# them for use on any smaller systems.
#cp $ROOT/etc/elasticsearch/elasticsearch.yml .
#cp $ROOT/default/elasticsearch /etc/default/elasticsearch
/etc/init.d/elasticsearch start
# Logstash is just a jar and requires some additional configs
LOGHOME=/etc/logstash
mkdir $LOGHOME && pushd $LOGHOME
wget https://logstash.objects.dreamhost.com/release/logstash-1.2.0-flatjar.jar -O logstash.jar
cp $ROOT/conf/indexer.conf .
cp $ROOT/init/logstash.conf /etc/init/
mkdir /var/lib/logstash # Required working directory for logstash
service logstash start
popd
# Install and configure the Kibana frontend
pushd /opt/
wget http://download.elasticsearch.org/kibana/kibana/kibana-latest.zip
unzip kibana-latest.zip
mv kibana-latest kibana
pushd kibana
# Copy over our nginx conf and restart
cp $ROOT/conf/nginx/kibana_nginx_conf /etc/nginx/sites-available/kibana
ln -s /etc/nginx/sites-available/kibana /etc/nginx/sites-enabled/kibana
unlink /etc/nginx/sites-enabled/default
service nginx restart
cat - <<FINISHED
Elasticsearch installation now complete.
Services running:
Logstash indexer
Elasticsearch
Redis
nginx
nginx is serving Kibana on port 80
To start and stop logstash server:
$ service logstash <start|stop|restart|status>
FINISHED