linux安装elasticsearch 7.9.3

使用yum方式安装

1.在/etc/yum.repos.d/下创建文件elasticsearch.repo,文件内容:

[elasticsearch]
name=Elasticsearch repository for 7.x packages
baseurl=https://artifacts.elastic.co/packages/7.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=0
autorefresh=1
type=rpm-md

2.执行 yum install --enablerepo=elasticsearch elasticsearch 命令安装

3.执行 systemctl start elasticsearch.service 启动elasticsearch

使用wget下载

1.安装wget

yum install -y wget

2.下载elasticsearch压缩包

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.9.3-linux-x86_64.tar.gz

3.解压缩

tar -zxvf elasticsearch-7.9.3-linux-x86_64.tar.gz

4.配置外网访问

修改elasticsearch.yml配置

vim config/elasticsearch.yml

显示文件行数,命令行模式下

:set number

解除注释内容,第55行,59行

#修改网卡 127.0.0.1表示只允许当前系统访问,如果想要对外访问则可以改为 0.0.0.0
network.host: 0.0.0.0
#访问端口,默认是9200
http.port: 9200

5.启动elasticsearch

./bin/elasticsearch

可能遇到的问题

1.can not run elasticsearch as root

elasticsearch不能用root启动,需切换到普通用户启动
需要更改普通用户的权限

chown -R lusi elasticsearch-7.9.3

2.max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]

修改文件

vi /etc/security/limits.conf

追加内容

*  soft nofile 65536
*  hard nofile 65536

3.max number of threads [3766] for user [ziv] is too low, increase to at least [4096]

修改文件

vi /etc/security/limits.conf

追加内容

*  hard nproc 4096
*  soft nproc 4096

4.max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

修改文件

vim /etc/sysctl.conf

追加内容

vm.max_map_count = 262144

重新加载/etc/sysctl.conf配置

sysctl -p

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

修改elasticsearch的配置文件

vi config/elasticsearch.yml

追加内容

discovery.seed_hosts: ["127.0.0.1", "[::1]"]
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值