1.Elasticsearch安装
参考地址:
https://www.elastic.co/guide/en/elasticsearch/reference/2.4/_installation.html
-
下载地址:
https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/
tar/elasticsearch/2.4.1/elasticsearch-2.4.1.tar.gz
- 下载后解压到指定的目录
- 修改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插件:
-
从GitHub上下载:
https://github.com/mobz/elasticsearch-head/archive/master.zip
- 下载上一步的文件到指定目录
- 安装elasticsearch-head插件:
- /opt/elasticsearch-2.4.1/bin/plugin install file:///opt/elasticsearch-head-master.zip
- 启动elasticsearch(不能以root用户启动,需要建立相应的用户):
- /opt/elasticsearch-2.4.1/bin/elasticsearch
- 或者
- /opt/elasticsearch-2.4.1/bin/elasticsearch -d (后台守护进程的方式启动)
浏览器访问节点:
http://192.168.0.204:9200/_plugin/head/
安装ik中文分词器:
- 从GitHub上下载:
https://github.com/medcl/elasticsearch-analysis-ik/archive/v1.10.1.zip
- 利用maven进行mvn clean package后得到 (如果你的es版本是2.4.1,就不用走下面步骤了,本人已经编译打包好的文件,地址:
https://raw.githubusercontent.com/hollowj/elasticsearch-analysis-ik/master/elasticsearch-analysis-ik-1.10.1.zip
)- ./target/releases/elasticsearch-analysis-ik-1.10.1.zip
- 打开elasticsearch根目录:
- mkdir ./plugins/ik/
- 解压maven编译好的zip包到ik目录下
安装 Marvel:
- 下载许可证和Marvel相关依赖
https://download.elasticsearch.org/elasticsearch/marvel/marvel-2.4.1.tar.gz
- 下载上一步的三个文件到指定目录
- 分别在elasticsearch和kibana中安装:
- bin/plugin install file:///path/to/file/license-2.4.1.zip
- bin/plugin install file:///path/to/file/marvel-agent-2.4.1.zip
- bin/kibana plugin –install marvel –url file:///path/to/file/marvel-2.4.1.tar.gz
- 可以申请一年的basic license:
-
https://www.elastic.co/subscriptions
申请完毕会有邮件到你的邮箱点击下载一个json格式的证书, - 默认密码是changeme
2. Logstash安装:
参考地址:
https://www.elastic.co/guide/en/logstash/2.4/installing-logstash.html
-
下载(
https://www.elastic.co/downloads/past-releases/logstash-2-4-1
)
https://download.elastic.co/logstash/logstash/logstash-2.4.1.tar.gz
- 下载后解压到指定的目录
- 安装logstash-input-jdbc插件进行MySQL的数据同步到elasticsearch中:
- logstash-input-jdbc需要gem环境支持
- yum install ruby
-
参考
http://gems.ruby-china.org/
修改相应信息 -
从GitHub上下载:
https://github.com/logstash-plugins/logstash-input-jdbc/archive/master.zip
- 解压下载好的zip文件并cd logstash-input-jdbc
- gem build logstash-input-jdbc.gemspec
- /opt/logstash-2.4.1/bin/logstash-plugin install /path/to/logstash-output-kafka-1.0.0.gem
-
bin/logstash-plugin list –verbose 查看logstash-input-jdbc是否安装成功,版本是否对应GitHub上的版本(参考:
https://www.elastic.co/guide/en/logstash/2.4/working-with-plugins.html
) - 以非root系统账号启动Logstash(同上):
-
参考:
https://www.elastic.co/guide/en/logstash/2.4/command-line-flags.html
- -e标志直接从命令行启动:
- bin/logstash -e ‘input { stdin { } } output { stdout {} }’
- -f标志从配置文件启动:
- bin/logstash -f <path/to/file> (.conf配置文件)
3.Kibana安装:
-
参考地址:
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
- 下载后解压到指定的目录
- 修改配置文件访问elasticsearch
-
vim /opt/kibana-4.6.3-linux-x86_64/config/kibana.yml
elasticsearch.url: “http://192.168.0.1:9200” 访问集群中任一节点
- 以非root系统账号启动kibana(同上):
- /opt/kibana-4.6.3-linux-x86_64/bin/kibana
-
浏览器访问:
http://192.168.0.1:5601/
转载于:https://my.oschina.net/hollowj/blog/801496