Download and install
#进入安装目录
cd /opt
#下载安装包,300多M
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.10.1-linux-x86_64.tar.gz
# 解压
tar -zxvf elasticsearch-7.10.1-linux-x86_64.tar.gz
# 进入es根目录
cd elasticsearch-7.10.1
Configuration
- Modify the configuration file
vim config/elasticsearch.yml
#集群名词
cluster.name: lizz-application
# 本节点名词
node.name: node-1
# 服务ip,0表示所有本地ip
network.host: 0.0.0.0
# 服务端口号
http.port: 9200
# es节点列表,集群时配置多个,数组
discovery.seed_hosts: ["127.0.0.1"]
# es启动时,参数选主的node列表,集群时配置多个
cluster.initial_master_nodes: ["node-1"]
start up
- Start es
bin/elasticsearch
#启动失败异常
java.lang.RuntimeException: can not run elasticsearch as root
- Create esuser user, refer to Linux user management to add/delete users
- Switch user successfully
sudo su root
[sudo] esuser 的密码:
- Start abnormal again
bin/elasticsearch
[1]: max number of threads [3882] for user [esuser] is too low, increase to at least [4096]
[2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[3]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured
ES启动异常:max number of threads [3882] for user [xxx] is too low, increase to at least [4096]
ES启动异常:max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
ES启动异常:the default discovery settings are unsuitable for production use; at least...
- Start again, add -d background start to prevent automatic ring comparison when launching
bin/elasticsearch -d
- Check the startup log, the file name is consistent with cluster.name.
tailf logs/lizz-application.log
- Start successfully, check the service
curl http://127.0.0.1:9200/
{
"name" : "node-1",
"cluster_name" : "lizz-application",
"cluster_uuid" : "1ZwW2lw2RUKhqM9F1Bhu-A",
"version" : {
"number" : "7.10.1",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "1c34507e66d7db1211f66f3513706fdf548736aa",
"build_date" : "2020-12-05T01:00:33.671820Z",
"build_snapshot" : false,
"lucene_version" : "8.7.0",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}