elasticsearch 集群安装 + xpack + es-head + ik分词

一、安装前的准备
1.ip分配
在这里插入图片描述
2.修改文件句柄数 和 内核参数

# cat /etc/security/limits.conf	#在最后添加  需要重启机器 参数才能生效
*	soft	nproc	65535
*	hard	nproc	65535
*	soft	nofile	65536
*	hard	nofile	65536
*    soft    memlock    unlimited
*    hard    memlock    unlimited


# cat /etc/sysctl.conf 			#在最后添加
vm.max_map_count=655360

# sysctl -p

二、安装软件:安装过程中使用非root用户(wlsadmin)
1.jdk安装
安装链接:https://blog.csdn.net/sun_xuegang/article/details/86539449

2.es安装
(1)下载解压

# cd /cust/utils
# tar -zxvf elasticsearch-6.8.6.tar.gz

(2)创建ssl证书 并将证书复制到集群内其他机器

$ cd /cust/utils/elasticsearch-6.8.6
$ ./bin/elasticsearch-certgen		# 会生成一个certificate-bundle.zip文件  
$ unzip certificate-bundle.zip		# 解压后会生成ca 和 elasticsearch文件
$ ls
bin  ca  certificate-bundle.zip  config  elasticsearch  lib  LICENSE.txt  logs  modules  NOTICE.txt  plugins  README.textile
$ cp ca/* elasticsearch/* config/

# 将证书拷贝到集群其他机器
$ scp ca/* elasticsearch/* wlsadmin@192.168.19.202:/cust/utils/elasticsearch-6.8.6/config/
$ scp ca/* elasticsearch/* wlsadmin@192.168.19.203:/cust/utils/elasticsearch-6.8.6/config/

创建证书
(3)修改配置

$ cat config/elasticsearch.yml |grep -v ^# |grep -v ^$
cluster.name: elasticsearch
node.name: node1			# 其他机器需要修改
path.data: /cust/data/elasticsearch
path.logs: /cust/logs/elasticsearch
network.host: 192.168.19.201
http.port: 9200
transport.tcp.port: 9300
discovery.zen.ping.unicast.hosts: ["192.168.19.201", "192.168.19.202", "192.168.19.203"]
discovery.zen.minimum_master_nodes: 2

#ssl
xpack.security.transport.ssl.enabled: true
xpack.security.enabled: true
xpack.ssl.key: elasticsearch.key
xpack.ssl.certificate: elasticsearch.crt
xpack.ssl.certificate_authorities: ca.crt

# es-head
http.cors.enabled: true
http.cors.allow-origin: '*'
http.cors.allow-headers: Authorization,X-Requested-With,Content-Length,Content-Type


$ mkdir /cust/data/elasticsearch /cust/logs/elasticsearch -p		#创建数据目录 日志目录

(4)启动es

$ ./bin/elasticsearch -d
$ netstat -lntp

(5)创建认证用户 以及验证

$ ./bin/elasticsearch-setup-passwords interactive		#设置密码
$ curl -u elastic:123456 192.168.19.201:9200/_cluster/health?pretty
$ curl -u elastic:123456 192.168.19.201:9200/_cat/nodes?pretty

创建授权用户
查看集群状态
3.es-head安装
(1)安装noodejs

$ tar xf node-v12.16.1-linux-x64.tar.xz
$ cat ~/.bash_profile 		#加入Node环境变量 

NODE_HOME="/cust/utils/node-v12.16.1-linux-x64"
PATH=$PATH:$HOME/.local/bin:$HOME/bin:$NODE_HOME/bin
export PATH NODE_HOME

$ . ~/.bash_profile

(2)解压 修改配置

$ tar zxvf elasticsearch-head.tar.gz
$ cd /cust/utils/elasticsearch-head

$ vim _site/app.js		# 搜索app-base_uri  将 4374 行 最后一段改为 集群ip    http://192.168.19.201:9200

(3)启动

$ cd /cust/utils/elasticsearch-head/node_modules/grunt/bin/
$ ./grunt server &

(4)访问地址

http://192.168.19.201:9100/?auth_user=elastic&auth_password=123456

es-head访问界面4.ik分词插件安装
插件地址:https://github.com/medcl/elasticsearch-analysis-ik/releases/tag/v6.8.6

#(1) 下载 解压 
# cd  /cust/utils/elasticsearch-6.8.6/plugins
# mkdir ik; cd ik
# wget https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v6.8.6/elasticsearch-analysis-ik-6.8.6.zip

# unzip elasticsearch-analysis-ik-6.8.6.zip
# rm -rf elasticsearch-analysis-ik-6.8.6.zip

#(2)重启es

#(3)验证如下图  这是后来搭建的es集群  ip 端口注意

在这里插入图片描述在这里插入图片描述

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

sun_xuegang

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值