Elasticsearch官网: https://www.elastic.co/products/elasticsearch

一、Linux单节点部署

1. 解压elasticsearch-5.6.1.tar.gz到安装目录下,这里使用的是/opt/module

  $ tar -zxvf elasticsearch-5.6.1.tar.gz -C /opt/module/

2. 在/opt/module/elasticsearch-5.6.1路径下创建data和logs文件夹

  $ mkdir data

  $ mkdir logs

3. 修改配置文件/opt/module/elasticsearch-5.2.2/config/elasticsearch.yml

  $ pwd

  /opt/module/elasticsearch-5.6.1/config

  $ vi elasticsearch.yml

# ---------------------------------- Cluster -------------------------

cluster.name: my-application

# ------------------------------------ Node --------------------------------------

node.name: node-102

# ----------------------------------- Paths ---------------------------------------

path.data: /opt/module/elasticsearch-5.6.1/data

path.logs: /opt/module/elasticsearch-5.6.1/logs

# ----------------------------------- Memory -----------------------------------

bootstrap.memory_lock: false

bootstrap.system_call_filter: false

# ---------------------------------- Network ------------------------------------

network.host: 192.168.1.102

# --------------------------------- Discovery ------------------------------------

discovery.zen.ping.unicast.hosts: ["hadoop102"]

解释:

(1)cluster.name:集群名称,如果要配置集群需要两个节点上的elasticsearch配置的cluster.name相同,都启动可以自动组成集群,这里如果不改cluster.name则默认是cluster.name=my-application。

(2)nodename:节点名称,随意取名字,但是集群内的各节点不能相同。

(3)修改后的每行前面不能有空格,修改后的“:”后面必须有一个空格

4.  配置linux系统环境(为了避免Elasticsearch在使用资源时受限,参考:http://blog.csdn.net/satiling/article/details/59697916)

(1)编辑limits.conf 添加类似如下内容

  $ sudo vi /etc/security/limits.conf

  添加如下内容:

  * soft nofile 65536

  * hard nofile 131072

  * soft nproc 4096

  * hard nproc 4096

(2)进入limits.d目录下修改配置文件。(看一下limits.d,可能名字并不是90-nproc.conf)

  $ sudo vi /etc/security/limits.d/90-nproc.conf

  修改如下内容:

    * soft nproc 1024

  修改为

    * soft nproc 4096

(3)修改配置sysctl.conf

  $ sudo vi /etc/sysctl.conf

  添加下面配置:

    vm.max_map_count=655360

  并执行命令:

    $ sudo sysctl -p

  然后,重新启动elasticsearch,即可启动成功。

5. 启动elasticsearch

  $ cd /opt/module/elasticsearch-5.6.1

  $ bin/elasticsearch

6. 测试elasticsearch

  curl http://hadoop102:9200

  curl -XGET 'localhost:9200/_cat/health?v&pretty'

二、安装Elasticsearch(多节点集群Linux环境)

1. 分发Elasticsearch安装包至hadoop103和hadoop104

  $ xsync elasticsearch-5.6.1/

2. 修改hadoop102配置信息

  $ vi elasticsearch.yml

  添加如下信息:

    node.master: true

    node.data: true

3. 修改hadoop103配置信息

(1)修改Elasticsearch配置信息

  $ vi elasticsearch.yml

    node.name: node-103

    node.master: false

    node.data: true

    network.host: 192.168.1.103

(2)修改Linux相关配置信息(同hadoop102)

4. 修改hadoop104配置信息

(1)修改Elasticsearch配置信息

 $ vi elasticsearch.yml

  node.name: node-104

  node.master: false

  node.data: true

  network.host: 192.168.1.104

(2)修改Linux相关配置信息(同hadoop102)

5. 分别启动三台节点的Elasticsearch

 三、启动异常

1. 使用root用户启动失败

  elasticsearch是不支持使用root账号启动程序的,会报错:“Caused by: java.lang.RuntimeException: can not run elasticsearch as root”:

  解决办法:切换到其他用户启动。

2. elasticsearch安装目录权限不对

  如果elasticsearch就是使用root账号部署的,启动时就会出报错:

  Exception in thread "main" 2018-06-03 17:36:23,881 main ERROR No log4j2 configuration file found. Using default configuration: logging only errors to the console. Set system property 'log4j2.debug' to show Log4j2 internal initialization logging.

  Caused by: java.nio.file.AccessDeniedException: /usr/local/elasticsearch-5.6.0/config/elasticsearch.yml

  解决办法:

  查看文件权限,命令 # ll /usr/local/

    drwxr-xr-x  7 root root       123 4月   7 2018 elasticsearch-5.6.2

  说明这个文件夹属于root用于,其他用户没权限执行,修改文件权限命令如下,elk是用户名:

  chown  -R elk:elk elasticsearch-5.6.0

 

一、elasticsearch部署的更多相关文章

  1. ElasticSearch部署文档(Ubuntu 14.04)

    ElasticSearch部署文档(Ubuntu 14.04) 参考链接 https://www.elastic.co/guide/en/elasticsearch/guide/current/hea ...

  2. Centos7 Elasticsearch部署

    (1)ELKStack简介 1.elk介绍 ELK Stack包含:ElasticSearch.Logstash.Kibana ElasticSearch是一个搜索引擎,用来搜索.分析.存储日志.它是 ...

  3. elasticsearch 部署

    环境 ubuntu 12.04 64位 桌面版 jdk 1.7 elasticsearch 2.3.4 伪集群部署 elasticsearch 主目录在 /home/sdbadmin/es-clute ...

  4. Elasticsearch部署异常Permission denied

    异常描述 在Linux上部署ElasticSearch时抛出了一个异常如下: log4j:ERROR setFile(null,true) call failed. java.io.FileNotFo ...

  5. Elasticsearch 部署以及报错解决

    前言 Elasticsearch 是一个非常值得学习和使用的分布式存储 此次部署将采用 centos6.9 一.初步了解 ES 简谈概念 Elasticsearch 是一个开源的高扩展的分布式全文检索 ...

  6. 第一章·ELKstack介绍及Elasticsearch部署

    一.ELKstack课程大纲  二.ELKstack简介 什么是ELK? 通俗来讲,ELK是由Elasticsearch.Logstash.Kibana 三个开源软件的组成的一个组合体,这三个软件当 ...

  7. ElasticSearch部署安装

    测试版本:elasticsearch-5.1.1 1.Windows环境下安装(win10系统) 1)解压elasticsearch-5.1.1.zip. 2)执行elasticsearch.bat启 ...

  8. ELK日志管理之——elasticsearch部署

    1.配置官方yum源 [root@localhost ~]# rpm --import http://packages.elasticsearch.org/GPG-KEY-elasticsearch ...

  9. ElasticSearch部署

    安装jdk1.7 1.卸载Liunx自带的openjdk rpm -qa | grep jdk 查看当前的jdk版本 sudo yum -y remove java-1.7.0-openjdk-hea ...

