java -version
echo $JAVA_HOME
木有返回,环境没有设置好。。。
vi /etc/profile
export JAVA_HOME=/usr/java/jdk1.8.0_162
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
刷新下
source /etc/profile
有了
下载
curl -L -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.2.3.tar.gz
tar -zxvf elasticsearch-6.2.3.tar.gz
cd elasticsearch-6.2.3/bin
./elasticsearch
容我修个错误
org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root
这个错误,是因为使用root用户启动elasticsearch,elasticsearch是不允许使用root用户启动的,所以我们需要添加用户,或者加一个参数。
cp -r elasticsearch-6.2.3 /usr/
su pactera
./elasticsearch
Exception in thread "main" java.nio.file.AccessDeniedException: /usr/elasticsearch-6.2.3/config/jvm.options
容我再修个错误
感觉目录没权限,加一个
chown pactera /usr/elasticsearch-6.2.3/ -R
chown -R 文件夹名 用户名
内存设置小了,不过可以忽略
ES5之前可以用这个,6就不行了
vi bin/elasticsearch
ES_JAVA_OPTS="-Des.insecure.allow.root=true"
或者启动加参数
./elasticsearch -Des.insecure.allow.root=true
以后台服务运行
./elasticsearch -d
curl -i localhost:9200
本地访问有数据,但是远程访问无法,容我修个错误
vi config/elasticsearch.yml
network.host: 0.0.0.0
改成IP后无法公开ip
bound or publishing to a non-loopback address, enforcing bootstrap checks
ERROR: [2] bootstrap checks failed
又出现3个错误,继续踩坑
ERROR: [3] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
[2]: memory locking requested for elasticsearch process but memory is not locked
[3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
错误2
vi elasticsearch.yml
加入2行
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
错误3
max virtual memory增加10倍总归没错了吧
临时增加
sysctl -w vm.max_map_count=655360
sysctl -a | grep "vm.max_map_count"
或者永久解决
vi /etc/sysctl.conf
vm.max_map_count=655360
sysctl -p
剩下错误1,最大文件描述
[2018-04-16T10:43:04,079][INFO ][o.e.b.BootstrapChecks ] [node-1] bound or publishing to a non-loopback address, enforcing bootstrap checks
ERROR: [1] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
vi /etc/security/limits.conf
* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096
然后需要重启下
192.168.209.160:9200 可以从外网访问了
windows 安装https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.2.3.msi
这组件十分的傻瓜。。。。
原文地址:http://blog.51cto.com/433266/2103869