常需要安装elasticsearch,写个标准版安装一下
加了ik分词器

测试环境Centos7

#!/bin/bash
# Author:  0x49 <av AT avday.cn>
install_path="/data"
user="es"
group="es"
cd $install_path
yum install -y java
wget https://wp.0x49.cc/linux/elasticsearch/elasticsearch-analysis-ik-7.9.1.zip
wget https://wp.0x49.cc/linux/elasticsearch/elasticsearch-7.9.1-linux-x86_64.tar.gz
tar -zxvf elasticsearch-7.9.1-linux-x86_64.tar.gz
rm -rf elasticsearch-7.9.1-linux-x86_64.tar.gz
mkdir -p elasticsearch-7.9.1/plugins/ik
mv elasticsearch-analysis-ik-7.9.1.zip /data/elasticsearch-7.9.1/plugins/ik
cd $install_path/elasticsearch-7.9.1/plugins/ik
unzip elasticsearch-analysis-ik-7.9.1.zip
rm -rf $install_path/elasticsearch-7.9.1/plugins/ik/elasticsearch-analysis-ik-7.9.1.zip
cd $install_path/elasticsearch-7.9.1/config
sed -i "s@^#cluster.name: my-application@cluster.name: app-application@" $install_path/elasticsearch-7.9.1/config/elasticsearch.yml
sed -i '/#node.name: node-1/s/^#//' $install_path/elasticsearch-7.9.1/config/elasticsearch.yml
sed -i '/#bootstrap.memory_lock: true/s/^#//' $install_path/elasticsearch-7.9.1/config/elasticsearch.yml
sed -i "s@^#network.host: 192.168.0.1@network.host: 127.0.0.1@" $install_path/elasticsearch-7.9.1/config/elasticsearch.yml
sed -i '/#http.port: 9200/s/^#//' $install_path/elasticsearch-7.9.1/config/elasticsearch.yml
egrep "^$group" /etc/group >& /dev/null
if [ $? -ne 0 ]
then
    groupadd $group
fi
egrep "^$user" /etc/passwd >& /dev/null
if [ $? -ne 0 ]
then
    useradd -g $group $user
fi
chown es.es -R $install_path/elasticsearch-7.9.1
cat /etc/sysctl.conf | grep vm.max_map_count
if [ $? -ne 0 ];then
    echo -e "vm.max_map_count = 262144" >> /etc/sysctl.conf
else
    sed -i "/^vm.max_map_count/cvm.max_map_count = 262144" /etc/sysctl.conf
fi

#启动命令
su -c "$install_path/elasticsearch-7.9.1/bin/elasticsearch" es

Last modification:September 14, 2020
如果觉得我的文章对你有用,请随意赞赏