Elasticsearch is an open source distributed search and analysis engine, which is widely used to build real-time search, log analysis, data visualization and other applications. This article will detail how to install and configure Elasticsearch 8 in a Windows environment.
Install Elasticsearch
Step 1: Preparations
Before starting the installation, make sure the following requirements are met:
- Make sure your computer has at least 4GB of RAM.
- Make sure your computer has Java Development Kit (JDK) 8 or later installed.
- Make sure you have administrator privileges.
Step 2: Download Elasticsearch
- Open a browser and visit the official website of Elasticsearch (https://www.elastic.co/downloads/elasticsearch).
- On the download page, find the installation package for Windows and click the download link.
Step 3: Install Elasticsearch
Unzip the downloaded installation package to a specified location.
Step 4: Configure Elasticsearch
-
Modify jvm.options under the config directory, add the following content to solve the console garbled problem
-Dfile.encoding=GBK
-
Navigate to the extracted directory of Elasticsearch, open
config
the directory, and editelasticsearch.yml
the file.
Modify xpack.security.http.ssl.enable and xpack.security.transport.ssl.enable to false to
add additionalnode.name: node-1 cluster.initial_master_nodes: ["node-1"]
node.name is the name used to identify an Elasticsearch node. Each node needs a unique name in the cluster to distinguish different nodes.
cluster.initial_master_nodes is the setting used to identify the initial master nodes. In an Elasticsearch cluster, the initial master node is the first master node in the cluster. When starting a brand new Elasticsearch cluster, you need to designate a node as the initial master node. Additional nodes will join and establish communication with the initial master node to form a complete cluster.
-
Save and close the file.
Step 5: Start Elasticsearch
- Open Command Prompt (CMD) or PowerShell.
- Navigate to the directory where Elasticsearch is installed.
- Click bin/elasticsearch.bat to start, and an account with elastic account and random string password will be automatically generated:
- This indicates that Elasticsearch has started successfully.
Step 6: Verify Installation
Open http://localhost:9200 in the browser, and enter the user and password created automatically before:
The following page appears, indicating that the installation is successful:
Seeing this page means that you have successfully installed and configured Elasticsearch 8 in the Windows environment. Now you can start using Elasticsearch to build applications such as real-time search, log analysis, and data visualization.
Install Kibana
Kibana is the front-end display of es data. When analyzing data, you can easily see the data. As a developer, you can easily access es.
Step 1: Preparation
Enter the previous elasticsearch installation directory, enter cmd, open the command line interface, create a user to save the password, the command is as follows: bin\elasticsearch-reset-password -u kibana_system
Step 2: Download
Enter the official website: https://www.elastic.co/cn/downloads/kibana to download and unzip kibana
Step 3: Modify the configuration file
Open kibana.yml in the config folder of kibana-8.8.2, add configuration information, and add it directly to the end of the kibana.yml file
server.port: 5601
server.host: "0.0.0.0"
# 国际化中文
i18n.locale: "zh-CN"
# 配置es集群url
elasticsearch.hosts: ["https://localhost:9200"]
# 创建连接用户的账号和密码
elasticsearch.username: "kibana_system"
elasticsearch.password: "2I=xPXAF9Fng7U-F5QWU"
When finished editing, click Save
Step 4: Start
Double-click kibana.bat in the bin directory to run. The
operation is successful. The browser opens localhost:5601, and the following interface appears to indicate that the operation is successful.
The password is the account password of elasticsearch:
Account: elastic Password: the password saved when starting elasticsearch. Note: This account is not the account password for connecting to the es account:
Step 5: Test Access
Browser access http://localhost:5601
Summarize
Hope this blog
is helpful to you! If you have any questions or need further assistance, please feel free to ask.