--查询license:
#curl -u elastic:elastic -XGET 'http://localhost:9200/_xpack/license'
{
"license" : {
"status" : "active",
"uid" : "2dc3cf09-d3cd-4a34-8380-37be960fc587",
"type" : "basic",
"issue_date" : "2019-05-22T09:43:40.157Z",
"issue_date_in_millis" : 1558518220157,
"max_nodes" : 1000,
"issued_to" : "ES_cluster",
"issuer" : "elasticsearch",
"start_date_in_millis" : -1
}
}
1.获取别人破解的文件jar包
2.自己到elastic官方申请license,需要填写真实的邮箱供接受下载:
https://license.elastic.co/registration
邮箱接受文件之后下载:
选在下载6版本的:
申请的license需要修改内容:(使用文本编辑器修改)
将 "type":"basic" 替换为 "type":"platinum" # 基础班变更为铂金版
将 "expiry_date_in_millis":1561420799999替换为 "expiry_date_in_millis":3107746200000# 1年变为50年
修改之后:
{"license":{"uid":"2edd3bba-f0b1-4c46-b024-86e5d6dc2186","type":"platinum","issue_date_in_millis":1559174400000,"expiry_date_in_millis":3107746200000,
...
导入license:
curl -XPUT 'http://197.255.20.216:9200/_xpack/license' -H "Content-Type: application/json" -d @wen-new-2edd3bba-f0b1-4c46-b024-86e5d6dc2186-v5.json
elasticsearch设置:
# vim /etc/elasticsearch/elasticsearch.yml
...
xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true
#x-pack设置完毕后,elastic head无法登陆的问题 需要设置参数:
http.cors.enabled: true
http.cors.allow-origin: '*'
http.cors.allow-headers: Authorization,X-Requested-With,Content-Length,Content-Type
此时直接访问会报错:
# curl -XGET 'http://197.255.20.216:9200/_xpack/license?pretty'
{
"error" : {
"root_cause" : [
{
"type" : "security_exception",
"reason" : "missing authentication token for REST request [/_xpack/license?pretty]",
"header" : {
"WWW-Authenticate" : "Basic realm=\"security\" charset=\"UTF-8\""
}
}
],
"type" : "security_exception",
"reason" : "missing authentication token for REST request [/_xpack/license?pretty]",
"header" : {
"WWW-Authenticate" : "Basic realm=\"security\" charset=\"UTF-8\""
}
},
"status" : 401
}
通过用户密码访问:
# curl -XGET -u elastic:elastic 'http://197.255.20.216:9200/_xpack/license?pretty'
{
"license" : {
"status" : "active",
"uid" : "2edd3bba-f0b1-4c46-b024-86e5d6dc2186",
"type" : "platinum",
"issue_date" : "2019-05-30T00:00:00.000Z",
"issue_date_in_millis" : 1559174400000,
"expiry_date" : "2068-06-24T06:50:00.000Z",
"expiry_date_in_millis" : 3107746200000,
"max_nodes" : 100,
"issued_to" : "wen new (YJP)",
"issuer" : "Web Form",
"start_date_in_millis" : 1559174400000
}
}
#cd /usr/share/elasticsearch/bin
# ./elasticsearch-setup-passwords --help
Sets the passwords for reserved users
Commands
--------
auto - Uses randomly generated passwords
interactive - Uses passwords entered by a user
Non-option arguments:
command
Option Description
------ -----------
-h, --help show help
-s, --silent show minimal output
-v, --verbose show verbose output
# ./elasticsearch-setup-passwords interactive
Initiating the setup of passwords for reserved users elastic,apm_system,kibana,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]:
Reenter password for [kibana]:
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]
Changed password for user [logstash_system]
Changed password for user [beats_system]
Changed password for user [remote_monitoring_user]
Changed password for user [elastic]
所有默认的密码均为elastic
重新登录查询license:
--重新查询license:
# curl -u elastic:elastic -XGET 'http://localhost:9200/_xpack/license'
{
"license" : {
"status" : "active",
"uid" : "2edd3bba-f0b1-4c46-b024-86e5d6dc2186",
"type" : "platinum",
"issue_date" : "2019-05-30T00:00:00.000Z",
"issue_date_in_millis" : 1559174400000,
"expiry_date" : "2068-06-24T06:50:00.000Z",
"expiry_date_in_millis" : 3107746200000,
"max_nodes" : 100,
"issued_to" : "wen new (YJP)",
"issuer" : "Web Form",
"start_date_in_millis" : 1559174400000
}
}
--版本查询:
# curl -XGET -u elastic:elastic 'http://197.255.20.216:9200/'
{
"name" : "RCucJ4b",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "QdSL76k5T3exOKEOjjjmFA",
"version" : {
"number" : "6.5.4",
"build_flavor" : "default",
"build_type" : "rpm",
"build_hash" : "d2ef93d",
"build_date" : "2018-12-17T21:17:40.758843Z",
"build_snapshot" : false,
"lucene_version" : "7.5.0",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
},
"tagline" : "You Know, for Search"
}
#curl -u elastic:elastic -H "Content-Type: application/json" -XPOST "localhost:9200/bank/_doc/_bulk?pretty&refresh" --data-binary "@accounts.json"
#curl -u elastic:elastic "localhost:9200/_cat/indices?v"
破解之后可以使用客户端连接Elasticsearch,可以将Elasticsearch作为数据存储服务器。
https://www.elastic.co/cn/subscriptions
参考:
https://www.cnblogs.com/qilvfei/p/9956932.html
https://blog.csdn.net/qq_29202513/article/details/82747798