elasticSearch2.4.1安装笔记

  • Post author:
  • Post category:其他



1.Elasticsearch安装

参考地址:

https://www.elastic.co/guide/en/elasticsearch/reference/2.4/_installation.html

  1. 下载地址:

    https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/


    tar/elasticsearch/2.4.1/elasticsearch-2.4.1.tar.gz
  2. 下载后解压到指定的目录
  3. 修改elasticsearch的配置文件(以集群为例)
vim /opt/elasticsearch-2.4.1/config/elasticsearch.yml
#(此配置文件中,开头不能有空格,冒号后面要空一格)

cluster.name: shunyou-elasticsearch #(集群中这个名字要一致)

node.name: node-1 #(集群中,这个节点名每个节点名称唯一)

network.host: 192.168.0.1 #(绑定当前ip)

discovery.zen.ping.unicast.hosts: ["host1", "host2"] #(配置集群中的主节点有哪些)

discovery.zen.minimum_master_nodes: 2 #(配置集群中最小主节点数量[(total number of nodes / 2 + 1)])

discovery.zen.ping_timeout: 30s #(配置集群中主节点被选举或加入超时时间,更高的值确保更少的失败机会)


安装插件:(推荐离线安装,在线安装网络太慢)


安装elasticsearch-head插件:
  1. 从GitHub上下载:

    https://github.com/mobz/elasticsearch-head/archive/master.zip
  2. 下载上一步的文件到指定目录
  3. 安装elasticsearch-head插件:
  4. /opt/elasticsearch-2.4.1/bin/plugin install file:///opt/elasticsearch-head-master.zip
  5. 启动elasticsearch(不能以root用户启动,需要建立相应的用户):
  6. /opt/elasticsearch-2.4.1/bin/elasticsearch
  7. 或者
  8. /opt/elasticsearch-2.4.1/bin/elasticsearch -d (后台守护进程的方式启动)

浏览器访问节点:


http://192.168.0.


204


:9200/


http://192.168.0.204:9200/_plugin/head/


http://192.168.0.


204


:9200/_cluster/health?pretty=true


http://192.168.0.


204


:9200/_nodes/process?pretty


安装ik中文分词器:
  1. 从GitHub上下载:

    https://github.com/medcl/elasticsearch-analysis-ik/archive/v1.10.1.zip
  2. 利用maven进行mvn clean package后得到                                                                   (如果你的es版本是2.4.1,就不用走下面步骤了,本人已经编译打包好的文件,地址:

    https://raw.githubusercontent.com/hollowj/elasticsearch-analysis-ik/master/elasticsearch-analysis-ik-1.10.1.zip

    )
  3. ./target/releases/elasticsearch-analysis-ik-1.10.1.zip
  4. 打开elasticsearch根目录:
  5. mkdir ./plugins/ik/
  6. 解压maven编译好的zip包到ik目录下


安装 Marvel:
  1. 下载许可证和Marvel相关依赖



https://download.elastic.co/elasticsearch/release/org/elasticsearch/plugin/license/2.4.1/license-2.4.1.zip



https://download.elastic.co/elasticsearch/release/org/elasticsearch/plugin/marvel-agent/2.4.1/marvel-agent-2.4.1.zip



https://download.elasticsearch.org/elasticsearch/marvel/marvel-2.4.1.tar.gz

  1. 下载上一步的三个文件到指定目录
  2. 分别在elasticsearch和kibana中安装:
  3. bin/plugin install file:///path/to/file/license-2.4.1.zip
  4. bin/plugin install file:///path/to/file/marvel-agent-2.4.1.zip
  5. bin/kibana plugin –install marvel –url file:///path/to/file/marvel-2.4.1.tar.gz
  6. 可以申请一年的basic license:

  7. https://www.elastic.co/subscriptions

    申请完毕会有邮件到你的邮箱点击下载一个json格式的证书,
  8. 默认密码是changeme


2. Logstash安装:

参考地址:

https://www.elastic.co/guide/en/logstash/2.4/installing-logstash.html

  1. 下载(

    https://www.elastic.co/downloads/past-releases/logstash-2-4-1



    https://download.elastic.co/logstash/logstash/logstash-2.4.1.tar.gz
  2. 下载后解压到指定的目录
  3. 安装logstash-input-jdbc插件进行MySQL的数据同步到elasticsearch中:
  4. logstash-input-jdbc需要gem环境支持
  5. yum install ruby
  6. 参考

    http://gems.ruby-china.org/

    修改相应信息
  7. 从GitHub上下载:

    https://github.com/logstash-plugins/logstash-input-jdbc/archive/master.zip
  8. 解压下载好的zip文件并cd logstash-input-jdbc
  9. gem build logstash-input-jdbc.gemspec
  10. /opt/logstash-2.4.1/bin/logstash-plugin install /path/to/logstash-output-kafka-1.0.0.gem
  11. bin/logstash-plugin list –verbose 查看logstash-input-jdbc是否安装成功,版本是否对应GitHub上的版本(参考:

    https://www.elastic.co/guide/en/logstash/2.4/working-with-plugins.html

  12. 以非root系统账号启动Logstash(同上):
  13. 参考:

    https://www.elastic.co/guide/en/logstash/2.4/command-line-flags.html
  14. -e标志直接从命令行启动:
  15. bin/logstash -e ‘input { stdin { } } output { stdout {} }’
  16. -f标志从配置文件启动:
  17. bin/logstash -f <path/to/file>  (.conf配置文件)



3.Kibana安装:

  1. 参考地址:

    https://www.elastic.co/guide/en/kibana/4.6/setup.html

    下载(

    https://www.elastic.co/downloads/past-releases/kibana-4-6-3

    ):

    https://download.elastic.co/kibana/kibana/kibana-4.6.3-linux-x86_64.tar.gz
  2. 下载后解压到指定的目录
  3. 修改配置文件访问elasticsearch
  4. vim /opt/kibana-4.6.3-linux-x86_64/config/kibana.yml     

    elasticsearch.url: “http://192.168.0.1:9200”   访问集群中任一节点

  5. 以非root系统账号启动kibana(同上):
  6. /opt/kibana-4.6.3-linux-x86_64/bin/kibana
  7. 浏览器访问:

    http://192.168.0.1:5601/

转载于:https://my.oschina.net/hollowj/blog/801496