>安装
1. 创建基础环境
环境 centos7.9 es版本 7.13.3
按照如下的步骤一步步走,就可以正常完成安装
groupadd es
useradd es -g es -p es123
cd /home
mkdir -p elk/{es, kibana, data, logs}
chown -R es:es elk
2. 安装es
cd elk/
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.13.3-linux-x86_64.tar.gz
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.13.3-linux-x86_64.tar.gz.sha512
shasum -a 512 -c elasticsearch-7.13.3-linux-x86_64.tar.gz.sha512
tar -xf elasticsearch-7.13.3-linux-x86_64.tar.gz --strip-components 1 -C es/
3. 安装ik分词器
cd es/
./bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.13.3/elasticsearch-analysis-ik-7.13.3.zip
4. 安装pinyin分词器
./bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-pinyin/releases/download/v7.13.3/elasticsearch-analysis-pinyin-7.13.3.zip
注意所有的plugin版本必须和es版本一致,比如Elasticsearch是7.13.3, 那么Beats、APM Server 、Kibana和Logstash等等都必须是 7.13.3
>配置
1. config/elasticsearch.yml
vim config/elasticsearch.yml
cluster.name: zhihuichengshi
node.name: master-node1
path.data: /home/elk/data
path.logs: /home/elk/logs
network.host: 0.0.0.0
http.port: 9200
discovery.seed_hosts: ["192.168.1.10:9300", "192.168.1.11", "seeds.mydomain.com", "[0:0:0:0:0:ffff:c0a8:10c]:9301"]
cluster.initial_master_nodes: ["master-node1"]
xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true
xpack.license.self_generated.type: basic
http.cors.enabled: true
http.cors.allow-origin
http.cors.max-age
http.cors.allow-methods
http.cors.allow-headers
http.cors.allow-credentials
bootstrap.system_call_filter: false
2. config/jvm.options
vim config/jvm.options
-Xms512m
-Xmx512m
3. 系统配置
vim /etc/security/limits.conf
es - nofile 65536
es - noproc 4096
swapoff -a
vim /etc/fstab
vim /etc/sysctl.conf
vm.swappiness = 0
vm.max_map_count = 262144
sysctl -p
>启动es
1. 如果在elasticsearch.yml中配置了xpack.security.enabled: true
./bin/elasticsearch-setup-passwords interactive
修改密码:其中elastic可换成其他系统名称,进而修改其密码 curl -H “Content-Type:application/json” -XPOST -u elastic ‘http://192.168.25.131:9200/_xpack/security/user/elastic/_password’ -d ‘{ “password” : “123456” }’
2. 启动es
cd /home/elk/es/
su es -c "./bin/elasticsearch -d -p pid"
3. 关闭es
cd /home/elk/es/
pkill -F pid
|