这里分类和汇总了欣宸的全部原创(含配套源码):https://github.com/zq2599/blog_demos
docker network create elastic
docker run \
--name es01 \
--net elastic \
-p 9200:9200 \
-e ES_JAVA_OPTS="-Xms1024m -Xmx1024m" \
-idt elasticsearch:8.2.2
docker exec -it es01 /bin/bash
bin/elasticsearch-reset-password -u elastic
Password for the [elastic] user successfully reset.
New value: 3_J35UWr2sIUkyxxxxxx
docker run \
--name kibana \
--net elastic \
-p 5601:5601 \
-idt kibana:8.2.2
docker exec -it es01 /usr/share/elasticsearch/bin/elasticsearch-create-enrollment-token -s kibana
docker exec -it kibana bin/kibana-verification-code
docker exec -it es01 /usr/share/elasticsearch/bin/elasticsearch-create-enrollment-token -s node
docker run \
-e ENROLLMENT_TOKEN="xxxxxx" \
-e ES_JAVA_OPTS="-Xms1024m -Xmx1024m" \
--name es02 \
--net elastic \
-idt elasticsearch:8.2.2
docker cp es01:/usr/share/elasticsearch/config/certs/http_ca.crt .
curl --cacert http_ca.crt -u elastic:xxxxxx https://localhost:9200
❯ curl --cacert http_ca.crt -u elastic:xxxxxx https://localhost:9200
{
"name" : "279acdab6c7f",
"cluster_name" : "docker-cluster",
"cluster_uuid" : "whfRDTzCQym_jwx2OrMgKg",
"version" : {
"number" : "8.2.2",
"build_flavor" : "default",
"build_type" : "docker",
"build_hash" : "9876968ef3c745186b94fdabd4483e01499224ef",
"build_date" : "2022-05-25T15:47:06.259735307Z",
"build_snapshot" : false,
"lucene_version" : "9.1.0",
"minimum_wire_compatibility_version" : "7.17.0",
"minimum_index_compatibility_version" : "7.0.0"
},
"tagline" : "You Know, for Search"
}
curl -X PUT "https://localhost:9200/my-book?pretty" \
--cacert http_ca.crt \
-u elastic:xxxxxx \
-H 'Content-Type: application/json' \
-d'
{
"settings": {
"number_of_shards": 1
},
"mappings": {
"properties": {
"line_id": {
"type": "long"
},
"line_number": {
"type": "keyword"
},
"play_name": {
"type": "keyword"
},
"speaker": {
"type": "keyword"
},
"speech_number": {
"type": "long"
},
"text_entry": {
"type": "text"
}
}
}
}
'
{
"acknowledged" : true,
"shards_acknowledged" : true,
"index" : "my-book"
}
❯ curl -X GET \
https://localhost:9200/my-book\?pretty \
--cacert http_ca.crt \
-u elastic:m9ZRFl9wCIiVkLudRopy
{
"my-book" : {
"aliases" : { },
"mappings" : {
"properties" : {
"line_id" : {
"type" : "long"
},
"line_number" : {
"type" : "keyword"
},
"play_name" : {
"type" : "keyword"
},
"speaker" : {
"type" : "keyword"
},
"speech_number" : {
"type" : "long"
},
"text_entry" : {
"type" : "text"
}
}
},
"settings" : {
"index" : {
"routing" : {
"allocation" : {
"include" : {
"_tier_preference" : "data_content"
}
}
},
"number_of_shards" : "1",
"provided_name" : "my-book",
"creation_date" : "1653811101586",
"number_of_replicas" : "1",
"uuid" : "zX8kWS_IQ-ymdI7vYLOjew",
"version" : {
"created" : "8020299"
}
}
}
}
}
curl -H 'Content-Type: application/x-ndjson' \
--cacert http_ca.crt \
-u elastic:m9ZRFl9wCIiVkLudRopy \
-s -XPOST https://localhost:9200/_bulk \
--data-binary @shakespeare_only_one_type.json
版权说明 : 本文为转载文章, 版权归原作者所有 版权申明
原文链接 : https://xinchen.blog.csdn.net/article/details/125196035
内容来源于网络,如有侵权,请联系作者删除!