目录创建
mkdir -p /home/esuser/{data,logs}/elasticsearch
mkdir -p /home/esuser/{midware,software}
上传文件
将ES拼音插件压缩文件elasticsearch-analysis-pinyin-7.9.2.zip复制到/home/ esuser /software下
将ES分词插件压缩文件elasticsearch-analysis-ik-7.9.2.zip复制到/home/ esuser /software下
部署
-
解压文件
-
创建es安装目录
mkdir -p /opt/es
- 解压tar.gz包
tar -zxvf /home/esuser/software/elasticsearch-7.9.2-linux-x86_64.tar.gz -C /opt/es/
mkdir -p /opt/es/elasticsearch-7.9.2/plugins/{ik,pinyin}
unzip /home/esuser/software/elasticsearch-analysis-ik-7.9.2.zip -d /opt/es/elasticsearch-7.9.2/plugins/ik
unzip /home/esuser/software/elasticsearch-analysis-pinyin-7.9.2.zip -d /opt/es/elasticsearch-7.9.2/plugins/pinyin
- 修改配置文件
cd /opt/es/elasticsearch-7.9.2/config/
cp elasticsearch.yml elasticsearch.keystore
vim elasticsearch.yml
# ---------------------------------- Cluster -----------------------------------
#
# 集群名称
#
cluster.name: my-application
#
# ------------------------------------ Node ------------------------------------
#
# 节点名称
#
node.name: node-100
#
# Add custom attributes to the node:
#
#node.attr.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# ES数据存储目录:
#
path.data: /home/esuser/data/elasticsearch
#
# ES日志存储目录:
#
path.logs: /home/esuser/logs/elasticsearch
#
# ----------------------------------- 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 -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
network.host: 10.192.65.100
#
# Set a custom port for HTTP:
# HTTP端口号
http.port: 9200
# 提供的TCP客户端服务端口号
transport.tcp.port: 9300
#
# 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]"]
# ES集群发现ip和端口
discovery.seed_hosts: ["192.168.0.162:9300","192.168.0.163:9300","192.168.0.164:9300"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
# 初始化可参与master选举的节点
cluster.initial_master_nodes: ["192.168.0.162", "192.168.0.163","192.168.0.164"]
# 集群ping过程的超时等待时间
discovery.zen.ping_timeout: 120s
# 客户端连接节点超时时间
client.transport.ping_timeout: 60s
- 启动 Elasticsearch
/opt/es/elasticsearch-7.9.2/bin/elasticsearch –d
系统运维
- 启动 Elasticsearch
/opt/es/elasticsearch-7.9.2/bin/elasticsearch –d
- 查看 Elasticsearch 状态
ps -ef | grep elasticsearch
- 查看 Elasticsearch 集群状态
curl 'http://10.192.65.102:9200/_cat/health?v'
curl 'http:// 10.192.65.102:9200/_cluster/health/?pretty'
- 关闭 Elasticsearch
kill -9 进程号