ELK 实验(二)安装Elastic Search 单节点

Linux 安装

java -version

0a1f041bb2704f4cbba50c037c1c8f86

echo $JAVA_HOME

8ff10194a13f4918aa2e4e8024729dce

木有返回,环境没有设置好。。。

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

989b7fb764754ded9712ecf667d638df

有了

下载

curl -L -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.2.3.tar.gz

d38a69cf09f54b9abd8ea57d763e8402

tar -zxvf elasticsearch-6.2.3.tar.gz

cd elasticsearch-6.2.3/bin

./elasticsearch

35e4bc10fd7a4c708fd260476214474c

容我修个错误

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

fef004b4987c4e209899a67b9d9ec1a7

Exception in thread "main" java.nio.file.AccessDeniedException: /usr/elasticsearch-6.2.3/config/jvm.options

容我再修个错误

感觉目录没权限,加一个

chown pactera /usr/elasticsearch-6.2.3/ -R

d24796a34b494e499e28980021161627

chown -R 文件夹名 用户名

26c6cc7de7174a56b23c9f7a79594802

内存设置小了,不过可以忽略

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

932497556ddf4423afb6dd185259e134

本地访问有数据,但是远程访问无法,容我修个错误

cc596c666514443098ee69a6533d37aa

vi config/elasticsearch.yml

network.host: 0.0.0.0

ea28c62e06c8460c99ec69e8705a961e

改成IP后无法公开ip

bound or publishing to a non-loopback address, enforcing bootstrap checks

ERROR: [2] bootstrap checks failed

9700caef03ff4f35afabf49aa2fa0701

c118165e3eb34e239aa8775709d4b2cc

又出现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

46dc3f0876b74a34958763195336c4f6

剩下错误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 可以从外网访问了

a55685bae59046a78780a6774a841d17


windows 安装

https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.2.3.msi

er_locations

这组件十分的傻瓜。。。。

猜你喜欢

转载自blog.51cto.com/433266/2103869