修改E:\3HJ\elasticsearch-7.17.14\config\config\elasticsearch.yml配置文件
es如果需要 开启ip访问
network.host: 0.0.0.0
如果你只想监听特定的IP地址,可以指定那个IP,例如:
network.host: 192.168.1.100
network.host: 0.0.0.0 #开启ip连接
cluster.initial_master_nodes: ["node-1", "node-2"] #开启ip连接 必须指定一个节点名称
http.port: 9200
http.max_content_length: 1024mb
xpack.ml.enabled: false #关闭机器学习
http.cors.enabled: true
http.cors.allow-origin: "*"
# elasticsearch-head配置需要添加此配置
http.cors.allow-headers: Authorization,X-Requested-With,Content-Length,Content-Type
xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true
管理员cmd 在bin目录下运行cmd,修改密码:
elasticsearch-setup-passwords interactive
如果提示: future versions of Elasticsearch will require Java 11解决方法
修改E:\3HJ\elasticsearch-7.17.14\bin\elasticsearch-env.bat
if defined JAVA_HOME (
set JAVA="E:\3HJ\elasticsearch-7.17.14\jdk\bin\java.exe"
) else (
set JAVA="E:\3HJ\elasticsearch-7.17.14\jdk\bin\java.exe"
set JAVA_HOME="E:\3HJ\elasticsearch-7.17.14\jdk"
)
重新启动后验证
http://localhost:9200/
elasticsearch-head连接时
http://127.0.0.1:9100/?auth_user=elastic&auth_password=密码
kibana连接时
打开 kibana下的config\kibana.yml
elasticsearch.username: "elastic"
elasticsearch.password: "elastic"