elasticsearch 7.2.0安装

elasticsearch 7.2.0安装

第一步
下载安装包
elasticsearch-7.2.0-linux-x86_64.tar.gz
解压文件
tar -zxvf elasticsearch-7.2.0-linux-x86_64.tar.gz

第二步
修改配置文件config/elasticsearch.yml,修改项如下:

cluster.name: my-application
node.name: node-1
network.host: 0.0.0.0
cluster.initial_master_nodes: ["node-1"]
xpack.license.self_generated.type: basic

备注:
1.如果不打开node.name的注释,在启动kibana的时候会出现错误Elasticsearch cluster did not respond with license information.
2.cluster.initial_master_nodes默认为cluster.initial_master_nodes: [“node-1”,“node-2”],如果不删除node-2,会产生bootstrap checks failed错误
3.xpack.license.self_generated.type: basic因为elasticsearch 7.2默认集成了xpack,而默认的license就只能用30天,所以更改为只使用最基本的功能

第三步
因为elasticsearch不能使用root账户启动,所以要创建一个普通用户esuser

useradd esuser -m

设置用户名密码,也可以不设置,命令如下:

passwd esuser

然后给elasticsearch目录设置一个esuser安全权限:

chown -R esuser:esuser /xxx/elasticsearch-7.2.0/

第4步
设置一些elasticsearch启动需要的一些额外操作系统设置
1.修改所有用户最大可创建的文件数目,如果不设置,启动会报max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]错误

echo "* soft nofile 65536" >> /etc/security/limits.conf 
echo "* hard nofile 65536" >> /etc/security/limits.conf

2.修改最大虚拟内存,如果不设置,启动会报max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

echo "vm.max_map_count=262144" >> /etc/sysctl.conf
sysctl -w vm.max_map_count=262144

可以使用以下命令查看是否生效:

sysctl -a|grep vm.max_map_count

3.设置用户最大线程数,如果不设置,启动会报max number of threads [3795] for user [esuser] is too low, increase to at least [4096]

echo "* soft nproc 4096" >> /etc/security/limits.conf 
echo "* hard nproc 4096" >> /etc/security/limits.conf

第5步
启动elasticsearch
su - esuser -c “/xxx/elasticsearch-7.2.0/bin/elasticsearch -d”

然后就可以检测是否启动成功了
curl http://192.168.1.2:9200

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值