ITPub博客

首页 > IT基础架构 > > Linux下安装ElasticSearch

Linux下安装ElasticSearch

作者:格伯纳 时间:2020-05-29 13:40:32 0 删除 编辑

一、下载es包

下载中心 - Elastic 中文社区

二、解压后

三、启动

前台启动 ./bin/elasticsearch

后台启动 ./bin/elasticsearch -d

四、报错

问题1

OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000085330000, 2060255232, 0) failed; error='Cannot allocate memory' (errno=12)

解决:config/jvm.optipons配置文件,默认jvm内存时1g,而当前机器不够1g,可以修改小一点,个人学习用可以修改成 128m

-Xms128m

-Xmx128m


问题2

OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCThreads=N


解决:config/jvm.optipons配置文件添加 -XX:-AssumeMP

问题3

org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root

解决:es不允许以root用户运行,需要单独创建用户

groupadd es

useradd es -g es

chown -R es:es elasticsearch-6.5.4

然后切换至es用户,启动

su es

./bin/elasticsearch

启动成功后Linux 访问 curl 127.0.0.1:9200


五、远程访问

可以修改 Elastic 安装目录的config/elasticsearch.yml文件,去掉network.host的注释,将它的值改成0.0.0.0,设成0.0.0.0让任何人都可以访问。线上服务不要这样设置,要设成具体的 IP然后重新启动 Elastic。

network.host: 0.0.0.0

浏览器访问

至此,安装完毕。

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/31509949/viewspace-3149544/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
管理员

注册时间:2018-03-30

  • 博文量
    2383
  • 访问量
    983925