注意:安装前要确定系统安装了JDK8环境
官网下载地址:https://www.elastic.co/cn/downloads/?elektra=home&storm=hero
下面我将 elasticsearch 简称为 es 哈
#创建soft目录
mkdir soft
#解压elasticsearch-8.5.3-linux-x86_64.tar.gz
tar -zxvf elasticsearch-8.5.3-linux-x86_64.tar.gz
#解压的es目录移动到 soft 目录下
mv elasticsearch-8.5.3 soft/
#切换到es目录下
cd /opt/soft/elasticsearch-8.5.3
#新建data和logs目录
mkdir data
mkdir logs
#创建用户组与用户
groupadd es
useradd es -g es -p es
#给es目录授权
chown -R es:es /opt/soft/elasticsearch-8.5.3/
vim /etc/security/limits.conf
添加以下内容
* hard nofile 65536
* soft nofile 131072
* hard nproc 4096
* soft nproc 4096
vim /etc/sysctl.conf
添加
fs.file-max=655360
vm.max_map_count=655360
/sbin/sysctl -p
配置如下
我虚拟机中三个centos系统IP是:192.168.29.188 , 192.168.29.189 , 192.168.29.190;你们根据自己系统IP修改哈
#集群名称
cluster.name: my-app
#节点名称
node.name: node-1
#节点角色
node.roles: [master,data]
path.data: /opt/soft/elasticsearch-8.5.3/data
path.logs: /opt/soft/elasticsearch-8.5.3/logs
#绑定的IP
network.host: 192.168.29.188
#暴露的http端口
http.port: 9200
#使用head等插件监控集群信息,需要打开以下配置项
http.cors.allow-origin: "*"
http.cors.enabled: true
http.max_content_length: 200mb
#集群成员
discovery.seed_hosts: ["192.168.29.188:9300","192.168.29.189:9300","192.168.29.190:9300"]
cluster.initial_master_nodes: ["node-1"]
# 注意这里改成false
xpack.security.enabled: false
xpack.security.enrollment.enabled: true
# 注意这里改成false
xpack.security.http.ssl:
enabled: false
keystore.path: certs/http.p12
# 注意这里改成false
xpack.security.transport.ssl:
enabled: false
verification_mode: certificate
keystore.path: certs/transport.p12
truststore.path: certs/transport.p12
完整配置如下
# ======================== Elasticsearch Configuration =========================
#
# NOTE: Elasticsearch comes with reasonable defaults for most settings.
# Before you set out to tweak and tune the configuration, make sure you
# understand what are you trying to accomplish and the consequences.
#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.
#
# Please consult the documentation for further information on configuration options:
# https://www.elastic.co/guide/en/elasticsearch/reference/index.html
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
cluster.name: my-app
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
node.name: node-1
node.roles: [master,data]
#
# Add custom attributes to the node:
#
#node.attr.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
path.data: /opt/soft/elasticsearch-8.5.3/data
#
# Path to log files:
#
path.logs: /opt/soft/elasticsearch-8.5.3/logs
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
#bootstrap.memory_lock: true
#
# Make sure that the heap size is set to about half the memory available
# on the system and that the owner of the process is allowed to use this
# limit.
#
# Elasticsearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# By default Elasticsearch is only accessible on localhost. Set a different
# address here to expose this node on the network:
#
network.host: 192.168.29.188
#
# By default Elasticsearch listens for HTTP traffic on the first free port it
# finds starting at 9200. Set a specific HTTP port here:
#
http.port: 9200
http.cors.allow-origin: "*"
http.cors.enabled: true
http.max_content_length: 200mb
#
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when this node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
discovery.seed_hosts: ["192.168.29.188:9300","192.168.29.189:9300","192.168.29.190:9300"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
cluster.initial_master_nodes: ["node-1"]
#
# For more information, consult the discovery and cluster formation module documentation.
#
# --------------------------------- Readiness ----------------------------------
#
# Enable an unauthenticated TCP readiness endpoint on localhost
#
#readiness.port: 9399
#
# ---------------------------------- Various -----------------------------------
#
# Allow wildcard deletion of indices:
#
#action.destructive_requires_name: false
#----------------------- BEGIN SECURITY AUTO CONFIGURATION -----------------------
#
# The following settings, TLS certificates, and keys have been automatically
# generated to configure Elasticsearch security features on 12-01-2023 02:34:39
#
# --------------------------------------------------------------------------------
# Enable security features
xpack.security.enabled: false
xpack.security.enrollment.enabled: true
# Enable encryption for HTTP API client connections, such as Kibana, Logstash, and Agents
xpack.security.http.ssl:
enabled: false
keystore.path: certs/http.p12
# Enable encryption and mutual authentication between cluster nodes
xpack.security.transport.ssl:
enabled: false
verification_mode: certificate
keystore.path: certs/transport.p12
truststore.path: certs/transport.p12
#----------------------- END SECURITY AUTO CONFIGURATION ------------------------
-Xms512m
-Xmx512m
切换到es用户
su es
进入es目录下bin目录下执行指令
./elasticsearch -d
浏览器访问 IP:9200
访问成功
ps -ef | grep elasticsearch
kill -9 1823
scp -r /opt/soft/elasticsearch-8.5.3 [email protected]:/opt/soft/elasticsearch-8.5.3
scp -r /opt/soft/elasticsearch-8.5.3 [email protected]:/opt/soft/elasticsearch-8.5.3
只需修改以下部分
node.name: node-2
network.host: 192.168.29.189
节点三亦是如此
node.name: node-3
network.host: 192.168.29.190
启动系统二三的es
浏览输入(换成你的IP):http://192.168.29.188:9200/_cat/nodes
浏览器显示三个节点
解压压缩包
tar -zxvf kibana-8.5.3-linux-x86_64.tar.gz
移动到 /opt/soft 目录下
mv kibana-8.5.3 soft/
授权
chown -R es:es kibana-8.5.3/
切换到es用户
su es
修改 kibana-8.5.3 目录下 config 目录下 kibana.yml 文件
server.port: 5601
server.host: "192.168.29.188"
elasticsearch.hosts: ["http://192.168.29.188:9200","http://192.168.29.189:9200","http://192.168.29.190:9200"]
i18n.locale: "zh-CN"
进入kibana目录,启动kibana
nohup ./bin/kibana > kibana.log 2>&1 &
浏览器输入:http://192.168.29.188:5601/
看到如上界面,即安装启动成功
netstat -tunlp | grep 5601
#1953是进程号 看上截图
kill -9 1953