设备 应用部署 路径
1 | 192.168.1.54 | elasticsearch自带jdk、elasticsearch-7.10.2、opendistro相关插件、kibana | /data/apps
2 | 192.168.1.55 | elasticsearch自带jdk、elasticsearch-7.10.2、opendistro相关插件 | /data/apps
3 | 192.168.1.56 | elasticsearch自带jdk、elasticsearch-7.10.2、opendistro相关插件 | /data/apps
4 | 192.168.1.57 | elasticsearch自带jdk、elasticsearch-7.10.2、opendistro相关插件 | /data/apps
安装环境
centos 7.6
软件及插件
1.软件
elasticsearch-710.2-linux-x86_64.tar.gz
kibana-7.10.2-linux-x86_64.tar.gz
2.插件(可以按照官方对应版本信息进行安装:https://opendistro.github.io/for-elasticsearch-docs/docs/install/plugins/)
opendistro-security-1.13.1.0.zip #安全插件,用于审计和鉴权
elasticsearch-analysis-ik-7.10.2.zip #索引分词器
elasticsearch-sql-7.10.2.0.zip #sql 查询插件 (也可以私用opendistro_sql,两个插件不兼容,只能用其一)
安装步骤
添加es管理用户
groupadd elasticsearch && useradd -d /home/elasticsearch -m elasticsearch -g elasticsearch
创建应用目录
mkdir -p /data/apps
修改打开文件句柄
echo "* soft nofile 1000000" >> /etc/security/limits.conf
echo "* hard nofile 1000000" >> /etc/security/limits.conf
echo "* soft nproc 1000000" >> /etc/security/limits.conf
echo "* hard nproc 1000000" >> /etc/security/limits.conf
echo "* soft memlock unlimited" >> /etc/security/limits.conf
echo "* hard memlock unlimited" >> /etc/security/limits.conf
sed -i 's/4096/1000000/' /etc/security/limits.d/20-nproc.conf
内核参数设置
cat >> /etc/sysctl.conf << EOF
net.ipv4.conf.all.send_redirects=0
net.ipv4.conf.default.send_redirects=0
net.ipv4.conf.all.accept_redirects=0
net.ipv4.conf.default.accept_redirects=0
net.ipv4.conf.all.secure_redirects=0
net.ipv4.conf.default.secure_redirects=0
net.ipv4.conf.all.rp_filter=1
net.ipv4.conf.default.rp_filter=1
net.ipv6.conf.all.accept_ra=0
net.ipv6.conf.default.accept_ra=0
net.ipv6.conf.all.accept_redirects=0
net.ipv6.conf.default.accept_redirects=0
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_fin_timeout=10
net.ipv4.tcp_max_syn_backlog = 32768
net.ipv4.tcp_max_tw_buckets = 180000
net.ipv4.tcp_rmem = 4096 87380 4194304
net.ipv4.tcp_wmem = 4096 16384 4194304
net.core.wmem_default = 8388608
net.core.rmem_default = 8388608
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.core.netdev_max_backlog = 500000
fs.nr_open = 2500000
vm.zone_reclaim_mode = 0
vm.max_map_count = 655360
vm.swappiness=0
EOF
#执行生效
sysctl -p
1.esasticsearch 的下载路径
Past Releases of Elastic Stack Software | Elastic(https://www.elastic.co/cn/downloads/past-releases#elasticsearch)
2kibana的下载地址
Past Releases of Elastic Stack Software | Elastic (https://www.elastic.co/cn/downloads/past-releases#kibana)
3.huawei 国内镜像源网站
华为开源镜像站_软件开发服务_华为云(https://mirrors.huaweicloud.com/)
在其中一个节点上下载
下载elasticsearch 和 kibana (此处的插件也可按照opendistro 官网 进行安装:https://opendistro.github.io/for-elasticsearch-docs/docs/install/plugins/)
wget -c -N https://d3g5vo6xdbdb9a.cloudfront.net/downloads/elasticsearch-plugins/opendistro-security/opendistro-security-1.13.1.0.zip
wget -N https://d3g5vo6xdbdb9a.cloudfront.net/downloads/kibana-plugins/opendistro-security/opendistroSecurityKibana-1.13.0.1.zip
wget -N https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-710.2-linux-x86_64.tar.gz
wget -N https://artifacts.elastic.co/downloads/kibana/kibana-7.10.2-linux-x86_64.tar.gz
wget -N https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.10.2/elasticsearch-analysis-ik-7.10.2.zip
wget -N https://github.com/NLPchina/elasticsearch-sql/releases/download/7.10.2.0/elasticsearch-sql-7.10.2.0.zip
安装jdk (自行下载)
tar zxf /root/jdk-8u202-linux-x64.tar.gz -C /usr/local/
sed -i '/JAVA_HOME/d' /etc/profile
cat >> /etc/profile <<EOF
#java
export JAVA_HOME=/usr/local/share/jdk1.8.0_181
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export JRE_HOME=$JAVA_HOME/jre
EOF
source /etc/profile && java -version
安装esasticsearch
#配置启动用户
groupadd elasticsearch && useradd -d /home/elasticsearch -m elasticsearch -g elasticsearch
tar -zxvf /root/elasticsearch-710.2-linux-x86_64.tar.gz -C /data/apps/
chown -R elasticsearch:elasticsearch /data/apps/elasticsearch-710.2
修改ES_HOME 启动调用 自身的jdk 修改配置文件 elasticsearch-7.10.2/bin/elasticsearch-env 让jdk 不受外部jdk环境的影响
# now set the path to java
if [ ! -z "$JAVA_HOME" ]; then
#java指向ES_HOME 下的jdk
JAVA="$ES_HOME/jdk/bin/java"
#注释掉系统环境jdk调用
#JAVA="$JAVA_HOME/bin/java"
JAVA_TYPE="JAVA_HOME"
修改java vm 在 elasticsearch-7.10.2/config/jvm.options文件中添加 启动项,根据实际内存定,jvm最大31G,超出会造成指针浪费
-Xms30g
-Xmx30g
-XX:MetaspaceSize=256m