项目ElasticSearch 7.5 安装配置

前言:

ElasticSearch 7.5默认自带x-pack认证,开启后可提高集群安全性。

配置文件位置:

    程序配置文件:/etc/elasticsearch/elasticsearch.yml

    jvm配置文件:/etc/elasticsearch/jvm.options

1.  确认基础环境

确认主机limit相关参数

grep vm.max_map_count /etc/sysctl.conf && sed -i "s@vm.max_map_count.*@vm.max_map_count=655360@g" /etc/sysctl.conf || echo 'vm.max_map_count=655360' >>/etc/sysctl.conf

sysctl -p 

确认主机无其他ElasticSearch软件包

rpm -qa | grep elasticsearch >/dev/null && echo exists || echo yes#执行此命令输出为yes即可

2. 使用YUM源进行安装

yum install jdk1.8.0_131 -y

yum install elasticsearch-7.5.2 -y

3. 修改配置

修改cluster.name配置

修改network.host配置为0.0.0.0

修改cluster.initial_master_nodes为本机提供服务的IP

修改gateway.recover_after_nodes为1

4. 设置密码

修改配置文件,增加配置,开启认证

http.cors.enabled: true
http.cors.allow-origin: "*"
http.cors.allow-headers: Authorization
xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true

5. 安装IK分词

/usr/share/elasticsearch/bin/elasticsearch-plugin install file:///root/elasticsearch-analysis-ik-7.5.2.zip

由于elastic官方未提供ik分词插件,需下载插件进行安装。下载地址为https://web.chinamcloud.com/k8s/ik/elasticsearch-analysis-ik-7.5.2.zip

wget https://web.chinamcloud.com/k8s/ik/elasticsearch-analysis-ik-7.5.2.zip

https://web.chinamcloud.com/k8s/ik/elasticsearch-analysis-ik-7.5.2.zip

6.启动服务:

systemctl start elasticsearch

systemctl enable elasticsearch

7. 初始化elastic用户密码(根据提示输入对应用户密码)

/usr/share/elasticsearch/bin/elasticsearch-setup-passwords interactive

8. 单点配置文件实例(/etc/elasticsearch/elasticsearch.yml)

cluster.name: elasticsearch

node.name: master

path.data: /var/lib/elasticsearch

path.logs: /var/log/elasticsearch

bootstrap.memory_lock: false

network.host: 0.0.0.0

http.port: 9200

discovery.seed_hosts: ["master"]

cluster.initial_master_nodes: ["master"]

node.master: true

node.data: true

node.ingest: true

http.cors.enabled: true

http.cors.allow-origin: "*"

indices.fielddata.cache.size: 30%

cluster.max_shards_per_node: 50000

 

启用x-pack认证后,认证问题:

​
wget http://web.chinamcloud.com/elasticsearch/x-pack-core-7.5.2.jar     破解后得jar文件

cp x-pack-core-7.5.2.jar /usr/share/elasticsearch/modules/x-pack-core/    覆盖原有文件

systemctl restart elasticsearch

curl http://172.19.30.46:9200/_xpack/license --user elastic:密码  

​

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值