ELK之elasticsearch

介绍
es 是elastic系列的核心,这是一个强有力的解决了大量用例的分布式的,RESTful检索的分析引擎,它存储你的数据,使你可以发现你已经预测的和探索你未知的

两大核心功能
1,检索
elasticsearch允许你执行各种类型的检索,结构化的,非结构化的
2,分析
找到最符合你检索的数据,对于大量的数据,elasticsearch能让你快速的分析出你数据的趋势和模式

启动
./bin/elasticsearch -d
加-d后台启动

主要配置
# path.conf 配置文件位置
# path.data 数据存储位置,多个用逗号隔开
# path.work 临时文件位置
# path.logs 日志文件位置
# network.bind_host: 192.168.0.1 只有本机可以访问http接口
# network.publish_host: 192.168.0.1 与其他节点交互ip地址
# network.host: 192.168.0.1    #绑定监听IP
# transport.tcp.port: 9300 节点间交互的tcp端口   
# http.port: 9200 对外服务的http端口 
# http.enabled: false http协议对外提供服务
# index.number_of_shards: 5 索引分片数
# index.number_of_replicas: 1 索引副本数
集群模式下
# node.master: true 是否作为主节点
# node.data: false 是否存储数据
# node.ingest: true 是否作为搜索器

特点
分布式,水平扩容
NRT,近实时
shards, 分片
replicas,副本

分布和复制使得ES是高可用的

安装:
https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.6.3.tar.gz

启动:
./bin/elasticsearch -d
注意不能用root启动,-d表示后台启动,不加退出shell则ES关闭

常用命令:
curl localhost:9200/_cat
curl localhost:9200/_cat/master?v
curl localhost:9200/_cat/indices?v    查看索引
curl 'localhost:9200/_cat/health?v'    查看状态
创建索引
curl -XPUT 'localhost:9200/indexname?pretty'
插入数据
curl -XPUT 'localhost:9200/indexname/external/1?pretty' -d '
  {
           "name": "John Doe"
  }'
获取数据
curl -XGET 'localhost:9200/indexname/external/1?pretty'
查看某个索引数据
curl 'http://localhost:9200/logstash-2018.02.06/_search?pretty'
删除索引
curl -XDELETE 'localhost:9200/indexname?pretty'

es的健康状态:
green    所有主要分片和复制分片都可用
yellow    所有主要分片可用,但不是所有复制分片都可用
red    不是所有的主要分片都可用(需要尽快修复故障分片)

插件:
Head,kopf
 

转载于:https://my.oschina.net/519617/blog/1620775

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值