https://esbook.kimjmin.net/03-cluster/3.2-index-and-shards
Document : 단일 데이터 단위
Index : document의 집합
shard는 저장될 때, 하나의 복사본을 클러스터안의 다른 노드에 저장한다
- (Primary shard, Replica)(노드가 하나의 경우는 복사본 생성 x)
노드가 유실될 경우
프라이머리 샤드가 유실될 경우 복사본을 프라이머리로 승격 후 복사본 생성
$ curl -XPUT "http://localhost:9200/books" -H 'Content-Type: application/json' -d'
{
"settings": {
"number_of_shards": 5,
"number_of_replicas": 1
}
}'
시도1
curl -XPUT -k "https://localhost:9200/books" -H 'Content-Type: application/json' -d'
{
"settings": {
"number_of_shards": 5,
"number_of_replicas": 1
}
}'
시도2
$ bin/elasticsearch-setup-passwords interactive
$ curl -XPUT -k -u elastic:123456 "https://localhost:9200/books" -H 'Content-Type: application/json' -d'
{
"settings": {
"number_of_shards": 5,
"number_of_replicas": 1
}
}'
예시)