zoukankan      html  css  js  c++  java
  • 第四篇:Elaticsearch 安装配置

    Elasticsearch 是一个分布式搜索引擎,相似产品还有solr-cloud 。Elasticsearch 相对于solr 而言,随着容量的变化,效率会比solr高,特点就是速度快。ES使用者众多,如:StackOverflow、github、维基百科等。

    Elasticsearch 至少需要在java1.8 平台,官方建议使用 oracle jdk 1.8.0_131版本。

    一、下载安装elasticsearch:

    wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.6.1.tar.gz -O /opt/elasticsearch-5.6.1.tar.gz 
    tar xf /opt/elasticsearch-5.6.1.tar.gz -C /usr/local
    vim /usr/local/elasticsearch-5.6.1/config/elasticsearch.yml #编辑elastic配置文件修改成如下内容
    cluster.name:    logging-cpy                    #集群名称
    node.name: cpy04.dev.xjh.com            #es节点ID
    path.data: /usr/local/elasticsearch-5.6.1/data    #es数据存放路径
    path.logs: /usr/local/elasticsearch-5.6.1/logs    #es 日志存放路径
    bootstrap.memory_lock: true                        #禁用内存交换功能,防止性能瓶颈
    network.host: 192.168.12.164            #集群通信节点地址,默认使用回环地址
    http.port: 9200                   #es 端口
    discovery.zen.ping.unicast.hosts: ["192.168.12.164"]    #将同一集群节点全部添加到列表中,会定期扫描急群众服务器的9300和9405端口,做健康检查
    discovery.zen.minimum_master_nodes: 1                #防止脑裂,计算公式为"主节点个数/2 + 1" ,例如单点就是1 ,比如3个就是(3/2+1)=2
    

      

    二、 配置系统内存锁定(由于es 配置文件中配置了内存锁定,如果系统不锁定会报:memory locking requested for elasticsearch process but memory is not locked)

    vim /etc/security/limits.conf #添加如下内容
    * soft memlock unlimited
    * hard memlock unlimited
    

    三、配置可创建最大文件(解决:max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536])

    vim /etc/security/limits.conf
    * soft nofile 65536
    * hard nofile 65536
    

    四、配置可创建线程数(解决:max number of threads [1024] for user [elastic] is too low, increase to at least [2048])

    vim /etc/security/limits.d/90-nproc.conf 
    #*          soft    nproc     1024  #注释这行改为2048
    *          soft    nproc     2048
    root       soft    nproc     unlimited
    

    五、修改最大虚拟内存大小(解决:max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144])

    vim /etc/sysctl.conf #添加如下内容
    # max virtual memory size
    vm.max_map_count=633360
    保存退出后使用:sysctl -p 命令生效sysctl.conf 配置
    

    六、解决centos6.x 不支持SecComp,ES5.2 后的版本默认使用 bootstrap.system_call_filter 检测,如果不通过则终止ES 进程,所以将该项改为false

    vim /usr/local/elasticsearch-5.6.1/config/elasticsearch.yml 
    bootstrap.system_call_filter: false
    

    七、 添加启动elasticsearch 用户(es 默认不能使用root 用户启动)

    groupadd elastic
    useradd elastic -g elastic
    

    八、启动elasticsearch

    su - elastic
    /usr/local/elasticsearch-5.6.1/bin/elasticsearch -d
    

      

      

      

      

      

      

      

  • 相关阅读:
    转载--Linux命令top动态观察程序的变化
    转载--C语言运算符优先级和口诀
    区别typedef和#define
    spring+springmvc+mybatis xml配置文件
    解决SmartGit序列号问题
    通过SmartGit把java maven项目传到码云
    301跳转
    mybatis之联表查询
    MySQL不常用、易忽略的小知识
    JavaScript精进篇
  • 原文地址:https://www.cnblogs.com/cpy-devops/p/9287553.html
Copyright © 2011-2022 走看看