ElasticSearch学习

94 阅读1分钟

安装与启动

  1. 下载地址:Past Releases of Elastic Stack Software | Elastic

  2. 解压后的data目录和logs目录分别存放数据(包含节点、分片、索引、文档)和日志,生产环境中要求必须修改。

  3. 无法使用root用户直接运行ES,需要先创建用户

    adduser es
    chown -R es ES安装目录
    chmomd -770 ES安装目录
    
  4. 修改配置文件./config/elasticsearch.yml,不然别的机器无法访问

    network.host: 本机ip/0.0.0.0 (这个应该对外开放的某个集群的ip,0.0.0.0表示集群中任意一个)
    cluster.initial_master_nodes: ["本机ip"]
    
  5. 启动:./bin/elasticsearch

  6. 通过浏览器访问ip:9200端口,

  7. 启动可能出现的错误

    • max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]

      解决方案:编辑文件 /etc/security/limits.conf,下面配置中es是用户

      es soft nofile 65536
      es hard nofile 65536