ES简介
安装部署
在所有节点上分别安装elasticsearch
https://elasticsearch.cn/download/
修改主配置文件 https://elasticsearch.cn/download/
vim /etc/elasticsearch/elasticsearch.yml
cluster.name: my-es
node.name: server4
path.data: /var/lib/elasticsearch
path.logs: /var/log/elasticsearch
bootstrap.memory_lock: true
network.host: 172.25.52.4
http.port: 9200
discovery.seed_hosts: ["server4", "server5", "server6"]
cluster.initial_master_nodes: ["server4"]
修改内存限制
vim /etc/elasticsearch/jvm.options
-Xms500m
-Xmx500m
修改系统限制
vim /etc/security/limits.conf
elasticsearch soft memlock unlimited
elasticsearch hard memlock unlimited
elasticsearch - nofile 65536
elasticsearch - nproc 4096
修改systemd启动文件
vim /usr/lib/systemd/system/elasticsearch.service
[Service]
LimitMEMLOCK=infinity
重新加载启动
systemctl daemon-reload
systemctl start elasticsearch
监控插件安装
cerebro
拉取镜像
podman pull docker.io/lmenezes/cerebro:latest
或直接导入离线包
podman load -i /mnt/cerebro.tar
设置后台运行和端口映射,运行容器
podman run -d --name cerebro -p 9000:9000 lmenezes/cerebro
登陆本机9000端口,连接el 服务器
elasticsearch插件
安装所需的解压工具
yum install -y unzip
yum install -y bzip2
安装nodejs
wget https://mirrors.tuna.tsinghua.edu.cn/nodesource/rpm_9.x/el/7/x86_64/nodejs-9.11.2-1nodesource.x86_64.rpm
rpm -ivh nodejs-9.11.2-1nodesource.x86_64.rpm
下载解压插件包
wget https://github.com/mobz/elasticsearch-head/archive/master.zip
unzip elasticsearch-head-master.zip
更换为国内源
cd elasticsearch-head-master/
npm install -g cnpm --registry=https://registry.npm.taobao.org
修改es的配置文件,向其中添加域名支持
vim /etc/elasticsearch/elasticsearch.yml
systemctl restart elasticsearch.service
http.cors.enabled: true # 打开跨域支持
http.cors.allow-origin: "*" # 支持所有域名
访问插件,默认监听9100端口
|