服务器部署ElasticSearch-7.12.1

1.安装包下载

不同版本elasticsearch,可访问es官方网站进行下载,本文使用7.12.1版本进行部署

elasticsearch-7.12.1-linux-x86_64.tar.gz

2.安装包上传服务器

根据各自需要,选择elasticsearch安装位置。

解压elasticsearch-7.12.1-linux-x86_64.tar.gz

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

3.修改es配置

# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: my-elastic
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: node-1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
path.data: /usr/local/elasticsearch/es-data
#
# Path to log files:
#
path.logs: /usr/local/elasticsearch/es-log
# ---------------------------------- Network -----------------------------------
#
# By default Elasticsearch is only accessible on localhost. Set a different
# address here to expose this node on the network:
#
network.host: 0.0.0.0
#
# By default Elasticsearch listens for HTTP traffic on the first free port it
# finds starting at 9200. Set a specific HTTP port here:
#
http.port: 9200
#
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when this node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
#discovery.seed_hosts: ["host1", "host2"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
cluster.initial_master_nodes: ["node-1"]
#开启cors跨域访问支持,默认为false
http.cors.enabled: true
#跨域访问允许的域名地址,(允许所有域名)以上使用正则
http.cors.allow-origin: "*"


4.新增用户

es不允许使用root用户启动,需要新建一个用户并赋予权限

# 创建用户
adduser elastic
# 修改elastic用户密码
passwd elastic
# 给elastic用户赋予文件夹权限
chown 777 /usr/local/elasticsearch-7.12.1 -R

5.修改服务配置

# 在 /etc/sysctl.conf文件最后添加一行
vm.max_map_count=262144
# 修改 etc/security/limits.conf, 添加如下内容
elastic soft nofile 65536
elastic hard nofile 65536

6.启动elasticsearch

./bin/elasticsearch -d

至此,单节点es服务已部署完毕!

文章仅作为记录方便以后使用查找

7.测试访问

浏览器地址栏输入http://服务器ip:端口号

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值