elasticsearch(ES)

  1. 参考链接

  2. 参考配置

  3. 安装JAVA_JDK

  4. 安装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
    
  5. 修改配置文件

     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
    
  6. 系统配置

     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
    
  7. 启动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
    
  8. 防火墙配置

     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
    
  9. 检查是否成功运行

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

     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
    
@耿志环 2012-∞ 冀ICP备17033181号, powered by Gitbook修订: 2019-01-11 16:52:19

results matching ""

    No results matching ""