zoukankan      html  css  js  c++  java
  • linux下ElasticSearch安装及集群搭建

    一、准备工作

    1、安装 JDK

    2、服务器 2 台如下:

    IP地址 端口
    192.168.1.1 9201
    192.168.1.2 9201

    二、安装前配置

    1、使用 root 用户先进行以下内容的配置 

    vi /etc/security/limits.conf 
    #添加如下内容:
    * soft nofile 65536
    * hard nofile 131072
    * soft nproc 2048 * hard nproc 4096
    
    vi /etc/security/limits.d/90-nproc.conf 
    #修改文件内容为
    soft nproc 2048
    
    vi /etc/sysctl.conf 
    #添加下面配置: 
    vm.max_map_count=655360 sysctl -p
    ulimit -n 65536
    
    #保存后执行 
    sysctl -p

    2、elasticsearch 限制 root 用户启动,所以需要先创建用户 

    #添加用户组添加用户
    groupadd es
    useradd es -g es 

    3、创建 es 目录并赋权 

    #创建 es 安装目录
    mkdir /usr/local/es
    
    #创建 es 数据目录
    mkdir /data/es
    
    #更改目录 Owner
    chown -R es:es /usr/local/es chown -R es:es /data/es

    三、安装步骤

    1、下载 es 安装包并解压 

    tar -zxvf elasticsearch-6.4.2.tar.gz

    2、移动 elasticsaerch 到/usr/local/es 目录下 

    mv elasticsearch-6.4.2 /usr/local/es/
    chown -R es:es /usr/local/es/elasticsearch-6.4.2/

    3、切换至用户 es

    su es

      

    4、创建 es 数据和日志存储目录 

    mkdir /data/es/data
    mkdir /data/es/logs

      

    5、修改 config 包下配置文件 elasticsearch.yml 如下: 

    cluster.name: elasticsearch-prod node.name: node-1
    path.data: /data/es/data path.logs: /data/es/logs network.host: 0.0.0.0
    http.port: 9201
    http.enabled: true
    #服务发现端口
    transport.tcp.port: 9301
    #集群发现 IP 集合,有几个节点就写几个 IP
    discovery.zen.ping.unicast.hosts: ["192.168.1.1:9301", "192.168.1.2:9301"]
    http.cors.enabled: true
    http.cors.allow-origin: "*"
    http.cors.allow-headers: Authorization,X-Requested-With,Content-Length,Content-Type 
    
    #以下配置用于开启密码验证,不设密码请忽略 
    #xpack.security.enabled: true 
    #xpack.security.transport.ssl.enabled: true

      

    6、启动 elasticsearch

    注:elasticsearch 限制 root 用户不能启动,请使用用户 es 启动 

    su es
    cd /usr/local/es/elasticsearch-6.4.2/bin 
    
    #前台启动方式
    ./elasticsearch
    
    #后台启动方式
    ./elasticsearch -d

    四、集群部署 

      参照以上步骤再操作一遍即可,请注意所有节点的集群名称(cluster.name)保持一致。 



      世间万物
          花是花,草是草,你是你,我是我
              只要拥有这样的自由,满心才是欢喜



  • 相关阅读:
    [HDU 1254] 推箱子
    [POJ 1321] 棋盘问题
    Ubuntu fcitx CPU占用率很高解决方法
    超简洁git入门
    [LightOJ 1370] Bi-shoe and Phi-shoe(欧拉函数快速筛法)
    [LightOJ 1341] Aladdin and the Flying Carpet (算数基本定理(唯一分解定理))
    seekg()/seekp()与tellg()/tellp()的用法详解
    绝对路径以及相对路径中的斜杠和反斜杠
    TCP滑动窗口
    TCP的三次握手和四次挥手
  • 原文地址:https://www.cnblogs.com/merely/p/12594990.html
Copyright © 2011-2022 走看看