美文网首页
Ubuntu14.04安装5.xElasticsearch, L

Ubuntu14.04安装5.xElasticsearch, L

作者: 会飞的鱼Coo | 来源:发表于2017-08-30 15:34 被阅读120次

    Ubuntu14.04安装Elasticsearch, Logstash, Kibana

    一、安装前

    ELK Server的CPU、RAM和存储量的需求取决于你将要收集的log的数量。在这个教程中,我们将使用以下规格的一个VPS作为我们ELK Server:

    OS:Ubuntu 14.04

    RAM:4GB

    CPU:2

    二、安装java 8

    Elasticsearch和Logstash需要Java,所以我们需要安装。Elasticsearch需要安装最新的Oracle Java 8。当然,如果你要用OpenJDK的话,应该也不错。

    添加Oracle JavaPPA到apt:

    sudo add-apt-repository -y ppa:webupd8team/java

    更新apt包数据库:

    sudo apt-get update

    安装稳定版Oracle Java8(接受弹出的协议内容):

    sudo apt-get -y install oracle-java8-installer

    Java 8安装好了,接下来安装Elasticsearch

    三、安装Elasticsearch

    安装ES之前,需要安装java 8或更高版本,使用官方Oracle发行版或OpenJDK等开源发行版

    1、安装Elasticsearch

    方法一:下载zip包安装

    wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.2.1.zip

    sha1sum elasticsearch-5.2.1.zip

    unzip elasticsearch-5.2.1.zip

    cd elasticsearch-5.2.1/

    方法二:下载的是tar.gz包安装

    wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.2.2.tar.gz

    sha1sum elasticsearch-5.2.2.tar.gz

    tar-xzf elasticsearch-5.2.2.tar.gz

    cd elasticsearch-5.2.2/

    2、运行ES

    ./bin/elasticsearch

    后台运行:

    Elasticsearch在Linux下使用命令sh

    elasticsearch start,按键ctrl+c的时候程序就会stop掉,如何将程序在后台启动呢?

    需要使用:./elasticsearch -d

    这时执行的时候会出现没有权限./elasticsearch: Permission denied

    需要授权执行命令:chmod +x bin/elasticsearch

    再次执行./elasticsearch -d即可启动

    使用ps aux|grep elasticsearch可以查看是否启动

    3、ES配置文件

    /config/elasticsearch.yml

    /config/log4j2.properties

    Elasticsearch有两个配置文件:

    elasticsearch.yml配置Elasticsearch

    log4j2.properties用于配置Elasticsearch日志记录。

    启动ELK:

    /bin/elasticsearch

    bin/logstash-e 'input{stdin{}}output{stdout{codec=>rubydebug}}'

    /bin/kibana

    四、ES head插件安装指南

    1、安装node、npm、grunt

    安装node:

    1.# apt-get update

    2.# apt-get install -y python-software-properties software-properties-common

    3.# add-apt-repository ppa:chris-lea/node.js

    4.# apt-get update

    5.# apt-get install nodejs

    安装npm

    apt-get install npm

    使用npm安装grunt:

    npm install –g grunt–cli

    2、npm安装依赖

    到elasticsearch-head-master目录下,运行命令:

    npm install

    如果速度较慢或者安装失败,可以使用国内镜像:

    npm install -g cnpm --registry=https://registry.npm.taobao.org

    3、修改Elasticsearch配置文件

    编辑elasticsearch-5.1.1/config/elasticsearch.yml,加入以下内容:

    http.cors.enabled: true

    http.cors.allow-origin: "*"

    4、修改Gruntfile.js

    打开elasticsearch-head-master/Gruntfile.js,找到下面connect属性,

    新增hostname: ‘0.0.0.0’:

    connect: {

    server: {

    options: {

    hostname: '0.0.0.0',

    port: 9100,

    base: '.',

    keepalive: true

    }

    }

    }

    5、启动elasticsearch-head

    在elasticsearch-head-master/目录下,运行启动命令:

    grunt server

    6、后台启动elasticsearch-head

    后台启动grunt server命令;

    nohup grunt server &exit

    如果想关闭head插件,使用Linux查找进程命令:

    ps aux|grep head

    结束进程:kill进程号

    五、bigdesk插件安装指南

    修改elasticsearch.yml

    增加

    1.# add for biddesk and es-head

    2.http.cors.enabled:true

    3.http.cors.allow-origin:"*"

    1.git clone https://github.com/hlstudio/bigdesk

    2.[elk@master~]$ cd bigdesk/_site/

    3.[elk@master _site]$ python-mSimpleHTTPServer

    访问http://master:8000测试

    相关文章

      网友评论

          本文标题:Ubuntu14.04安装5.xElasticsearch, L

          本文链接:https://www.haomeiwen.com/subject/ototjxtx.html