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. Instrction Arrangement UDH 4109 拓扑排序 or 最长路

    题目描述 Ali has taken the Computer Organization and Architecture course this term. He learned that ther ...

  2. display:inline-block 什么时候不会显示间隙?

    移除空格 使用margin负值 使用font-size:0 letter-spacing word-spacing

  3. Python 数字格式转换

    # 数字格式转换v1 '''a = input() a1 = list(a) b = ["零", "一", "二", "三&quo ...

  4. 开源API文档工具- swagger2 与 smart-doc 比较 与 使用

    工具开源地址 swagger2 : https://swagger.io/ smart-doc: https://www.oschina.net/p/smart-doc  国产 两者的比较 swagg ...

  5. 【TokyoWesterns CTF】shrine

    信息: 题目来源:TokyoWesterns CTF 标签:flask.SSTI 解题过程 构建题目环境后,访问主页可以获得程序源码: import flask import os app = fla ...

  6. 论TEMP临时变量与VAR静态变量区别

    TEMP临时变量:顾名思义,这种变量类型是临时的,没有固定的存放数据的内存空间.每次扫描结束后则清零,在下个扫描周期开始时,这个变量的值都是不确定的,一般为0.使用临时变量需要遵循一个原则:先赋值再使 ...

  7. Redis 相关运维操作

    背景 Redis作为目前全球最流行的KV存储,除了使用之外,还需要做好日常的运维工作.关于运维相关的工作,本文从以下方面进行介绍说明(Redis5.0以上): 内存方面 客户端连接方面 工具方面 说明 ...

  8. elementUI form表单验证不通过的原因

    <el-form :model="form" :rules="rules"> <el-form-item prop="input&q ...

  9. 题解 洛谷 P2086 【[NOI2012]魔幻棋盘】

    先考虑只有一维的情况,要求支持区间加和求区间 \(\gcd\),根据 \(\gcd\) 的性质,发现: \[ \gcd(a_1,a_2,a_3,\ldots a_n)=\gcd(a_i,a_2-a_1 ...

  10. 题解 洛谷 P4098 【[HEOI2013]ALO 】

    考虑原序列中的每一个值作为构成最终答案的那个次大值,那么其所在的合法区间最大时,其对答案的贡献最大. 一个值作为最大值时有两个合法的最大区间,一个是左边第二个比其大的位置和右边第一个比其大的位置构成的 ...