随机推荐

  1. Error: error getting chaincode bytes: failed to calculate dependencies报错解决办法

    Error: error getting chaincode bytes: failed to calculate dependencies: incomplete package: github.c ...

  2. VS2019无法获取本地变量或参数的值,因为它在此指令指针中不可用,可能是因为它已经被优化掉了。

    解决方法:

  3. Android/iOS内嵌Unity开发示例

    Unity 与 Android/iOS 交叉开发主要有两种方式,以 Android 为例,一是 Android 生成 jar 或者 aar 包,导入到 unity3d plugin/bin/ 目录下: ...

  4. day17 生成器, 面向过程, 三元表达式, 生成式

    1. 生成器 生成器:就是一种自定义的迭代器,是用来返回多次值自定义迭代器的好处:节省内存 return只能返回一次值,函数就立即结束了yield 1.可以挂起函数,保存函数的运行状态 2.可以用来返 ...

  5. poi excel单元格的校验

    switch (cell.getCellType()) { case HSSFCell.CELL_TYPE_NUMERIC://数值类型 if (0 == cell.getCellType()) { ...

  6. Linux01 /Linux初识

    Linux01 /Linux初识 目录 Linux01 /Linux初识 1. 服务器 2. Linux系统介绍 3. linux简单介绍 4. VMware与Centos系统安装 5. 各个连接协议 ...

  7. unity-编辑器快捷按键

    效果图 代码 [MenuItem("Custom/Run _F1")] static void PlayToggle() { EditorApplication.isPlaying ...

  8. MnasNet:经典轻量级神经网络搜索方法 | CVPR 2019

    论文提出了移动端的神经网络架构搜索方法,该方法主要有两个思路,首先使用多目标优化方法将模型在实际设备上的耗时融入搜索中,然后使用分解的层次搜索空间,来让网络保持层多样性的同时,搜索空间依然很简洁,能够 ...

  9. TX 1核4G2M云服务器,376/2年,可免费续1年

    腾讯云个人开发者活动 https://cloud.tencent.com/act/developer

  10. CSS文本溢出,显示省略号(...)

    方式1:这种方式就是必须要跟width搭配使用,当你使用的display:flex; 的时候可能会影响样式 width: 200px; overflow: hidden; /*超出部分隐藏*/ tex ...