ES学习总结1 -(基础概念和安装测试)

一 基础概念(官网地址:https://www.elastic.co/guide/en/elasticsearch/reference/6.0/getting-started.html)

  1. near real (准实时搜索):秒级搜索

  2. 集群(cluster):多个node节点组合提供搜索服务

  3. 索引分片(shards):

`It allows you to horizontally split/scale your content volume`:他能水平切分你的内容,进行存储
`It allows you to distribute and parallelize operations across shards (potentially on multiple nodes) thus increasing performance/throughput`:他能让你可以在多个分片之间平行操作,来增加系统的吞吐量
  1. 副本(replicas):分片副本,解决系统索引的高可用问题(和kafka的副本类似)
It provides high availability in case a shard/node fails. For this reason, it is important to note that a replica shard is never allocated on the same node as the original/primary shard that it was copied from.
他提供了节点的高可用性.因此,原有节点和他的副本节点不要分配到相同的服务节点上,防止服务节点挂了,副本和原节点都不能使用
It allows you to scale out your search volume/throughput since searches can be executed on all replicas in parallel.
   他使你可以水平扩展你的服务节点,提升系统的吞吐量
  1. rebalance概念:和kafka中概念类似,当集群中节点增加或减少时,进行重新分配shard在集群中的分布

二 安装

  1. 官网介绍es至少需要jdk8,且需要oracle jdk版本.所以如果安装的是open jdk需要卸载重装,可以参考:https://blog.csdn.net/wen524/article/details/88104688

  2. 第二步就是下载解压就好了:

curl -L -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.0.1.tar.gz

在服务器建目录

mkdir es
useradd es  添加个es用户,因为es不允许用root启动
chown -R es 需要赋权限的目录
su es  用es用户登陆
tar -xvf elasticsearch-6.0.1.tar.gz 解压文件
cd elasticsearch-6.0.1/bin
nohup ./elasticsearch-6.0.1/bin/elasticsearch >nohup.log 2>&1 &   后台启动es
cat  /es/nohup.log 查看启动日志

三 测试:

可以通过_cat命令查看es的状态:
cat是es提供的一套api,在kibana中可以直接GET 等方法使用,但我们用的比较多的还是rest接口形式,比如用curl命令:

[es@localhost bin]$ curl -X PUT "localhost:9200/customer?pretty&pretty"
{
  "acknowledged" : true,
  "shards_acknowledged" : true,
  "index" : "customer"
}
[es@localhost bin]$ curl -X GET "localhost:9200/_cat/indices?v&pretty"
health status index    uuid                   pri rep docs.count docs.deleted store.size pri.store.size
yellow open   customer 1U-ugoCHRbGnKrShYXKyzg   5   1          0            0       466b           466b

常用命令:

通过 curl localhost:9200/_cat  查看

[es@localhost bin]$ curl localhost:9200/_cat
=^.^=
/_cat/allocation
/_cat/shards
/_cat/shards/{index}
/_cat/master
/_cat/nodes
/_cat/tasks
/_cat/indices
/_cat/indices/{index}
/_cat/segments
/_cat/segments/{index}
/_cat/count
/_cat/count/{index}
/_cat/recovery
/_cat/recovery/{index}
/_cat/health
/_cat/pending_tasks
/_cat/aliases
/_cat/aliases/{alias}
/_cat/thread_pool
/_cat/thread_pool/{thread_pools}
/_cat/plugins
/_cat/fielddata
/_cat/fielddata/{fields}
/_cat/nodeattrs
/_cat/repositories
/_cat/snapshots/{repository}
/_cat/templates

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值