Article Directory
Three steps (linux system can)
- Install the Java environment
- Install and configure elasticsearch
- Start elasticsearch
1. Installation JDK1.8 +
Install version 1.8 or above jdk
2. Install and configure elasticsearch
Download the compressed package (version 7.3.2 is used in the article)
$ wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.3.2-linux-x86_64.tar.gz
$ tar -zxvf elasticsearch-7.3.2-linux-x86_64.tar.gz
Or use the new general user
To run as a normal user can
useradd es
passwd es
chown -R es elasticsearch-7.3.2
Configuration
Opening step - configured in the initialization parameters in the configuration file elasticsearch.yml
$ vim /config/elasticsearch.yml
Add the following configuration file
#配置节点名
node.name: node-1
#配置远程访问
network.host: 0.0.0.0
#配置端口
http.port: 9200
#配置跨域访问
http.cors.enabled: true
http.cors.allow-origin: "*"
#配置集群主节点
cluster.initial_master_nodes: ["node-1"]
#关闭机器学习
xpack.ml.enabled: false
Configuring resource usage limits
# Increase the limit of available resources (after re-logged-on user to take effect)
vim /etc/security/limits.conf
Add the following configuration file in the final table
* soft nofile 65536
* hard nofile 65536
* soft nproc 4096
* hard nproc 4096
Increase the available resource limits
$ vim /etc/sysctl.conf
In the file add the following
vm.max_map_count=262144
View Configuration
$ sysctl -p
3. Start elasticsearch
Start elasticsearch (if required after running daemon mode, add the parameter -d)
$ ./bin/elasticsearch
To interact with JSON format data RESTful API, based on the HTTP protocol through the communication port 9200 and Elasticsearch.
Such as access http: // ipaddress: 9200 /
get less returns
{
"name" : "master1",
"cluster_name" : "cluster1",
"cluster_uuid" : "Fo9Qwp_FS8i-8lbZu0A6tA",
"version" : {
"number" : "7.3.2",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "1c1faf1",
"build_date" : "2019-09-06T14:40:30.409026Z",
"build_snapshot" : false,
"lucene_version" : "8.1.0",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}