Linux安装elasticsearch教程

配置JDK1.8

使用wget 下载elasticsearch安装包

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.6.8.tar.gz

解压

tar -zxvf elasticsearch-5.6.8.tar.gz

官网:https://www.elastic.co/products/elasticsearch

外网访问配置:

config目录下面elasticsearch.yml

修改为 network.host: 0.0.0.0

配置es出现相关问题处理(阿里云、腾讯云,亚马逊云安装问题集合):

1、问题一

Java HotSpot(TM) 64-Bit Server VM warning: INFO:os::commit_memory(0x00000000c5330000, 986513408, 0) failed; error='Cannot allocate memory'

(errno=12)

#

# There is insufficient memory for the Java Runtime Environment to continue.

# Native memory allocation (mmap) failed to map 986513408 bytes for committing

reserved memory.

# An error report file with more information is saved as:

# /usr/local/software/temp/elasticsearch-6.2.2/hs_err_pid1912.log

解决:修改config文件夹中的  jvm.options

-Xms2g
-Xmx2g

改为:

-Xms128M
-Xmx128M

或者增加内存

2、问题二

[root@iZwz95j86y235aroi85ht0Z bin]# ./elasticsearch

[2018-02-22T20:14:04,870][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler]

[] uncaught exception in thread [main]

org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can

not run elasticsearch as root

at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:125) ~

[elasticsearch-6.2.2.jar:6.2.2]

at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:112) ~

[elasticsearch-6.2.2.jar:6.2.2]

at

org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~

[elasticsearch-6.2.2.jar:6.2.2]

at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~

[elasticsearch-cli-6.2.2.jar:6.2.2]

解决:用非root用户

添加用户:useradd -m 用户名 然后设置密码 passwd 用户名

3、问题三

./elasticsearch

Exception in thread "main" java.nio.file.AccessDeniedException:

/usr/local/software/temp/elasticsearch-6.2.2/config/jvm.options

解决:权限不够 chmod 777 -R 当前es目录

 

问题4:ERROR: [2] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
[2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

 

修改/etc/security/limits.conf在最后添加

* soft nofile 65536
* hard nofile 131072

解决办法:
1、切换到root用户修改配置sysctl.conf

vi /etc/sysctl.conf 

添加下面配置:vm.max_map_count=655360
并执行命令:sysctl -p
然后,重新启动elasticsearch,即可启动成功。

 

问题五:ERROR: [1] bootstrap checks failed

ERROR: [1] bootstrap checks failed
[1]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured

解决办法:

ip替换host1等,多节点请添加多个ip地址,单节点可写按默认来
#配置以下三者,最少其一
#[discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes]
cluster.initial_master_nodes: ["node-1"] #这里的node-1为node-name配置的值

 

常见配置问题资料:https://www.jianshu.com/p/c5d6ec0f35e0

 

 

elasticsearch 切换自带JDK

参考下面这个网址

https://www.cnblogs.com/sanduzxcvbnm/p/11976046.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值