(2)ElasticSearch安装与使用

1 Windows下安装于使用elasticsearch-7.16.2

1.1 下载安装包

# 下载路径 安装版本elasticsearch-7.16.2
 https://www.elastic.co/cn/downloads/elasticsearch

1.2 制作证书

1.1.1 生成证书

# 生成证书 提醒输入路径可执行回车,若提示输入密码'12345678'
.\bin\elasticsearch-certutil ca
# 完成后会生成一个文件:elastic-stack-ca.p12

1.1.2 生成密钥

# 输入密码和上面保持一样
.\bin\elasticsearch-certutil cert --ca elastic-stack-ca.p12

1.1.3 证书添加密码

.\bin\elasticsearch-keystore add xpack.security.transport.ssl.keystore.secure_password

.\bin\elasticsearch-keystore add xpack.security.transport.ssl.truststore.secure_password

1.1.4 将证书迁移到别的目录

将elastic-certificates.p12、elastic-stack-ca.p12迁移到./config/cert目录下

1.1.5 修改配置文件

修改/config/elasticsearch.yml

http.cors.enabled: true
http.cors.allow-origin: "*"
http.cors.allow-headers: Authorization,X-Requested-With,Content-Length,Content-Type
# 配置X-Pack
xpack.security.enabled: true
xpack.security.authc.accept_default_password: true
xpack.security.transport.ssl.enabled: true
xpack.security.transport.ssl.verification_mode: certificate
xpack.security.transport.ssl.keystore.path: E:\App\ELK\elasticsearch-7.16.2\config\cert\elastic-certificates.p12
xpack.security.transport.ssl.truststore.path: E:\App\ELK\elasticsearch-7.16.2\config\cert\elastic-certificates.p12

1.2 启动节点

.\bin\elasticsearch.bat

 1.3 设置密码

.\bin\elasticsearch-setup-passwords  interactive
# 下面会要输入很多密码,都要自己能记住,以后要用
# 需要设置 elastic,apm_system,kibana,kibana_system,logstash_system,beats_system,remote_monitoring_user 这些用户的密码

1.4 登录验证

http://localhost:9200/

(2)ElasticSearch安装与使用

1.5 可能出现异常

a、unable to find valid certification path to requested target

b、Future versions of Elasticsearch will require Java 11

es的安装需要依赖jdk,出现上述问题检查JDK安装是否正确。

2 安装elasticsearch-head

https://github.com/mobz/elasticsearch-head

git clone https://github.com/mobz/elasticsearch-head.git

npm install

npm run start

(2)ElasticSearch安装与使用

1.2.1 访问

http://localhost:9100/?auth_user=elastic&auth_password=123456
上一篇:详解ElasticAPM实现微服务的链路追踪(NET)


下一篇:An internal error occurred during: "Synchronizing"