CentOS7.X安装elasticsearch-5.6.2

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
  4. 领支付宝红包支持作者
    扫码领支付宝红包
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值