ELK 实验(二)安装Elastic Search 单节点
Linux 安装java -version
http://i2.运维网.com/images/blog/201804/16/27a6abed3427ff1f19f2204ca4528a74.jpg
echo $JAVA_HOME
http://i2.运维网.com/images/blog/201804/16/a456c781f676381040454ec528ee843b.jpg
木有返回,环境没有设置好。。。
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
http://i2.运维网.com/images/blog/201804/16/226957b3e3e44cf11bbdbf2aae6eba40.jpg
有了
下载
curl -L -O https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.2.3.tar.gz
http://i2.运维网.com/images/blog/201804/16/87211058c4e10915b1fb0c3f8003de85.jpg
tar -zxvf elasticsearch-6.2.3.tar.gz
cd elasticsearch-6.2.3/bin
./elasticsearch
http://i2.运维网.com/images/blog/201804/16/64bc612c9a232a895ae2a5012890700e.jpg
容我修个错误
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
http://i2.运维网.com/images/blog/201804/16/168bac2a0eaa5f5a2eca14bfafd3d804.jpg
Exception in thread "main" java.nio.file.AccessDeniedException: /usr/elasticsearch-6.2.3/config/jvm.options
容我再修个错误
感觉目录没权限,加一个
chown pactera /usr/elasticsearch-6.2.3/ -R
http://i2.运维网.com/images/blog/201804/16/8ecf7b5ec4cbcfd5699849bc5093e2af.jpg
chown -R 文件夹名 用户名
http://i2.运维网.com/images/blog/201804/16/86ee6472b04dbdcd4021894e9b88ea85.jpg
内存设置小了,不过可以忽略
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
http://i2.运维网.com/images/blog/201804/16/6176e23a4513bbcb0c0c7efc39088090.jpg
本地访问有数据,但是远程访问无法,容我修个错误
http://i2.运维网.com/images/blog/201804/16/2dde3099ad56ab5386f3dfc1ea6afe78.jpg
vi config/elasticsearch.yml
network.host: 0.0.0.0
http://i2.运维网.com/images/blog/201804/16/759962fdbf5a06e50e6e701d9ab15c3f.jpg
改成IP后无法公开ip
bound or publishing to a non-loopback address, enforcing bootstrap checks
ERROR: bootstrap checks failed
http://i2.运维网.com/images/blog/201804/16/3742d182e3a2a82d562be87043facf10.jpg
http://i2.运维网.com/images/blog/201804/16/ee69617457d47a24cd54e25acf75396c.jpg
又出现3个错误,继续踩坑
ERROR: bootstrap checks failed
: max file descriptors for elasticsearch process is too low, increase to at least
: memory locking requested for elasticsearch process but memory is not locked
: max virtual memory areas vm.max_map_count is too low, increase to at least
错误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
http://i2.运维网.com/images/blog/201804/16/5984c7ceba59907bdb048fdab103b965.jpg
剩下错误1,最大文件描述
bound or publishing to a non-loopback address, enforcing bootstrap checks
ERROR: bootstrap checks failed
: max file descriptors for elasticsearch process is too low, increase to at least
vi /etc/security/limits.conf
* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096
然后需要重启下
192.168.209.160:9200 可以从外网访问了
http://i2.运维网.com/images/blog/201804/16/ba634e744f7c7ff561caf09ae266ab64.jpg
windows 安装 https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.2.3.msi
http://i2.运维网.com/images/blog/201804/16/60886a47aa1bc534f1203a3c2d1e1597.png
这组件十分的傻瓜。。。。
页:
[1]