H__D  

Elasticsearch简介

  Elasticsearch 是一个开源的分布式 RESTful 搜索和分析引擎,能够解决越来越多不同的应用场景

  官网地址:https://www.elastic.co/cn/elasticsearch/

  官网介绍地址:https://www.elastic.co/cn/what-is/elasticsearch

  中文文档:https://www.elastic.co/guide/cn/elasticsearch/guide/current/index.html

Elasticsearch安装

  环境:Linux(CentOS 7.4)

     jdk(1.8)

  elasticsearch版本:7.6.1

  1、下载,官网下载地址:https://www.elastic.co/cn/downloads/elasticsearch

  2、解压到安装目录,命令:tar -zxvf elasticsearch-7.6.1-linux-x86_64.tar.gz -C /data/soft/

  3、进入解压目录,命令:cd /data/soft/elasticsearch-7.6.1

    config/elasticsearch.yml    ---elasticsearch配置文件

    config/jvm.options        ---java jvm参数配置

    config/log4j2.properties      ---日志相关配置

    修改elasticsearch.yml配置文件,elasticsearch绑定地址0.0.0.0,即可远程访问

1 network.host: 0.0.0.0

    

  4、修改启动参数(可以不修改)

    说明:在Elasticsearch中如果,network.host不是localhost或127.0.0.1的话就会认为是生产环境,会对环境要求比较高,

    测试环境不一定满足

    1)修改jvm启动参数

     命令:vim config/jvm.options

1 -Xms128m
2 -Xmx128m

  5、启动elasticsearch程序

    前台启动命令:./bin/elasticsearch

    后台启动命令:./bin/elasticsearch -d

    关闭命令:kill 进程ID (不推荐kill -9

    查看java进程:jps

    a、错误:java.lang.RuntimeException:can not run elasticsearch as root

    

      解决方案:

        1)添加es用户,命令:useradd es

        2)给es用户授文件夹权限,命令:chown -R es:es /data/soft/elasticsearch-7.6.1

        3)切换es用户,命令:su es

        4)执行启动,命令:./bin/elasticsearch

    b、错误:

      [1]: max file descriptors [65535] for elasticsearch process is too low, increase to at least [65536]

      [2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

      [3]: max number of threads [3895] for user [es] is too low, increase to at least [4096]

    

      解决方案:

        1)最大文件描述符太少了,至少要65536,修改/etc/security/limits.conf文件

          命令:vim /etc/security/limits.conf

          内容修改为:* hard nofile 65536

        2)一个进程可以拥有的VMA(虚拟内存区域)的数量太少了,至少要262144,修改文件  

          命令:vim /etc/sysctl.conf

          增加内容为:vm.max_map_count=262144

        3)最大线程太少了,至少要4096,修改/etc/security/limits.conf文件

          命令:vim /etc/security/limits.conf

          增加内容为:* hard nproc 65536

        4) 是修改配置生效,重启服务器

     c、错误

      

      #配置以下三者,最少其一

      #[discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes]

      解决方案:

      修改es配置文件,命令:vim config/elasticsearch.yml内容如下:

1 node.name: node-1
2 
3 cluster.initial_master_nodes: ["node-1"]              

  6、使用浏览器进行访问,地址:http://ip:9200。默认端口就是9200,可以在配置文件中修改

    

    

  

 

posted on 2018-12-10 01:06  H__D  阅读(3177)  评论(0编辑  收藏  举报