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

 

最新文章

  1. jade转化为html
  2. Understanding Chan Chan's in Go
  3. django_restframework_angularjs
  4. python以指定宽度及格式输出字符串
  5. c++ 的 坑真多之头文件
  6. OUTLOOK连EXCHANGE,配置POP3时跳出错误问题
  7. html中radio,checkbox值的获取、赋值、注册事件
  8. git命令与github使用
  9. [转]Debugging the Mac OS X kernel with VMware and GDB
  10. ACE首页更改
  11. Java数据结构和算法(十二)——2-3-4树
  12. Python能做些什么?
  13. iOS中 动态启动图GIF的简单设置 韩俊强的博客
  14. spring jpa 语法
  15. selenium中的对文本进行全选,复制,粘贴,剪切和删除的操作
  16. MySQL数据查询子查询语句
  17. BZOJ.1558.[JSOI2009]等差数列(线段树 差分)
  18. 使用Jenkins pipeline流水线构建docker镜像和发布
  19. Python之列表推导式
  20. fastjson基本使用 (待继续完善)【原】

热门文章

  1. 洛谷P5774,可爱的动态规划。
  2. 小书MybatisPlus第2篇-条件构造器的应用及总结
  3. selenium 怎么查找定位鼠标移上去显示,移开鼠标就消失的内容
  4. Jmeter系列(33)- 跨平台运行 Jmeter,CSV 文件路径如何设置?
  5. day62 作业
  6. EOS基础全家桶(十五)智能合约进阶2
  7. 5 个 IDEA 必备插件,让效率成为习惯
  8. 爬虫05 /js加密/js逆向、常用抓包工具、移动端数据爬取
  9. HotSpot VM运行时
  10. Zabbix 4.0 API 实践,主机/主机群组 批量添加模板和删除模板