CenOS 7
shellrpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
# ES 7
cat << EOF > /etc/yum.repos.d/elasticsearch.repo
[elasticsearch]
name=Elasticsearch repository for 7.x packages
baseurl=https://mirrors.tuna.tsinghua.edu.cn/elasticstack/7.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md
EOF
# ES 8
cat << EOF > /etc/yum.repos.d/elasticsearch.repo
[elasticsearch]
name=Elasticsearch repository for 8.x packages
baseurl=https://mirrors.tuna.tsinghua.edu.cn/elasticstack/8.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md
EOF
yum install -y elasticsearch kibana logstash
systemctl daemon-reload
systemctl enable elasticsearch.service
systemctl enable kibana.service
systemctl enable logstash.service
Ubuntu
shellsudo apt install apt-transport-https
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
# ES 7
echo "deb https://mirrors.tuna.tsinghua.edu.cn/elasticstack/7.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-7.x.list
# ES 8
echo "deb https://mirrors.tuna.tsinghua.edu.cn/elasticstack/8.x/apt stable main" | sudo tee /etc/apt/sources.list.d/elastic-8.x.list
sudo apt update && sudo apt install -y elasticsearch kibana logstash
systemctl daemon-reload
systemctl enable elasticsearch.service
systemctl enable kibana.service
systemctl enable logstash.service
IK Analysis for Elasticsearch
shellES_VERSION=7.6.1 JAVA_HOME=/usr/share/elasticsearch/jdk/ \ /usr/share/elasticsearch/bin/elasticsearch-plugin install \ https://get.infini.cloud/elasticsearch/analysis-ik/$ES_VERSION
Pinyin Analysis for Elasticsearch
shellES_VERSION=7.6.1 JAVA_HOME=/usr/share/elasticsearch/jdk/ \ /usr/share/elasticsearch/bin/elasticsearch-plugin install \ https://get.infini.cloud/elasticsearch/analysis-pinyin/$ES_VERSION
shellcat << EOF >> /etc/elasticsearch/elasticsearch.yml network.host: 0.0.0.0 http.port: 9200 discovery.type: single-node EOF systemctl restart elasticsearch.service
"Validation Failed: 1: this action would add [2] shards, but this cluster currently has [1903]/[1000] maximum normal shards open;"
shellcat << EOF >> /etc/elasticsearch/elasticsearch.yml cluster.max_shards_per_node: 10000 EOF systemctl restart elasticsearch.service
Error enabling rule: could not create API key - feature_not_enabled_exception: [feature_not_enabled_exception] Reason: api keys are not enabled
bashcat << EOF >> /etc/elasticsearch/elasticsearch.yml
xpack.security.authc.api_key.enabled: true
EOF
systemctl restart elasticsearch.service
bash/usr/share/kibana/bin/kibana-encryption-keys generate
cat << EOF >> /etc/kibana/kibana.yml
xpack.encryptedSavedObjects.encryptionKey: b9d7e558c8e03ca80e698384189d4751
xpack.reporting.encryptionKey: ca8c1a3551bfba02cf0ffd3dbb0df52b
xpack.security.encryptionKey: d0b8fe87528c2da203ac402bf7d6308c
EOF
systemctl restart kibana.service
本文作者:菜鸟
本文链接:
版权声明:本博客所有文章除特别声明外,均采用 署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0) 许可协议。转载请注明出处!