Linux上搭建Elasticsearch

前提条件:Linux配置了java环境。

环境搭建:使用putty连接服务器,cd到/usr/local

    下载压缩包: wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.1.1-linux-x86_64.tar.gz

     解压: tar -zxvf elasticsearch-7.1.1-linux-x86_64.tar.gz

    修改elasticsearch.yml配置, 启动服务: ./bin/elasticsearch

理想情况下这几个步骤即可。但是在启动服务的时候会遇到一些问题,记录一下。

1: 不能使用root用户启动Elasticsearch.

  • 创建新账号: adduser esuser
  • 然后设置密码: passwd esuser, 根据提示输入密码即可。
  • 给新用户授权:  chown -R esuser /usr/local/elasticsearch-7.1.1

2:上面说到cd到/usr/local文件夹下,是因为不能在root文件夹下启动服务。

3: 启动时的error message: 

unable to install syscall filter: 

   在elasticsearch.yml中新增配置bootstrap.system_call_filter,设为false。

4. elasticsearch.yml文件中默认配置path.data和path.logs的值未修改,启动时报错: Unable to create    folder/directory /path/to/logs, 将两个配置的值修改为elasticsearch路径, /usr/local/elasticsearch-7.1.1/data
 和 /usr/local/elasticsearch-7.1.1/logs。

5: 还有一些比较common的问题,error message: 

 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]
...

   需要修改一些配置,可参考https://www.cnblogs.com/gentle-awen/p/10114759.html。其中有条错误max number of threads [1024] for user [hadoop] is too low, increase to at least [4096] 修改之后仍不生效,因为/etc/security/limits.d/90-nproc.conf的配置覆盖了/etc/security/limits.conf的值,修改为4096即可。

    Elasticsearch启动成功后,浏览器访问http://ip:9200没有响应, 需要开放9200端口。修改/etc/sysconfig/iptable, 添加

-I INPUT -p tcp --dport 9200 -j ACCEPT, 再访问会返回

{
  "name" : "node-1",
  "cluster_name" : "my-es",
  "cluster_uuid" : "GhUKtv3iSa-EAXN44UMZ_A",
  "version" : {
    "number" : "7.1.1",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "7a013de",
    "build_date" : "2019-05-23T14:04:00.380842Z",
    "build_snapshot" : false,
    "lucene_version" : "8.0.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值