elasticsearch配置设置密码登陆各种问题解决

elasticsearch配置各种问题解决(elastic search6.6.0)相关工具包链接: https://pan.baidu.com/s/1SpCCSzpMm57QL-5wqHSugA 提取码: soww1.root用户启动错误在该版本不允许elasticsearch以root形式启动useradd elk## 并将文件权限赋予给角色,避免后续xpack读取文件错误chown -R elk:elk /usr/local/elasticsearch-6.6.0/su elk
摘要由CSDN通过智能技术生成

elasticsearch配置各种问题解决(elastic search6.6.0)

相关工具包
链接: https://pan.baidu.com/s/1SpCCSzpMm57QL-5wqHSugA 提取码: soww
请添加图片描述

1.root用户启动错误

请添加图片描述

在该版本不允许elasticsearch以root形式启动

useradd elk
## 并将文件权限赋予给角色,避免后续xpack读取文件错误
chown -R elk:elk /usr/local/elasticsearch-6.6.0/
su elk

3.启动包内存不足

max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
请添加图片描述

1.在/etc/sysctl.conf文件最后添加一行
vim /etc/sysctl.conf
vm.max_map_count=262144
2.执行/立即生效
/sbin/sysctl -p 

2.xpack配置密码出现错误(一定要按照顺序一步一步来)

1.解压

## 三个节点解压elasticsearch-6.6.0.tar.gz
tar -zxvf elasticsearch-6.6.0.tar.gz -C /usr/local/

2.修改配置文件:

vim elasticsearch-6.6.0/config/elasticsearch.yml

### elasticsearch.yml 配置
cluster.name: es_log_cluster
node.name: es-node-1    ## es-node-2  es-node-3 不同节点名称不同
path.data: /usr/local/elasticsearch-6.6.0/data  ## es数据存放位置
path.logs: /usr/local/elasticsearch-6.6.0/logs  ## es日志存放位置
bootstrap.memory_lock: true     ## 锁内存,强制占用(类似oracle的锁内存)保证es启动正常
network.host: ip     ## network.host不同节点IP对应 (对外发布IP,注意公网是私网ip)
############没有集群下面可以不配####################
## 防止脑裂配置
## 当新节点加入的时候,配置一个初始化主机列表用于节点发现.
## 默认的主机列表是 ["127.0.0.1", "[::1]"]
discovery.zen.ping.unicast.hosts: ["ip:9300", "ip:9300", "ip:9300"]
## 最小节点数,为了避免脑裂的发生,使用如下配置(数值为节点总数/2 + 1)
discovery.zen.minimum_master_nod成,才能开始进行集群初始化恢复动作
gateway.recover_after_nodes: 2
# 集群应该预期有几个节点(master或node都算)
gateway.expected_nodes: 3
### 等待凑齐预期节点时间,例如:先等凑够了3个节点,再等5分钟看看有没有凑齐5个节点
gateway.recover_after_time: 5m
# 禁止在一个操作系统启动多个节点 
node.max_local_storage_nodes: 1
# 删除索引时,需要明确的名称
action.destructive_requires_name: true
# 防止同一个分片的主副本放在同一台机器上
cluster.routing.allocation.same_shard.host: true

3.生成elastic-stack-ca.p12,elastic-stack-ca.p12

#通过bin/elasticsearch-certutil ca生成elastic-stack-ca.p12

bin/elasticsearch-certutil ca

请添加图片描述
默认地址回车
请添加图片描述
输入自己的密码

#在bin/elasticsearch-certutil ca同时生成elastic-stack-ca.p12

bin/elasticsearch-certutil cert --ca elastic-stack-ca.p12

请添加图片描述
输入刚刚的密码,最后生成elastic-stack-ca.p12密码不要写,直接回车 不然会报错xpack Caused by: java.io.IOException: keystore password was incorrect
将两个文件放入config下面

4.设置各组件连接密码

1.创建keystore
bin/elasticsearch-keystore create

请添加图片描述

2.开启xpack,在yml添加下面配置
http.cors.allow-headers: Authorization,X-Requested-With,Content-Length,Content-Type
xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true
xpack.security.transport.ssl.verification_mode: certificate
  • 1
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值