ES安装、注意点(Elasticsearch 7.3.2)
时间:2019年10月22日
系统:CentOS 7.2
JDK安装
1.8
下载安装包
网页地址:https://www.elastic.co/cn/downloads/elasticsearch
下载地址:https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.3.2-linux-x86_64.tar.gz
cd /usr/local/es
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
TIPS:
- 官方地址下载比较慢
使用elastic用户管理
#创建用户
useradd elsearch
#目录授权
chown -R elsearch:elsearch /usr/local/es
#切换用户
su elsearch
配置
cd /usr/local/es/elasticsearch-7.3.2
vim config/elasticsearch.yml
#支持远程访问
network.host: 192.168.1.92
#配置需要发现的初始节点列表
discovery.seed_hosts: ["192.168.1.92"]
#设置节点名称
node.name: master
#设置主节点列表
cluster.initial_master_nodes: ["master"]
启动和停止
cd /usr/local/es/elasticsearch-7.3.2
#启动
./bin/elasticsearch
#守护进程启动
./bin/elasticsearch -d
#其他启动方式【未验证】
./bin/elasticsearch -Xms512m -Xmx512m
#停止集群【未验证】
curl -X POST http://主机IP:9200/_cluster/nodes/节点标识符(如es-node1)/_shutdown
#检查服务是否启动
curl http://127.0.0.1:9200
curl http://192.168.1.92:9200
{
"name" : "da3f6f7a9b00",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "o_KisXPYS26kfhcLhaPldg",
"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"
}
注意点
- 系统条件不满足
ERROR: [1] bootstrap checks failed
[1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
#切换到root用户修改配置sysctl.conf
vim /etc/sysctl.conf
#添加配置
vm.max_map_count=262144
#应用
sysctl -p
- 添加配置
network.host: 192.168.1.92
后启动报错
ERROR: [1] bootstrap checks failed
[1]: 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
【分析】:需要至少配置一项[discovery.seed_hosts, discovery.seed_providers,cluster.initial_master_nodes]
【解决方案】添加配置:discovery.seed_hosts: ["192.168.1.92"]
- 待续
HEAD插件安装
见同目录文档:ES-HEAD插件安装.md
IK分词器安装
见同目录文档:ES-IK中文分词器安装.md
Kibana安装
见同目录文档:ES-Kibana安装.md