启动教程
1 elasticsearch
cd /soft/elasticsearch-5.1.2/ nohup ./bin/elasticsearch >/dev/null &
ps aux | grep -i elasticsearch | awk {'print $2'} | xargs kill -9
2 elasticsearch-head
cd /soft/elasticsearch-head-master/ nohup grunt server >/dev/null &
ps aux | grep -i grunt | awk {'print $2'} | xargs kill -9
3 logstash
cd /soft/logstash-5.1.2/ nohup ./bin/logstash -f userconf/test-log.conf >/dev/null &
ps aux | grep -i logstash | awk {'print $2'} | xargs kill -9
4 kibana
cd /soft/kibana-5.1.2 nohup ./bin/kibana >/dev/null &
ps aux | grep -i kibana | awk {'print $2'} | xargs kill -9
安装教程
elk新版要求jdk1.8以上版本,请先确定服务器jdk版本 java -version
https://www.elastic.co/products 下载 logstash elasticsearch kibana
cd /soft
tar -xzvf logstash-5.1.2.tar.gz tar -xzvf elasticsearch-5.1.2.tar.gz tar -xzvf kibana-5.1.2-linux-x86_64.tar.gz
rm -rf logstash-5.1.2.tar.gz rm -rf elasticsearch-5.1.2.tar.gz rm -rf kibana-5.1.2-linux-x86_64.tar.gz
1 elasticsearch安装
cd /soft/elasticsearch-5.1.2/
vi config/elasticsearch.yml
1network.host: 0.0.0.0 2#增加新的参数,开启http可以访问es 3http.cors.enabled: true 4http.cors.allow-origin: "*"
保存退出
vi config/jvm.options
-Xms1g -Xmx1g
保存退出
cd /soft/elasticsearch-5.1.2/
http://www.cnblogs.com/sloveling/p/elasticsearch.html 常见问题解决
./bin/elasticsearch
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144] 解决启动报错 切换到root用户修改配置sysctl.conf
vi /etc/sysctl.conf
添加下面配置:
vm.max_map_count=655360
并执行命令:
sysctl -p
然后,重新启动elasticsearch,即可启动成功。
nohup ./bin/elasticsearch >/dev/null &
ps -ef |grep elasticsearch
验证是否启动成功
curl 127.0.0.1:9200
返回
1{ 2 "name" : "r-juGZs", 3 "cluster_name" : "elasticsearch", 4 "cluster_uuid" : "TKOx86-kRn2H0HrZ3hrQEg", 5 "version" : { 6 "number" : "5.1.2", 7 "build_hash" : "c8c4c16", 8 "build_date" : "2017-01-11T20:18:39.146Z", 9 "build_snapshot" : false, 10 "lucene_version" : "6.3.0" 11 }, 12 "tagline" : "You Know, for Search" 13} 14
2 elasticsearch-head插件安装
切换root帐号
https://nodejs.org/en/download/ 下载nodejs上传到服务器
cd /usr/local/
yum -y install xz xz -d node-v6.9.4-linux-x64.tar.xz tar -xvf node-v6.9.4-linux-x64.tar rm -rf node-v6.9.4-linux-x64.tar
设置软链 ln -s /usr/local/node-v6.9.4-linux-x64/bin/node /usr/sbin/node ln -s /usr/local/node-v6.9.4-linux-x64/bin/npm /usr/sbin/npm
设置npm代理镜像 npm config set registry https://registry.npm.taobao.org
安装、配置grunt npm install -g grunt ln -s /usr/local/node-v6.9.4-linux-x64/lib/node_modules/grunt/bin/grunt /usr/sbin/grunt
安装head
cd elasticsearch-head-master/
npm install
修改_site/app.js vi _site/app.js
1// 把localhost改为ip 2this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://localhost:9200"; 3修改为 4this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://172.16.1.13:9200";
修改Gruntfile.js vi Gruntfile.js
1connect: { 2 server: { 3 options: { 4 hostname: "0.0.0.0", #这里 5 port: 9100, 6 base: '.', 7 keepalive: true 8 } 9 } 10}
启动
nohup grunt server >/dev/null &
3 logstash 安装
cd /soft/logstash-5.1.2/
mkdir userconf
vi userconf/test-log.conf
1input { 2 redis { 3 data_type => "list" 4 key => "logstash:redis" 5 host => "172.16.1.22" 6 port => 6381 7 threads => 5 8 type => "test-log" 9 codec => "json" 10 } 11} 12output { 13 if [type] == "test-log" { 14 elasticsearch { 15 hosts => ["172.16.1.13:9200"] 16 index => "youren-test-%{+YYYY.MM.dd}" 17 } 18 } 19} 20
保存退出
nohup ./bin/logstash -f userconf/test-log.conf >/dev/null &
代码端参考网址 https://github.com/kmtong/logback-redis-appender http://www.cnblogs.com/ASPNET2008/p/5594479.html
4 kibana
cd /soft/kibana-5.1.2
vi config/kibana.yml
server.port: 5601 server.host: "0.0.0.0" elasticsearch.url: "http://192.168.50.135:9200"
保存退出
nohup ./bin/kibana >/dev/null &