初始Elasticsearch

目录

安装

es需要Java8 环境,需要首先安装jdk.
安装完java环境,就可以安装es,直接下载压缩包

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.5.1.zip
unzip elasticsearch-5.5.1.zip -d ${install_dir}

启动

cd ${install_dir}/elasticsearch-5.5.1/ 
./bin/elasticsearch

如果这时候报错 error=‘Cannot allocate memory‘, 是因为elasticsearch5.0默认分配jvm空间大小为2g,需要改小一点

vim config/jvm.options
-Xms512m
-Xmx512m

如果你使用root用户启动,则此时会报错‘org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root‘

adduser ${user_name}
passwd ${user_name}
whereis sudoers
ls -l /etc/sudoers
chmod -v u+w /etc/sudoers
vim /etc/sudoers
${user_name}    ALL=(ALL)       ALL
chmod -v u-w /etc/sudoers
# 添加到root组
usermod -G root ${user_name}
su ${user_name}

相关推荐