您现在的位置是:首页 > 文章详情

elasticsearch基本安装文档

日期:2018-08-23点击:555

elasticsearch(ES)

*参考链接

*参考配置

  1. 安装JAVA_JDK
  2. 安装elasticsearch

    cd /root
    wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.6.2.tar.gz
    tar -zxvf elasticsearch-5.6.2.tar.gz
    mv /root/elasticsearch-5.6.2 /usr/local/elasticsearch
  3. 修改配置文件

    vim /usr/local/elasticsearch/config/elasticsearch.yml
    
    # node.name
    node.name: node-1
    # node.attr
    node.attr.rack: r1
    # 数据路径
    path.data: /usr/local/elasticsearch/data
    # 日志路径
    path.logs: /usr/local/elasticsearch/logs
    # IP绑定
    network.host: [局域网ip]
    # 设置端口
    http.port: 9200
    
    ESC
    :wq
  4. 系统配置

    su root
    # 编辑sysctl.conf
    vim /etc/sysctl.conf
    # 设置最大内存占用1G(1024x1024)
    vm.max_map_count=1048576
    
    ESC
    :wq
    
    # 重载sysctl.conf配置
    sysctl -p
    
    # 编辑limits.conf
    vim /etc/security/limits.conf
    
    elasticsearch hard nofile 65536
    elasticsearch soft nofile 65536
    
    ESC
    :wq
  5. 启动elasticsearch

    useradd elasticsearch
    chown -R elasticsearch:elasticsearch /usr/local/elasticsearch
    su elasticsearch
    /usr/local/elasticsearch/bin/elasticsearch -d \
    -p /usr/local/elasticsearch/logs/elasticsearch.pid
  6. 防火墙配置

    su root
    systemctl enable firewalld
    systemctl start firewalld
    firewall-cmd --zone=public --add-port=9200/tcp --permanent
    firewall-cmd --zone=public --add-port=9300/tcp --permanent
    firewall-cmd --reload
  7. 检查是否成功运行

    curl http://[服务器局域网]:9200
  8. 开机启动

    su root
    vim /etc/rc.local
    
    su elasticsearch -c "/usr/local/elasticsearch/bin/elasticsearch -d -p /usr/local/elasticsearch/logs/elasticsearch.pid"
    
    ESC
    :wq

CURL管理所有索引

  1. 创建一个索引

    curl -XPUT 'http://[ip]:[port]/[index_name]?pretty'
  2. 查看所有索引

    curl 'http://[ip]:[port]/_cat/indices'
  3. 删除指定索引

    curl -XDELETE 'http://[ip]:[port]/[index_name]?pretty'

Console管理所有索引

  1. 创建一个索引

    PUT /[index_name]
  2. 删除多个索引

    DELETE /index_*
    DELETE /index_1,index_2
  3. 删除所有索引

    DELETE /*
    DELETE /_all
原文链接:https://yq.aliyun.com/articles/628972
关注公众号

低调大师中文资讯倾力打造互联网数据资讯、行业资源、电子商务、移动互联网、网络营销平台。

持续更新报道IT业界、互联网、市场资讯、驱动更新,是最及时权威的产业资讯及硬件资讯报道平台。

转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源。

文章评论

共有0条评论来说两句吧...

文章二维码

扫描即可查看该文章

点击排行

推荐阅读

最新文章