CentOS7 elasticsearch-7.16.3部署

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

#配置ES_JAVA_HOME环境变量
vi /etc/profile
ES_JAVA_HOME=/opt/elasticsearch-7.16.3/jdk
export ES_JAVA_HOME
source /etc/profile

修改配置文件 config/elasticearch.yml
#修改集群名称
cluster.name: test-elasticsearch
#修改当前的es节点名称
node.name: es-node0
#修改data数据保存地址和日志数据保存地址
path.data: /opt/elasticsearch-7.16.3/data
path.logs: /opt/elasticsearch-7.16.3/logs
#绑定es网络ip
network.host: 0.0.0.0

最后增加了这些配置:
action.auto_create_index: .monitoring*,.watches,.triggered_watches,.watcher-history*,.ml*
http.cors.enabled: true
http.cors.allow-origin: "*"
http.cors.allow-headers: Authorization,X-Requested-With,Content-Length,Content-Type
http.cors.allow-credentials: true
ingest.geoip.downloader.enabled: false

#集群节点修改为之前的节点名称
cluster.initial_master_nodes: ["es-node0"]

#证书生成(会生成在/opt/elasticsearch-7.16.3)
#详细可以参考:https://www.elastic.co/guide/en/elasticsearch/reference/7.16/security-basic-setup.html#encrypt-internode-communication
bin/elasticsearch-certutil ca
bin/elasticsearch-certutil cert --ca elastic-stack-ca.p12
在config目录创建certs目录,将文件拷贝过去,然后增加如下配置

./bin/elasticsearch-keystore add xpack.security.transport.ssl.keystore.secure_password
./bin/elasticsearch-keystore add xpack.security.transport.ssl.truststore.secure_password

xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true
xpack.security.transport.ssl.verification_mode: certificate 
xpack.security.transport.ssl.client_authentication: required
xpack.security.transport.ssl.keystore.path: certs/elastic-certificates.p12
xpack.security.transport.ssl.truststore.path: certs/elastic-certificates.p12


#修改jvm参数:jvm.options
-Xms1g
-Xmx1g


#创建用户:
useradd es
chown -R es:es /opt/elasticsearch-7.16.3
su es

chown -R es:es /opt/elasticsearch-7.16.3/config/certs

#设置密码
./elasticsearch-setup-passwords interactive

#检查防火墙
systemctl status firewalld.service
systemctl stop firewalld.service
#永久关闭防火墙
systemctl disable firewalld.service

https://192.168.0.106:9200/
elastic
123456


前台启动:./elasticsearch
后台启动:./elasticsearch -d


可能遇到如下问题:
1. max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
2. max number of threads [3795] for user [esuser] is too low, increase to at least [4096]
3. max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
前两个需要切换至root用户修改/etc/security/limits.conf,增加如下配置,再切换es用户重启服务。
* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096
第三个需要切换至root用户修改/etc/sysctl.conf,增加如下配置,然后执行 sysctl -p 刷新,再切换es用户重启服务。
vm.max_map_count=262145


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值