安装es
- 创建es用户
#创建用户
useradd es
#初始化密码
passwd es
#切换用户并进入家目录
su es
cd ~
- 获取安装包(官网地址)
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.12.1-linux-x86_64.tar.gz
- 解压
tar -zxvf elasticsearch-7.12.1-linux-x86_64.tar.g
- 修改jvm参数(默认4g自己服务器满足需要可以不用修改)
cd elasticsearch-7.12.1/config/
vim jvm.options
-Xms200m
-Xmx200m
- 修改配置文件
vim elasticsearch.yml
#允许所有主机访问 默认只允许本机访问
network.host: 0.0.0.0
#节点名 不设置会启动报错: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
node.name: node-1
cluster.initial_master_nodes: ["node-1"]
- 启动
#-d后台启动
./bin/elasticsearch -d
- 查看是否启动成功(如图所示启动成功)
出现报错:
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
原因虚拟内存太小。调大虚拟内存
sudo vim /etc/sysctl.conf
#在最后一行添加否则会报错
vm.max_map_count=655360
#更新配置
sysctl -p
#查看是否生效
sysctl -a|grep vm.max_map_count
sysctl: reading key "net.ipv6.conf.all.stable_secret"
sysctl: reading key "net.ipv6.conf.default.stable_secret"
sysctl: reading key "net.ipv6.conf.eth0.stable_secret"
sysctl: reading key "net.ipv6.conf.lo.stable_secret"
vm.max_map_count = 262144
安装 kibana(用es用户)
- 下载(官网)
wget https://artifacts.elastic.co/downloads/kibana/kibana-7.12.1-linux-x86_64.tar.gz
- 解压
tar -zxvf kibana-7.12.1-linux-x86_64.tar.gz
- 修改配置文件
#配置汉化
i18n.locale: "zh-CN"
#允许外网访问
server.host: "0.0.0.0"
- 启动
nohp ./kibana-7.12.1-linux-x86_64/bin/kibana &
安装ik分词器
#获取安装包
wget https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.12.1/elasticsearch-analysis-ik-7.12.1.zip
#解压
unzip elasticsearch-analysis-ik-7.12.1.zip
#安装插件