Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save davidbj/6548309 to your computer and use it in GitHub Desktop.

Select an option

Save davidbj/6548309 to your computer and use it in GitHub Desktop.
1.ElasticSearch install
download:
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.20.2.tar.gz
install:
tar -zxvf elasticsearch-0.20.2.tar.gz
mv elasticsearch-0.20.2 elasticsearch
Edit '/usr/local/elasticsearch/config/elasticsearch.yml':
cluster.name: elasticsearch-kibana #In logstash configuration file using the
node.name: r6x64o11-pv084 #hostname
path.conf: /usr/local/elasticsearch/config #configure file path
path.data: /mnt/storage/es-data #data storage path
path.work: /usr/local/elasticsearch/tmp
path.logs: /usr/local/elasticsearch/logs #elasticsearch log path
bootstrap.mlockall: true
Get the server:
wget http://github.com/elasticsearch/elasticsearch-servicewrapper/archive/master.zip
unzip master
mv elasticsearch-servicewrapper-master /usr/local/elasticserach/bin/service/
rm -rf master
rm -rf elasticsearch-servicewrapper-master/
configure '/usr/local/elasticsearch/bin/service/elasticsearch.conf':
set.default.ES_HOME=/usr/local/elasticsearch
set.default.ES_HEAP_SIZE=4096
wrapper.java.additional.10=-Des.max-open-files=true
wrapper.logfile.maxsize=5m
wrapper.logfile.maxfiles=5
Add ES home to root user's '~/.bash_profile':
export ES_HOME=/usr/local/elasticsearch
Create elasticsearch user:
useradd -d /home/elasticsearch -s /bin/sh elasticsearch
chown -R elasticsearch:elasticsearch $ES_HOME
chown -R elasticsearch:elasticsearch /mnt/storage/es-data
Edit '/etc/securtity/limits.conf':
elasticsearch soft nofile 65535
elasticsearch hard nofile 65535
Install the service:
bin/service/elasticsearch install
Run the service:
service elasticsearch start or /usr/local/elasticsearch/bin/service/bin/elasticsearch start
2.install logstash
Download source code:
mkdir /usr/local/logstash
cd /usr/local/logstash
wget https://logstash.objects.dreamhost.com/release/logstash-1.2.1-monolithic.jar
Indexer configuration --'vim /usr/local/logstash/indexer.conf':
input {
file {
path => "/var/log/httpd/access_log"
type => "apache_access"
}
}
filter {
if [type] == "apache_access"{
grok {
match => ["message", "%{COMBINEDAPACHELOG}"]
}
}
}
output {
stdout { debug => true }
elasticsearch { #logstash data sent to elaticsearch server.
host => "localhost"
port => "9300"
cluster => "elasticsearch-kibana" #elasticsearch cluster.name
}
if [type] == "apache_access" { #logstash data sent to statsd server.
statsd {
host => "localhost" #statsd server IPaddr.
port => 8125 #statsd server Port(default Tcp port:8125; default Udp port:8126)
namespace => "logstash"
increment => "apache.httpcode.%{response}" #sent to graphite server %{response}--Apache access log Request status.
}
}
}
Run logstash:
java -jar logstash-1.2.1-monolithic.jar agent -f indexer.conf &
3.Install Kibana3
Download Kibana3:
git clone https://github.com/elasticsearch/kibana3.git
Install Kibana3:
mv Kibana /var/www/html/
cd kibana
vim config.js
elasticsearch:"http://132.96.77.68:9200", #logstash listen port
kibana_index: "kibana-int",
modules: ['histogram','map','pie','table','filtering',
'timepicker','text','fields','hits','dashcontrol',
'column','derivequeries','trends','bettermap','query',
'terms'],
Confiure Httpd virtualHost:
vim /etc/httpd/conf.d/vhost.conf
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /var/www/html/kibana
ServerName 132.96.77.68
</VirtualHost>
Restart Httpd Server:
service httpd restart
4.install statsd
Download Statsd:
git clone https://github.com/etsy/statsd.git
Install Node:
download source node.tar.gz and install.
configure statsd:
cd /usr/local/statsd/
cp exampleConfig.js local.js
vim local.js
{
graphitePort: 2003 #graphite listen port.
, graphiteHost: "132.96.77.98" #graphite Ipaddr.
, port: 8125 #statsd listen port.
, backends: [ "./backends/graphite" ]
}
Run statsd:
node stats.js local.js &
5. Install graphite
graphite can be installed via this link:
https://gist.github.com/dillera/1634493
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment