Install Elasticsearch7.3 on CentOS7
Reference
Official website Product Documentation REST APIsAdd REPO file
Use vi or vim to edit the /etc/yum.repos.d/elasticsearch.repo file, copy the following content to the file, then save and exit.
[elasticsearch-7.x]
name=Elasticsearch repository for 7.x packages
baseurl=https://artifacts.elastic.co/packages/7.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md
Perform installation
yum -y install elasticsearch
Modify the configuration file
Use vi or vim to edit /etc/elasticsearch/elasticsearch.yml, modify the bound IP and port, and then modify the node name. The cache size is recommended to be set to half of the server's physical memory. For details, please refer to the following example.
node.name: node-1
indices.fielddata.cache.size: 2gb
network.host: 0.0.0.0
http.port: 9200
cluster.initial_master_nodes: ["node-1"]
Start the service and verify the service
systemctl enable elasticsearch
systemctl start elasticsearch
curl 127.0.0.1:9200
About connection authorization
After the installation is complete, there is no connection authorization control by default. If we need to provide services in a public network environment, we also need to modify the configuration to enable connection authorization verification. Usually our usage scenarios will not open the Elasticsearch service to the outside, so this article does not describe in detail how to configure connection authorization verification. When our service is deployed in the server's local area network, we do not need to enable authorization verification. If we need to be more secure, we can configure the server's firewall rules to restrict access.