Docker/elasticsearch:修订间差异
来自康健生活
| (未显示同一用户的6个中间版本) | |||
| 第10行: | 第10行: | ||
=== 运行 === | === 运行 === | ||
<pre> | |||
#添加单节点发现模式 | |||
discovery.type: single-node</pre> | |||
{{shc|<syntaxhighlight lang="bash"> | {{shc|<syntaxhighlight lang="bash"> | ||
sudo docker run -it --name elasticsearch -e ES_JAVA_OPTS="-Xms1024m -Xmx1024m" -e "discovery.type=single-node" -d -p 9200:9200 -p 9300:9300 -p 5601:5601 elasticsearch:7.6.2</syntaxhighlight>|$|/home/kangkk}} | sudo docker run -it --name elasticsearch -e ES_JAVA_OPTS="-Xms1024m -Xmx1024m" -e "discovery.type=single-node" -d -p 9200:9200 -p 9300:9300 -p 5601:5601 elasticsearch:7.6.2</syntaxhighlight>|$|/home/kangkk}} | ||
| 第43行: | 第47行: | ||
验证,打开网页 http://10.220.188.195:5601/。 | 验证,打开网页 http://10.220.188.195:5601/。 | ||
== 插件 == | |||
=== 分词器 === | |||
{{shc|<syntaxhighlight lang="bash"> | |||
bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.6.2/elasticsearch-analysis-ik-7.6.2.zip</syntaxhighlight>|$|/home/kangkk}} | |||
需要重启服务。 | |||
== 角色管理 == | == 角色管理 == | ||
| 第55行: | 第66行: | ||
{{shc|<syntaxhighlight lang="bash"> | {{shc|<syntaxhighlight lang="bash"> | ||
bin/elasticsearch-setup-passwords interactive</syntaxhighlight>|$|/home/kangkk}} | bin/elasticsearch-setup-passwords interactive</syntaxhighlight>|$|/home/kangkk}} | ||
查看用户信息。 | |||
{{Shc_out|<syntaxhighlight lang="bash"> | |||
curl -XGET -u elastic 'http://localhost:9200/_xpack/security/user'</syntaxhighlight>|<syntaxhighlight lang="bash">{"elastic":{"username":"elastic","roles":["superuser"],"full_name":null,"email":null,"metadata":{"_reserved":true},"enabled":true},"kibana":{"username":"kibana","roles":["kibana_system"],"full_name":null,"email":null,"metadata":{"_reserved":true},"enabled":true},"logstash_system":{"username":"logstash_system","roles":["logstash_system"],"full_name":null,"email":null,"metadata":{"_reserved":true},"enabled":true},"beats_system":{"username":"beats_system","roles":["beats_system"],"full_name":null,"email":null,"metadata":{"_reserved":true},"enabled":true},"apm_system":{"username":"apm_system","roles":["apm_system"],"full_name":null,"email":null,"metadata":{"_reserved":true},"enabled":true},"remote_monitoring_user":{"username":"remote_monitoring_user","roles":["remote_monitoring_collector","remote_monitoring_agent"],"full_name":null,"email":null,"metadata":{"_reserved":true},"enabled":true}}[ | |||
</syntaxhighlight>|$|/home/kangkk}} | |||
修改密码。 | |||
{{shc|<syntaxhighlight lang="bash"> | |||
curl -H "Content-Type:application/json" -XPOST -u elastic 'http://localhost:9200/_xpack/security/user/elastic/_password' -d '{ "password" : "123456" }'</syntaxhighlight>|$|/home/kangkk}} | |||
== kibana == | |||
=== 配置 === | |||
{{Hc|kibana.yml|<syntaxhighlight lang="javascript"> | |||
# | |||
# ** THIS IS AN AUTO-GENERATED FILE ** | |||
# | |||
# Default Kibana configuration for docker target | |||
server.name: kibana | |||
server.host: "0" | |||
elasticsearch.hosts: [ "http://localhost:9200" ] | |||
elasticsearch.username: "elastic" | |||
elasticsearch.password: "1234567890" | |||
xpack.monitoring.ui.container.elasticsearch.enabled: true | |||
# chinese language | |||
i18n.locale: "zh-CN" | |||
</syntaxhighlight>}} | |||
== 参考 == | == 参考 == | ||
* https://www.elastic.co/cn/support/matrix#matrix_compatibility | * https://www.elastic.co/cn/support/matrix#matrix_compatibility | ||