本文主要讲elasticsearch-2.2.1的安装过程。

准备工作:

1.搭建虚拟机

你需要先参考

hadoop2集群环境搭建

把你的虚拟机搭建起来-hadoop环境可以先不用搭建(完成步骤1到步骤8

2.下载elasticsearch包

下载elasticsearch-2.2.1.tar.zip

这里我搭建的是4台虚拟机(node1,node2,node3,node4)

elasticsearch 只允许普通用户操作,不允许root用户操作

--1.关闭防火墙
service iptables stop --2.创建用户elsearch
useradd elsearch
--3.给用户elsearch设置密码
passwd elsearch --4.在/opt目录下面创建elsearch/es/目录
mkdir /opt/elsearch/es/ --5.进入到/opt目录下面
cd /opt/ --6.把elsearch目录以及里面的子目录的权限设置为elsearch
chown -R elsearch:elsearch elsearch --此时,/elsearch, /elsearch/es的权限都应该为elsearch --7.切换用户到elsearch
su elsearch

此时,所有节点都应该是elsearch用户,而不是root用户。

现在去到node1节点上面进行操作

--此时,在node1上面操作
--1.此时,我们就可以把下载好的elasticsearch-2.2.1.tar.zip文件上传到node1下面的/opt/elsearch/es/
--2.解压/opt/elsearch/es/elasticsearch-2.2.1.tar.zip文件
cd /opt/elsearch/es/
unzip elasticsearch-2.2.1.tar.zip --3.修改配置文件
cd /opt/elsearch/es/elasticsearch-2.2.1/conf/ vi elasticsearch.yml # ======================== Elasticsearch Configuration =========================
#
# NOTE: Elasticsearch comes with reasonable defaults for most settings.
# Before you set out to tweak and tune the configuration, make sure you
# understand what are you trying to accomplish and the consequences.
#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.
#
# Please see the documentation for further information on configuration options:
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/setup-configuration.html>
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: elsearch-app
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: node1
#
# Add custom attributes to the node:
#
# node.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
# path.data: /path/to/data
#
# Path to log files:
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
# bootstrap.mlockall: true
#
# Make sure that the `ES_HEAP_SIZE` environment variable is set to about half the memory
# available on the system and that the owner of the process is allowed to use this limit.
#
# Elasticsearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: 192.168.79.138
#
# Set a custom port for HTTP:
#
http.port: 9200
#
# For more information, see the documentation at:
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-network.html>
#
#
# discovery.zen.ping.unicast.hosts: ["host1", "host2"]
#
# Prevent the "split brain" by configuring the majority of nodes (total number of nodes / 2 + 1):
#
# discovery.zen.minimum_master_nodes: 3
#
# For more information, see the documentation at:
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-discovery.html>
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
# gateway.recover_after_nodes: 3
#
# For more information, see the documentation at:
# <http://www.elastic.co/guide/en/elasticsearch/reference/current/modules-gateway.html>
#
# ---------------------------------- Various -----------------------------------
#
# Disable starting multiple nodes on a single system:
#
# node.max_local_storage_nodes: 1
#
# Require explicit names when deleting indices:
#
# action.destructive_requires_name: true
discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: ["192.168.79.138","192.168.79.139", "192.168.79.140","192.168.79.141"]
discovery.zen.ping_timeout: 120s
client.transport.ping_timeout: 60s :wq --4.然后从node1分发到其他节点(node2, node3, node4)的相同目录
cd /opt/elsearch/es
scp -r ./elasticsearch-2.2.1 elsearch@node2:/opt/elsearch/es
scp -r ./elasticsearch-2.2.1 elsearch@node3:/opt/elsearch/es
scp -r ./elasticsearch-2.2.1 elsearch@node4:/opt/elsearch/es

接下来在node2,node3,node4上面进行操作

--分别修改node2,node3,node4上面的配置文件
cd /opt/elsearch/es/elasticsearch-2.2.1/conf/ vi elasticsearch.yml --修改两个地方
--1.node.name: node1
--2.network.host: 192.168.79.138 --修改为和下面相对应,然后保存
192.168.79.138 node1
192.168.79.139 node2
192.168.79.140 node3
192.168.79.141 node4

最后,在所有节点(node1,node2,node3,node4)上面进行操作

--启动elasticsearch
cd /opt/elsearch/es/elasticsearch-2.2.1/bin
./elasticsearch

打开浏览器,输入:node1:9200可以看见一下效果

添加插件elasticsearch-head

下载elasticsearch-head

把下载好的插件重命名为

head

然后添加到所有节点(node1,node2,node3,node4)的

/opt/elsearch/es/elasticsearch-2.2.1/plugins

目录。

然后重启所有节点。

--启动elasticsearch
cd /opt/elsearch/es/elasticsearch-2.2.1/bin
./elasticsearch

效果如下:

了解更多:elasticsearch-head

========================================================

More reading,and english is important.

I'm Hongten

大哥哥大姐姐,觉得有用打赏点哦!你的支持是我最大的动力。谢谢。
Hongten博客排名在100名以内。粉丝过千。
Hongten出品,必是精品。

E | hongtenzone@foxmail.com  B | http://www.cnblogs.com/hongten

========================================================

最新文章

  1. HTML5 &amp; CSS3初学者指南(2) – 样式化第一个网页
  2. PIC12F508/505/509/510/506/519/526/527单片机破解芯片解密方法!
  3. PG CREATEINDEX CONCURRENTLY
  4. 【Mail】搭建邮件服务器(LAMP+Postfix+Dovcot+PostfixAdmin+Roundcubemail)
  5. 微软.NET序列化格式
  6. AngularJS安装配置与基础概要整理(上)
  7. Ingress qdisc
  8. MongoDB-JAVA-Driver 3.2版本常用代码全整理(2) - 查询
  9. Android数据存储(一)----SharedPreferences详解
  10. 最近在用placeholder ,是已有的,网上也有不少都是jq写的
  11. 让ie8支持foreach
  12. SRM 584 DIV1
  13. POJ2449
  14. git开源项目协作
  15. AVD启动不了 ANDROID_SDK_HOME is defined but could not find *.ini
  16. Python 迭代器之列表解析
  17. cAdvisor+Prometheus+Grafana监控docker
  18. 优秀的云计算工程师需要学什么?云计算Docker学习路线
  19. 第一节,Windows10下Darkflow的安装与测试(YOLO)
  20. webStorm的使用

热门文章

  1. Tortoisegit图文使用教程
  2. mysql删除表结构中的“关键字”字段
  3. python 机器学习三剑客 之 Matplotlib
  4. 你循环的时候就可以给他们赋值了,那么就不用addClass,再根据类选择器处理,代码能一气呵成就别写成两段了
  5. docker安装小笔记
  6. eval()和$.parseJSON()注意事项
  7. Android真机测试,连接到本地服务器的方法
  8. UML示例图 zt
  9. Linux网络技术管理及进程管理
  10. Postman测试上传文件