elasticsearch 核心概念
2017-09-29 17:25
501 查看
转自大数据学习平台:大讲台: http://www.dajiangtai.com/course/search.do?search=elastic
一、分片(shards)
1、一个索引库默认有5个分片,如果想更改分片数,必须在创建索引库的时候指定
POST /{indexname} -d {"settings":{"shards":5}}
例如:curl -XPOST http://hadoop01:9200/djtshards -d '{"settings":{"shards":5}}'
通过可视化管理插件head查看:
2、默认一个分片可以存储2,147,483,519条数据。
3、分片可以使得节点的压力均衡
二、副本(replactions)
1、默认一个分片有一个副本,
可以在创建索引库的时候指定副本数量 -d {"settings":{"number_of_replacations":2}}
也可以在索引库已经存在的情况下更新副本数量 PUT /{indexname}/_settings -d {"index":{"number_of_replacations":1}}
2、分片可以提高系统的容错性,主分片和副本一定式分布在不同的节点上的。
三、Recover
1、es在有节点加入或者退出时,会重新分配分片及副本的分布。
四、gateway(数据持久化)
1、hdfs方式
首先要安装插件,在github上查看下es于es-hdfs插件对应的版本
-----------------------------------------------------------------
bin/plugin install elasticsearch/elasticsearch-repository-hdfs/2.2.0
修改配置文件 config/elasticsearch.yml
gateway:
type: hdfs
gateway:
hdfs:
uri: hdfs://cluster1/
五、mapping(索引)
1、mapping即为索引类型的定义,类型的名称,类型有哪些属性(字段)
2、 查看某个索引库的索引信息:
GET /{indexname}/_mapping?pretty
3、创建mapping
PUT /{indexname}/ -d {"mappings":{"user":{"properties":{"name":{"type":"string"}}}}}
4、更新mapping
POST /{indexname}/{typename} -d {"properties":{"name":{"type":"string"}}}
一、分片(shards)
1、一个索引库默认有5个分片,如果想更改分片数,必须在创建索引库的时候指定
POST /{indexname} -d {"settings":{"shards":5}}
例如:curl -XPOST http://hadoop01:9200/djtshards -d '{"settings":{"shards":5}}'
通过可视化管理插件head查看:
2、默认一个分片可以存储2,147,483,519条数据。
3、分片可以使得节点的压力均衡
二、副本(replactions)
1、默认一个分片有一个副本,
可以在创建索引库的时候指定副本数量 -d {"settings":{"number_of_replacations":2}}
也可以在索引库已经存在的情况下更新副本数量 PUT /{indexname}/_settings -d {"index":{"number_of_replacations":1}}
2、分片可以提高系统的容错性,主分片和副本一定式分布在不同的节点上的。
三、Recover
1、es在有节点加入或者退出时,会重新分配分片及副本的分布。
四、gateway(数据持久化)
1、hdfs方式
首先要安装插件,在github上查看下es于es-hdfs插件对应的版本
-----------------------------------------------------------------
| Hadoop Plugin | ElasticSearch | Embedded Hadoop Version | ----------------------------------------------------------------- | master | 0.21 -> master | 0.20.204.0 | ----------------------------------------------------------------- | 1.2.0 | 0.19 -> 0.20 | 0.20.204.0 | ----------------------------------------------------------------- | 1.1.0 | 0.19 -> 0.20 | 0.20.204.0 | ----------------------------------------------------------------- | 1.0.0 | 0.18 | 0.20.204.0 | -----------------------------------------------------------------
bin/plugin install elasticsearch/elasticsearch-repository-hdfs/2.2.0
修改配置文件 config/elasticsearch.yml
gateway:
type: hdfs
gateway:
hdfs:
uri: hdfs://cluster1/
五、mapping(索引)
1、mapping即为索引类型的定义,类型的名称,类型有哪些属性(字段)
2、 查看某个索引库的索引信息:
GET /{indexname}/_mapping?pretty
{ "djt" : { "mappings" : { "user" : { "properties" : { "age" : { "type" : "long" }, "name" : { "type" : "string" } } } } } } |
PUT /{indexname}/ -d {"mappings":{"user":{"properties":{"name":{"type":"string"}}}}}
4、更新mapping
POST /{indexname}/{typename} -d {"properties":{"name":{"type":"string"}}}
相关文章推荐
- elasticsearch核心知识--3. Elasticsearch核心概念:NRT、索引、分片、副本等
- Elasticsearch笔记四之配置参数与核心概念
- Elasticsearch的核心概念cluster/shards/replicas/recovery/gateway/discovery.zen/transport/settings/mapping等
- ElasticSearch核心概念
- Elasticsearch基本概念及核心配置文件详解
- ElasticSearch 6.x 学习笔记:5.核心概念解读
- Elasticsearch之重要核心概念(cluster(集群)、shards(分配)、replicas(索引副本)、recovery(据恢复或叫数据重新分布)、gateway(es索引的持久化存储方式)、discovery.zen(es的自动发现节点机制机制)、Transport(内部节点或集群与客户端的交互方式)、settings(修改索引库默认配置)和mappings)
- 005-Elasticsearch核心概念
- Elasticsearch 核心概念
- ElasticSearch核心概念
- Elasticsearch简单使用系列--详细介绍ES的核心概念
- Elasticsearch配置参数与核心概念
- Elasticsearch简单使用系列--详细介绍ES的核心概念
- (二)Elasticsearch核心概念
- lucene和elasticsearch的前世今生、elasticsearch的核心概念、elasticsearch核心概念 vs. 数据库核心概念(来自学习资料)
- Elasticsearch 核心概念
- ElasticSearch系列04:核心概念
- elasticsearch和lucene的关系以及elasticsearch的核心概念
- ElasticSearch安装和核心概念
- ElasticSearch第2课之核心概念介绍