Elasticsearch专栏-2.es环境安装

安装说明

  1. 下文会解释es、kibana、中文分词ik的安装,es的安装又会分为单机和集群版。
  2. es和kibana的版本号要一样。
  3. 官网上的安装包下载很慢,部分组件会选择华为云镜像作为下载源。
组件版本下载地址
es7.14.0https://mirrors.huaweicloud.com/elasticsearch/7.14.0/
kibana7.14.0https://repo.huaweicloud.com/kibana/7.14.0/
ik8.1.0https://github.com/medcl/elasticsearch-analysis-ik

单机部署

解压安装、添加es专用用户

tar -zxvf elasticsearch-7.14.0-linux-x86_64.tar.gz
mv elasticsearch-7.14.0 elasticsearch
mv elasticsearch /home/
cd /home/
groupadd esgroup
useradd esuser -g esgroup -p espwd
chown -R esuser.esgroup elasticsearch

修改配置文件

vim elasticsearch.yml,添加如下内容

cluster.name: es-cluster
node.name: node-2
network.host: 192.168.88.207
http.port: 9200
cluster.initial_master_nodes: ["node-2"]
ingest.geoip.downloader.enabled: false
xpack.security.enabled: false

修改系统配置

1.vim /etc/sysctl.conf,添加如下内容

net.core.somaxconn = 20000
vm.max_map_count=655360

执行:sysctl -p,使其生效。

2.执行下面命令,修改/etc/security/limits.conf

echo '*    soft    nofile    65535' >>/etc/security/limits.conf
echo '*    hard    nofile    65535' >>/etc/security/limits.conf
echo '*    soft    nproc    65535' >>/etc/security/limits.conf
echo '*    hard    nproc    65535' >>/etc/security/limits.conf

关闭防火墙(或放行9200端口)

service  firewalld stop
或
firewall-cmd --zone=public --add-port=9200/tcp --permanent 
firewall-cmd --reload

切换用户

su esuser

后台启动

./elasticsearch -d

可以先直接启动./elasticsearch,没有问题后在切换后台运行

集群部署

集群部署说明

  1. 集群部署和单机部署过程一样,只是配置文件内容不同。本次集群按三个节点部署。
  2. 默认tcp通信端口是9300,如果是不同机器上,transport.port可以去掉,discovery.seed_hosts不用填写端口,即:discovery.seed_hosts: [“192.168.88.207”,“192.168.88.207”,“192.168.88.207”]
  3. 下文只罗列集群中不同节点的配置文件内容,节点部署过程参考上述单机过程,略。

在一台机器上

三个节点的配置文件内容分别如下

node1:
	cluster.name: es-cluster-test
	node.name: node-1
	node.master: true
	node.data: true
	network.host: 192.168.88.207
	http.port: 9200
	transport.port: 9300
	discovery.seed_hosts: ["192.168.88.207:9300","192.168.88.207:9301","192.168.88.207:9302"]
	cluster.initial_master_nodes: ["node-1"]
	ingest.geoip.downloader.enabled: false
	xpack.security.enabled: false
node2:
	cluster.name: es-cluster-test
	node.name: node-2
	node.master: true
	node.data: true
	network.host: 192.168.88.207
	http.port: 9201
	transport.port: 9301
	discovery.seed_hosts: ["192.168.88.207:9300","192.168.88.207:9301","192.168.88.207:9302"]
	cluster.initial_master_nodes: ["node-1"]
	ingest.geoip.downloader.enabled: false
	xpack.security.enabled: false	
node3:
	cluster.name: es-cluster-test
	node.name: node-3
	node.master: true
	node.data: true
	network.host: 192.168.88.207
	http.port: 9202
	transport.port: 9302
	discovery.seed_hosts: ["192.168.88.207:9300","192.168.88.207:9301","192.168.88.207:9302"]
	cluster.initial_master_nodes: ["node-1"]
	ingest.geoip.downloader.enabled: false
	xpack.security.enabled: false

在三台机器上

三个节点的配置文件内容分别如下

node1:
	cluster.name: es-cluster-test
	node.name: node-1
	node.master: true
	node.data: true
	network.host: 192.168.88.207
	http.port: 9200
	transport.port: 9300
	discovery.seed_hosts: ["192.168.88.207:9300","192.168.88.207:9301","192.168.88.207:9302"]
	cluster.initial_master_nodes: ["node-1"]
	ingest.geoip.downloader.enabled: false
	xpack.security.enabled: false
node2:
	cluster.name: es-cluster-test
	node.name: node-2
	node.master: true
	node.data: true
	network.host: 192.168.88.207
	http.port: 9201
	transport.port: 9301
	discovery.seed_hosts: ["192.168.88.207:9300","192.168.88.207:9301","192.168.88.207:9302"]
	cluster.initial_master_nodes: ["node-1"]
	ingest.geoip.downloader.enabled: false
	xpack.security.enabled: false	
node3:
	cluster.name: es-cluster-test
	node.name: node-3
	node.master: true
	node.data: true
	network.host: 192.168.88.207
	http.port: 9202
	transport.port: 9302
	discovery.seed_hosts: ["192.168.88.207:9300","192.168.88.207:9301","192.168.88.207:9302"]
	cluster.initial_master_nodes: ["node-1"]
	ingest.geoip.downloader.enabled: false
	xpack.security.enabled: false

kibana部署

解压安装

tar -zxvf kibana-7.14.0-linux-x86_64.tar.gz
mv kibana-7.14.0-linux-x86_64 kibana
mv kibana /home/
cd /home
chown -R esuser.esgroup kibana/

修改配置文件

vim kibana.yml

server.port: 5601
server.host: "192.168.88.207"
server.name: "kibana207"
elasticsearch.hosts: ["http://192.168.88.207:9200"]

切换用户

su esuser

后台启动

nohup ./kibana &

ik部署

  1. 安装和使用见文档:https://github.com/medcl/elasticsearch-analysis-ik
  2. 如果报版本不一致问题,可以先离线下载zip包。然后解压后将配置文件中的版本号改掉,改成实际es版本即可。vim plugin-descriptor.properties,elasticsearch.version=7.14.0。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值