ES安装

前言

我的环境是ubuntu server 14.04.1LTS

JDK

安装JDK7或者以上最好了

下载安装

1
2
3
4
5
6
#下载安装 Public Signing Key
wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
#添加源
echo "deb http://packages.elastic.co/elasticsearch/2.x/debian stable main" | sudo tee -a /etc/apt/sources.list.d/elasticsearch-2.x.list
sudo apt-get update
sudo apt-get install elasticsearch

配置

  1. 加入ES到系统启动文件:
    sudo update-rc.d elasticsearch defaults 95 1
  2. 启动ES服务:
    sudo /etc/init.d/elasticsearch start
  3. 测试:
    curl -X GET 'http://localhost:9200'
    返回:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    {
    "name" : "Mangle",
    "cluster_name" : "elasticsearch",
    "version" : {
    "number" : "2.3.0",
    "build_hash" : "8371be8d5fe5df7fb9c0516c474d77b9feddd888",
    "build_timestamp" : "2016-03-29T07:54:48Z",
    "build_snapshot" : false,
    "lucene_version" : "5.5.0"
    },
    "tagline" : "You Know, for Search"
    }

设置外部可以访问

现在只能本地访问,要想外部访问要修改es的配置文件

1
2
3
4
5
6
su
cd /etc/elasticsearch/elasticsearch.yml
设置:
network.host: 0.0.0.0
重启es:
/etc/init.d/elasticsearch restart

插件安装

kibana

1
2
3
4
5
6
7
8
下载kibana
wget https://download.elastic.co/kibana/kibana/kibana-4.5.0-linux-x64.tar.gz
sudo tar -zxvf kibana-4.5.0-linux-x64.tar.gz
sudo mv kibana-4.5.0-linux-x64 /usr/local/
#启动kibana,在后台运行
sudo nohup /usr/local/kibana-4.5.0-linux-x64/bin/kibana >kibana.log 2>&1 &
访问:
http://localhost:5601/

集群和数据管理界面 Marvel

1
2
3
4
5
cd /usr/share/elasticsearch
sudo bin/plugin install license
sudo bin/plugin install marvel-agent
sudo /usr/local/kibana-4.5.0-linux-x64/bin/kibana plugin --install elasticsearch/marvel/latest
sudo /etc/init.d/elasticsearch restart

访问: http://localhost:9200/_plugin/marvel/

参考

Installing Marvel
Monitor Elasticsearch

查看数据客户端 head

1
2
3
cd /usr/share/elasticsearch
sudo bin/plugin install mobz/elasticsearch-head
sudo /etc/init.d/elasticsearch restart

访问: http://localhost:9200/_plugin/head/