ElasticSearch安装笔记

ElasticSearch安装笔记

需要东西:
1、JDK
我这里用的是JDK11
2、ElasticSearch
安装包是 elasticsearch-6.4.2.tar.gz
地址:https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.4.2.tar.gz

环境准备

系统用的是CentOS 7

JDK环境

配置elasticsearch的用户及用户组

elasticsearch不能以root启动

#创建用户组elsearch
groupadd elsearch
#创建用户elsearch并添加elsearch用户组
useradd elsearch -g elsearch

#改变elasticsearch程序名目录、数据目录、日志目录,让elsearch用户有对应的读写执行的权限。
#程序目录
chown -R elsearch:elsearch /usr/local/elasticsearch/elasticsearch-6.4.2
#数据目录
chown -R elsearch:elsearch /data/elasticsearch/data
#日志目录
chown -R elsearch:elsearch /data/elasticsearch/logs

配置elasticsearch.yml

配置文件在程序conf目录下

我这里配置了elasticsearch的数据目录、日志目录、开户外网访问,设置了端口(默认9200)
network.host=0.0.0.0 是开启外网访问。

# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
path.data: /data/elasticsearch/data
#
# Path to log files:
#
path.logs: /data/elasticsearch/logs
#
# ---------------------------------- Network -----------------------------------
#
http.enabled: true
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: 0.0.0.0
#
# Set a custom port for HTTP:
#
http.port: 9200
#
# For more information, consult the network module documentation.
#

启动

到elasticsearch的bin目录下执行

./elasticsearch

#后台运行
nohup ./elasticsearch &

遇到的问题

问题1

ERROR: [1] bootstrap checks failed [1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]

解决:

#root用户下
vi etc/security/limits.conf
#在末尾添加
* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096

退出elsearch用户,重新登录生效。

问题2

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

#root用户下
vi  /etc/sysctl.conf
#添加
vm.max_map_count=655360
#保存后,执行
sysctl -p

貌似是重启后生效,因为前后解决的时间不一样,有重启过系统。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值