elasticsearch新手入坑123

下载安装包,解压
来到解压目录的bin目录,直接./elasticsearch启动
如果是root,会提示不能用root启动,切个用户来启动,正常情况,你可以通过localhost:9200来访问了
but,如果你想通过网络来访问,你一定是要ip+port来访问的,这时就访问不到了,要改下配置
conf/elasticsearch.yml
找到network.host: xxx.xxx.xxx.xxx,把ip配进来,保存退出

这时再运行bin/elasticsearch,系统会报下面三个错

[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
[2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[3]: 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
ERROR: Elasticsearch did not exit normally - check the logs at /opt/elasticsearch-7.8.1/logs/elasticsearch.log

1、可创建文件描述的数量太低,至少需要65536
有多种改法,有临时的,有永久的,不废话,直接改配置文件重启,永久生效
vim /etc/security/limits.conf
文件最后加上
* soft nofile 65536
* hard nofile 65536

其中*表示所有用户  nofile表示最大文件句柄数,表示能够打开的最大文件数目
保存退出,reboot

2、vm.max_map_count太小
vim /etc/sysctl.conf
增加
vm.max_map_count=262144
保存退出
sysctl -p

3、默认的discovery settings不适用于生产环境
这个还是要改conf/elasticsearch.yml
a)找到node.name: node-1,把注释放开
b)找到discovery.seed_hosts: ["host1","host2"],去掉注释,内容换成discovery.seed_hosts: ["你的ip"]
c)找到cluster.initial_master_nodes: ["node-1", "node-2"],放开注释,改成cluster.initial_master_nodes: ["node-1"],node-1对应的就a步骤的name

保存退出,再次调用bin/elasticsearch,启动成功

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值