原文:https://www.elastic.co/guide/en/x-pack/current/installing-license.html
您可以在运行时更新许可证,而无需关闭您的节点。许可证更新立即生效。该许可证作为您使用 API 安装的JSON文件提供license
。
启用安全性时,需要集群管理员权限才能安装许可证。在内置的elastic
用户具有所需的权限。
更新您的许可证:
-
向
license
API 发送请求并指定包含新许可证的文件:curl - XPUT - u elastic'http :// <host>:<port> / _xpack / license' - H “Content-Type:application / json” - d @license.json
或在Windows机器上:
gc .\license.json | Invoke-WebRequest -uri http://<host>:<port>/_xpack/license -Credential elastic -Method Put
哪里:
-
elastic
是内置超级用户。默认密码为changeme
。如果还没有,请更改默认密码。具有集群管理员权限的任何用户都可以安装许可证。 -
<host>
是Elasticsearch节点的主机名(localhost
如果在本地执行) -
<port>
是http端口(默认为9200
) -
license.json
是许可证JSON文件
-
-
如果您正在安装的许可证不支持您以前的许可证提供的所有功能,您将在响应中收到通知。要完成许可证安装,则必须重新提交许可证更新请求,并设置
acknowledge
参数true
,以表明你是知道的变化。curl - XPUT - u elastic'http :// <host>:<port> / _xpack / license?acknowledge = true' - H “Content-Type:application / json” - d @license.json
-
windows下curl安装方法:在官网处下载工具包:http://curl.haxx.se/download.html 配置环境变量。
-
执行curl期间报错:curl: (1) Protocol 'http not supported or disabled in libcurl
-
解决方法是,把命令上的单引号换成双引号。
curl -XPUT 'http://localhost:9200/api/twittervnext/tweet'
Woops, first try and already an error:
curl: (1) Protocol 'http not supported or disabled in libcurl
The reason for this error is kind of stupid, Windows doesn’t like it when you are using single quotes for commands. So the correct command is:
curl –XPUT "http://localhost:9200/api/twittervnext/tweet"