赞
踩
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.17.5-linux-x86_64.tar.gz
[root@elk94 ~]# useradd -u 2024 -m guobaorou
[root@elk94 ~]# mkdir -pv /es/{softwares,data,logs}
[root@elk94 ~]# tar xf elasticsearch-7.17.5-linux-x86_64.tar.gz -C /es/softwares/
[root@elk94 ~]# cd /es/softwares/ && ln -svf elasticsearch-7.17.5 elasticsearch
温馨提示:下面grep过滤出来的是文件中已修改的参数和配置
[root@elk94 ~]# grep ^[a-z] /es/softwares/elasticsearch/config/elasticsearch.yml
cluster.name: guobaorou
path.data: /es/data/es7
path.logs: /es/logs/es7
network.host: 0.0.0.0
http.port: 9200
discovery.seed_hosts: ["10.0.0.94"]
cluster.initial_master_nodes: ["10.0.0.94"]
参数说明:
cluster.name: 指定ES集群名称
path.data: 指定数据目录。
path.logs: 指定日志目录。
network.host: 指定监听的地址。
discovery.seed_hosts: 当前集群的地址列表。
cluster.initial_master_nodes: 指定集群的master选举列表。
install -d /es/{logs,data}/es7 -o guobaorou -g guobaorou
chown guobaorou:guobaorou -R /es/softwares/elasticsearch/*
cat > /etc/sysctl.d/es.conf <<EOF
vm.max_map_count=262144
EOF
sysctl -p /etc/sysctl.d/es.conf
cat > /etc/profile.d/elk.sh <<'EOF'
#!/bin/bash
export ES_HOME=/es/softwares/elasticsearch
export PATH=$PATH:$ES_HOME/bin
EOF
source /etc/profile.d/elk.sh
su - guobaorou -c "elasticsearch -d"
[root@elk94 ~]# curl 10.0.0.94:9200
{
"name" : "elk94",
"cluster_name" : "guobaorou",
"cluster_uuid" : "p_iibBNhQjm1s1QaMicJng",
"version" : {
"number" : "7.17.5",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "8d61b4f7ddf931f219e3745f295ed2bbc50c8e84",
"build_date" : "2022-06-23T21:57:28.736740635Z",
"build_snapshot" : false,
"lucene_version" : "8.11.1",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
[root@elk94 ~]# curl 10.0.0.94:9200/_cat/nodes
10.0.0.94 cdfhilmrstw * elk94
[root@elk94 ~]# kill `ps -ef | grep java | grep -v grep | awk '{print $2}'`
[root@elk94 ~]#
[root@elk94 ~]# cat > /usr/lib/systemd/system/es7.service <<EOF
[Service]
User=guobaorou
LimitNOFILE=131070
LimitNPROC=8192
ExecStart=/es/softwares/elasticsearch/bin/elasticsearch
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable --now es7
systemctl status es7
温馨提示:
如果你的集群不正常工作,执行如下操作
(1)集群所有节点停止服务
pkill java
(2)确保停止服务完成,可以执行"ss -ntl"查看监听端口是否存在或者是查看java
ss -ntl
ps -ef | grep java
(3)删除集群默认的数据
rm -rf /es/{logs,data}/es7/* /tmp/*
(4)重新启动集群即可
su - guobaorou -c "elasticsearch -d"
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。