一、ES证书申请
Register | Elastichttps://license.elastic.co/registration
-
邮箱下载授权文件是一个json格式 ,修改json文件的属性,basic 基础版本,
platinum 白金版本,时间戳自行修改,年限自定义
-
"type":"basic" 替换为 "type":"
platinum
" -
"expiry_date_in_millis":"1765556390000"
二、ES证书类型对比
三、使用授权,进入到json 所在的文件目录,执行以下命令
curl -XPOST -u elastic "http://127.0.0.1:9200/_xpack/license?acknowledge=true" -H "Content-Type: application/json" -d @xxxx.json
Enter host password for user 'elastic':
{"acknowledged":true,"license_status":"invalid"}
四、 修改用户密码
E:\elasticsearch-7.17.4-windows-x86_64\elasticsearch-7.17.4\bin>elasticsearch-setup-passwords interactive
"warning: usage of JAVA_HOME is deprecated, use ES_JAVA_HOME"
Future versions of Elasticsearch will require Java 11; your Java version from [C:\Program Files\Java\jdk1.8.0_181\jre] does not meet this requirement. Consider switching to a distribution of Elasticsearch with a bundled JDK. If you are already using a distribution with a bundled JDK, ensure the JAVA_HOME environment variable is not set.
Initiating the setup of passwords for reserved users elastic,apm_system,kibana,kibana_system,logstash_system,beats_system,remote_monitoring_user.
You will be prompted to enter passwords as the process progresses.
Please confirm that you would like to continue [y/N]y
Enter password for [elastic]:
Reenter password for [elastic]:
Enter password for [apm_system]:
Reenter password for [apm_system]:
Enter password for [kibana_system]:
Reenter password for [kibana_system]:
Enter password for [logstash_system]:
Reenter password for [logstash_system]:
Enter password for [beats_system]:
Reenter password for [beats_system]:
Enter password for [remote_monitoring_user]:
Reenter password for [remote_monitoring_user]:
Changed password for user [apm_system]
Changed password for user [kibana_system]
Changed password for user [kibana]
Changed password for user [logstash_system]
Changed password for user [beats_system]
Changed password for user [remote_monitoring_user]
Changed password for user [elastic]
五、替换jar包
联系博主,取铂金版jar包
六、修改spingboot的配置文件
spring:
data:
elasticsearch:
repositories:
enabled: true
rest:
uris: localhost:9200
username: elastic
password: xxxx
这种方式在没有开启安全策略以后,会一直报错,401 ES status line [HTTP/1.1 401 Unauthorized]];
需要调整配置文件
spring:
elasticsearch:
password: xxx
username: elastic
uris: [localhost:9200]
curl -XPUT http://elastic:cfl,1997@127.0.0.1:9200/syslog/_settings -d "{\"number_of_replicas\": 0}" -H "Content-Type: application/json"