Linux下安装Elasticsearch

下载Elasticsearch最新版本

Elasticsearch官网地址:https://www.elastic.co/cn/downloads/elasticsearch
在这里插入图片描述
下载好了上传到服务器上。

解压到指定目录并将其重命名

tar -xvf elasticsearch-7.15.1-linux-x86_64.tar.gz -C /usr/local
mv /usr/local/elasticsearch-7.15.1 /usr/local/elasticsearch

创建一个普通用户elk用来运行elasticsearch

useradd elk
passwd elk
[root@localhost local]# useradd elk
[root@localhost local]# passwd elk
更改用户 elk 的密码 。
新的 密码:
无效的密码: 密码少于 8 个字符
重新输入新的 密码:
passwd:所有的身份验证令牌已经成功更新。


创建一个elasticsearch数据存储目录

mkdir -p /usr/local/elasticsearch/data

赋予elk用户拥有elasticsearch所属权限

chown elk:elk -R /usr/local/elasticsearch

修改elasticsearch配置文件

cd /usr/local/elasticsearch/config/
vim elasticsearch.yml

在elasticsearch文件下添加以下内容:

cluster.name: my-application
node.name: node-1
path.data: /usr/local/elasticsearch/data
path.logs: /usr/local/elasticsearch/logs
network.host: 0.0.0.0
cluster.initial_master_nodes: ["node-1"]

修改相关内核参数

echo "vm.max_map_count=655360" >> /etc/sysctl.conf
sysctl -p 
vim /etc/security/limits.conf

在limits.conf文件最后一行添加以下内容:

* soft nproc 65536
* hard nproc 65536
* soft nofile 65536
* hard nofile 65536

切换用户elk来运行elasticsearch

su - elk
cd /usr/local/elasticsearch/
./bin/elasticsearch -d
[root@localhost ~]# su - elk
上一次登录:二 1026 16:23:47 CST 2021pts/2[elk@localhost ~]$ cd /usr/local/elasticsearch/bin/
[elk@localhost bin]$ ./elasticsearch -d

检查elasticsearch状态

如下则表示正常运行

curl http://0.0.0.0:9200
[elk@localhost bin]$ curl http://0.0.0.0:9200
{
  "name" : "node-1",
  "cluster_name" : "my-application",
  "cluster_uuid" : "5gr_iJaPTkKpEv5B5qUZPA",
  "version" : {
    "number" : "7.15.1",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "83c34f456ae29d60e94d886e455e6a3409bba9ed",
    "build_date" : "2021-10-07T21:56:19.031608185Z",
    "build_snapshot" : false,
    "lucene_version" : "8.9.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、付费专栏及课程。

余额充值