CentOS7 Elasticsearch7 安装&配置

  • 下载
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.10.0-linux-x86_64.tar.gz
  • 解压指定目录
tar -zxf elasticsearch-7.10.0-linux-x86_64.tar.gz -C /usr/local
  • 自定义jdk配置
#进入ES的bin目录
vi /usr/local/elasticsearch-7.10.0/bin/elasticsearch

#配置为指定的JDK
export JAVA_HOME=/usr/local/software/elasticsearch-7.10.0/jdk
export PATH=$JAVA_HOME/bin:$PATH

#添加jdk判断
if [ -x "$JAVA_HOME/bin/java" ]; then
        JAVA="/usr/local/elasticsearch-7.10.0/jdk/bin/java"
else
        JAVA=`which java`
fi
  • 创建用户
# 1、创建新的用户
adduser elastic
# 2、设置用户密码
passwd elastic
# 3、授权给新建用户es文件夹的权限
chown -R elastic /usr/local/elasticsearch-7.10.0
  • 配置elasticsearch.yml
cluster.name: my-application
node.name: node-1
path.data: /opt/elasticsearch/data
path.logs: /logs/elasticsearch
network.host: 192.168.129.134
http.port: 9200
cluster.initial_master_nodes: ["node-1"]
  • 授权目录
chown -R elastic /opt/elasticsearch/data
chown -R elastic /logs/elasticsearch
  • 系统设置
vi /etc/sysctl.conf

vm.max_map_count=262144

sysctl -p #执行命令sysctl -p生效

vi /etc/security/limits.conf

* soft nofile 65536
* hard nofile 65536

reboot #重启生效
  • 启动es
su elastic
cd /usr/local/elasticsearch-7.10.0/bin/
./elasticsearch -d #-d 后台运行
  • 关闭防火墙
systemctl stop firewalld
systemctl disable firewalld.service 
  • 访问测试
[elastic@xxx bin]$ jps
8129 Jps
8100 Elasticsearch
[elastic@xxx bin]$ curl http://192.168.129.134:9200
{
  "name" : "node-1",
  "cluster_name" : "my-application",
  "cluster_uuid" : "5Ay6gWR0S72k7M57bwGErQ",
  "version" : {
    "number" : "7.10.0",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "51e9d6f22758d0374a0f3f5c6e8f3a7997850f96",
    "build_date" : "2020-11-09T21:30:33.964949Z",
    "build_snapshot" : false,
    "lucene_version" : "8.7.0",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}
  • 配置开机启动服务

在/etc/systemd/system目录下创建elasticsearch.service文件

[Unit]
Description=elasticsearch
[Service]
User=elasticsearch
LimitNOFILE=100000
LimitNPROC=100000
ExecStart=/usr/local/elasticsearch/bin/elasticsearch
[Install]
WantedBy=multi-user.target

systemctl enable elasticsearch

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值