ELK 학습 궤적(3) - Elasticsearch의 간단한 사용(위)
Elasticsearch의 간단한 명령
curl -GET 127.0.0.1:9200/_cat/health?v # v ,
epoch timestamp cluster status node.total node.data shards pri relo init unassign pending_tasks max_task_wait_time active_shards_percent
1555329542 11:59:02 elasticsearch yellow 1 1 10 10 0 0 1 0 - 90.9%
curl -GET 127.0.0.1:9200/_cluster/health?pretty # pretty json ,
{
"cluster_name" : "elasticsearch",
"status" : "yellow",
"timed_out" : false,
"number_of_nodes" : 1,
"number_of_data_nodes" : 1,
"active_primary_shards" : 10,
"active_shards" : 10,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 1,
"delayed_unassigned_shards" : 0,
"number_of_pending_tasks" : 0,
"number_of_in_flight_fetch" : 0,
"task_max_waiting_in_queue_millis" : 0,
"active_shards_percent_as_number" : 90.9090909090909
}
curl -GET 127.0.0.1:9200/_cat/nodes?v
ip heap.percent ram.percent cpu load_1m load_5m load_15m node.role master name
172.19.244.188 45 96 5 0.25 0.11 0.07 mdi * izuf6bcs2gy0q80ienjn0yz
curl -GET 127.0.0.1:9200/_cat/indices?v
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
green open .kibana_task_manager d52WbBQNRmK9_NB-ScHDYQ 1 0 2 0 46.3kb 46.3kb
green open .monitoring-es-7-2019.04.14 NY_SOwsATN-O-0wQECbB1w 1 0 100855 71917 47.1mb 47.1mb
green open .monitoring-kibana-7-2019.04.14 TrQK23IqQpSYKC_Sz9AAgw 1 0 8638 0 2.6mb 2.6mb
green open kibana_sample_data_flights 9fQjpTomTniy5QPeembbWg 1 0 13059 0 6.5mb 6.5mb
green open .monitoring-kibana-7-2019.04.13 0ZCf0_5sSpmbB1VdqtOaAA 1 0 3370 0 1mb 1mb
yellow open test_1 KsgH0IWVTdO_YIYVTjlVOQ 1 1 6 0 28.1kb 28.1kb
green open .monitoring-es-7-2019.04.15 AN3Gu6DPTKK4fJ-eh0X0lw 1 0 61779 48444 30.6mb 30.6mb
green open .monitoring-kibana-7-2019.04.15 2ec38z9ORxmgB3cNh67rLg 1 0 4397 0 1.5mb 1.5mb
green open .monitoring-es-7-2019.04.13 dGLxQnlVRjapWHqP2esY9g 1 0 30338 16840 14.1mb 14.1mb
green open .kibana_1 3A228HM4R96hTgv4rZI9bg 1 0 72 5 150.7kb 150.7kb
curl -XPUT 127.0.0.1:9200/test_2?pretty
{
"acknowledged" : true,
"shards_acknowledged" : true,
"index" : "test_2"
}
curl -XPUT 127.0.0.1:9200/test_2/sample/1?pretty -H 'Content-Type:application/json' -d '{"name":"xiaoming","age":23}'
{
"_index" : "test_2",
"_type" : "sample",
"_id" : "1",
"_version" : 1,
"result" : "created",
"_shards" : {
"total" : 2,
"successful" : 1,
"failed" : 0
},
"_seq_no" : 0,
"_primary_term" : 1
}
curl -XGET 127.0.0.1:9200/test_2/sample/_search?pretty
{
"took" : 0,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 1,
"relation" : "eq"
},
"max_score" : 1.0,
"hits" : [
{
"_index" : "test_2",
"_type" : "sample",
"_id" : "1",
"_score" : 1.0,
"_source" : {
"name" : "xiaoming",
"age" : 23
}
}
]
}
}
curl -XGET 127.0.0.1:9200/test_2/sample/_search?pretty&q=name:xiaoming
{
"took" : 0,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 1,
"relation" : "eq"
},
"max_score" : 1.0,
"hits" : [
{
"_index" : "test_2",
"_type" : "sample",
"_id" : "1",
"_score" : 1.0,
"_source" : {
"name" : "xiaoming",
"age" : 23
}
}
]
}
}
curl -XPOST 127.0.0.1:9200/test_2/sample/1?pretty -H 'Content-Type:application/json' -d '{"name":"xiaohuang","sex":" ","age":24}
{
"_index" : "test_2",
"_type" : "sample",
"_id" : "1",
"_version" : 7,
"result" : "updated",
"_shards" : {
"total" : 2,
"successful" : 1,
"failed" : 0
},
"_seq_no" : 17,
"_primary_term" : 2
}
curl 127.0.0.1:9200/test_2/_search?pretty
{
"took" : 0,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 1,
"relation" : "eq"
},
"max_score" : 1.0,
"hits" : [
{
"_index" : "test_2",
"_type" : "sample",
"_id" : "1",
"_score" : 1.0,
"_source" : {
"name" : "xiaohuang",
"sex" : " ",
"age" : 24
}
}
]
}
}
curl -XPOST 127.0.0.1:9200/test_2/sample/1/_update?pretty -H 'Content-Type:application/json' -d '{"doc":{"name":"xiaohong"}}'
{
"_index" : "test_2",
"_type" : "sample",
"_id" : "1",
"_version" : 8,
"result" : "updated",
"_shards" : {
"total" : 2,
"successful" : 1,
"failed" : 0
},
"_seq_no" : 18,
"_primary_term" : 2
}
curl 127.0.0.1:9200/test_2/_search?pretty
{
"took" : 0,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 1,
"relation" : "eq"
},
"max_score" : 1.0,
"hits" : [
{
"_index" : "test_2",
"_type" : "sample",
"_id" : "1",
"_score" : 1.0,
"_source" : {
"name" : "xiaohong",
"sex" : " ",
"age" : 24
}
}
]
}
}
curl -XPOST 127.0.0.1:9200/test_2/sample/_bulk?pretty -H 'Content-Type:application/json' -d '
{"index":{"_id":"2"}}
{"name":"xiaohei","age":22}
{"index":{"_id":"3"}}
{"name":"xiaohuang","age":23}
{"update":{"_id":"1"}}
{"doc":{"name":"xiaoming"}}
> '
{
"took" : 29,
"errors" : false,
"items" : [
{
"index" : {
"_index" : "test_2",
"_type" : "sample",
"_id" : "2",
"_version" : 1,
"result" : "created",
"_shards" : {
"total" : 2,
"successful" : 1,
"failed" : 0
},
"_seq_no" : 23,
"_primary_term" : 2,
"status" : 201
}
},
{
"index" : {
"_index" : "test_2",
"_type" : "sample",
"_id" : "3",
"_version" : 1,
"result" : "created",
"_shards" : {
"total" : 2,
"successful" : 1,
"failed" : 0
},
"_seq_no" : 24,
"_primary_term" : 2,
"status" : 201
}
},
{
"update" : {
"_index" : "test_2",
"_type" : "sample",
"_id" : "1",
"_version" : 9,
"result" : "updated",
"_shards" : {
"total" : 2,
"successful" : 1,
"failed" : 0
},
"_seq_no" : 25,
"_primary_term" : 2,
"status" : 200
}
}
]
}
curl 127.0.0.1:9200/test_2/_search?pretty
{
"took" : 2,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 3,
"relation" : "eq"
},
"max_score" : 1.0,
"hits" : [
{
"_index" : "test_2",
"_type" : "sample",
"_id" : "2",
"_score" : 1.0,
"_source" : {
"name" : "xiaohei",
"age" : 22
}
},
{
"_index" : "test_2",
"_type" : "sample",
"_id" : "3",
"_score" : 1.0,
"_source" : {
"name" : "xiaohuang",
"age" : 23
}
},
{
"_index" : "test_2",
"_type" : "sample",
"_id" : "1",
"_score" : 1.0,
"_source" : {
"name" : "xiaoming",
"sex" : " ",
"age" : 24
}
}
]
}
}
curl -XDELETE 127.0.0.1:9200/test_2/sample/3?pretty
{
"_index" : "test_2",
"_type" : "sample",
"_id" : "3",
"_version" : 3,
"result" : "deleted",
"_shards" : {
"total" : 2,
"successful" : 1,
"failed" : 0
},
"_seq_no" : 32,
"_primary_term" : 2
}
curl 127.0.0.1:9200/test_2/_search?pretty
{
"took" : 0,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 2,
"relation" : "eq"
},
"max_score" : 1.0,
"hits" : [
{
"_index" : "test_2",
"_type" : "sample",
"_id" : "2",
"_score" : 1.0,
"_source" : {
"name" : "xiaohei",
"age" : 22
}
},
{
"_index" : "test_2",
"_type" : "sample",
"_id" : "1",
"_score" : 1.0,
"_source" : {
"name" : "xiaoming",
"sex" : " ",
"age" : 24
}
}
]
}
}
먼저 이런 간단한 문장을 기록하고 나중에 천천히 갱신할 것이다.함께 노력하다.
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
다양한 언어의 JSONJSON은 Javascript 표기법을 사용하여 데이터 구조를 레이아웃하는 데이터 형식입니다. 그러나 Javascript가 코드에서 이러한 구조를 나타낼 수 있는 유일한 언어는 아닙니다. 저는 일반적으로 '객체'{}...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.