- 解决jdk问题。Es7版本要jdk的最低版本为11
Es自带了jdk版本,配置使用自己的jdk
修改vi elasticsearch-env 文件
知道jdk文件位置
JAVA_HOME="/usr/soft/elasticsearch/elasticsearch-7.10.0/jdk"
2、禁止root用户启动es
添加用户组和用户
[root@localhost bin]# groupadd esusers
[root@localhost bin]# useradd esuserxqn -g esusers
修改es权限
chown -Rf esuserxqn:esusers ./elasticsearch-7.10.0
3、远程访问
修改config下的vi elasticsearch.yml
network.host: 0.0.0.0
4、max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
修改配置文件:vi /etc/security/limits.conf
esuserxqn soft nofile 65535
esuserxqn hard nofile 65535
esuserxqn soft nproc 4096
esuserxqn hard nproc 4096
5、max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
修改配置文件增加配置:vi /etc/sysctl.conf
vm.max_map_count = 262144
刷新:[root@localhost ~]# sysctl -p
6、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
修改配置vi elasticsearch.yml
增加
discovery.seed_hosts: ["10.122.163.201"]
cluster.initial_master_nodes: ["10.122.163.201"]
7、启动
[root@localhost ~]# curl http://localhost:9200
{
"name" : "localhost.localdomain",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "kffUvrcXSeyVSQW5PFGJaA",
"version" : {
"number" : "7.10.0",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "51e9d6f22758d0374a0f3f5c6e8f3a7997850f96",
"build_date" : "2020-11-09T21:30:33.964949Z",
"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"
}
集群搭建
修改配置:
cluster.name: escluster
node.name: esnode01
network.host: 0.0.0.0
#allow cors
http.cors.enabled: true
http.cors.allow-origin: "*"
discovery.seed_hosts: ["10.122.163.201","10.122.163.202","10.122.163.203"]
cluster.initial_master_nodes: ["esnode01","esnode02","esnode03"]
discovery.zen.ping_timeout: 60s