Centos7部署Elasticsearch7.17.0-单机版
yum -y install java nano (必须使用YUM安装java)
useradd es
mkdir -p /data/elasticsearch/data
mkdir -p /data/elasticsearch/log
cd /data
chown es:es -R ./elasticsearch
修改系统文件:
[root@node-2 ~]# nano /etc/security/limits.conf 在末尾加上:
es soft nofile 65536
es hard nofile 65536
es soft nproc 4096
es hard nproc 4096
[root@node-2 ~]# nano /etc/security/limits.d/20-nproc.conf 在末尾加上:
es soft nofile 65536
es hard nofile 65536
* hard nproc 4096
[root@node-2 ~]# cat /etc/sysctl.conf 在末尾加上:
vm.max_map_count = 655360
执行命令:sysctl -p 生效
=================================================================================
cd /opt/
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.17.1-linux-x86_64.tar.gz
tar -zxvf elasticsearch-7.17.1-linux-x86_64.tar.gz
chown -R es:es elasticsearch-7.17.1/
切换ES用户
su - es
cd /opt/elasticsearch-7.17.1/config
mv elasticsearch.yml elasticsearch.yml-bak
vim elasticsearch.yml
cluster.name: elk7
node.name: node-2
path.data: /data/elasticsearch/data
path.logs: /data/elasticsearch/log
network.host: 0.0.0.0
http.port: 9200
transport.tcp.port: 9300
discovery.seed_hosts: ["172.26.200.151"]
cluster.initial_master_nodes: ["172.26.200.151"]
http.cors.enabled: true
http.cors.allow-origin: "*"
修改ES启动内存
vim jvm.options
-Xms4g
-Xmx4g
[es@node-2 config]$ ./bin/elasticsearch 前台启动看有没有报错,端口9200,9300
后台启动:
[es@node-2 config]$ sh ../bin/elasticsearch -d
验证:
[root@node-2 ~]# curl localhost:9200
{
"name" : "node-2",
"cluster_name" : "elk7",
"cluster_uuid" : "_na_",
"version" : {
"number" : "7.17.1",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "e5acb99f822233d62d6444ce45a4543dc1c8059a",
"build_date" : "2022-02-23T22:20:54.153567231Z",
"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"
}
======================================================================
配置密码校验:
nano elasticsearch.yml 配置文件新增2行:
xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true
生成证书文件(设置密码用):
cd /opt/elasticsearch-7.17.1/bin
./elasticsearch-certutil cert -out config/elastic-certificates.p12 -pass ""
重启ES
cd /data/elasticsearch-7.5.0/bin
./elasticsearch -d
设置密码:./elasticsearch-setup-passwords interactive 全部密码设置一样即可
账号:elastic
================================================================
如果报错:fetching geoip databases overview from [https://geoip.elastic.co/v1/database?elastic_geoip_service_tos=agree]
可以关闭 geoip解决:
elasticsearch.yml配置文件加一句:
ingest.geoip.downloader.enabled: false
==========================================================================
ES添加为系统服务:
vim /usr/lib/systemd/system/elasticsearch.service
[Unit]
Description=elasticsearch
[Service]
LimitNOFILE=100000
LimitNPROC=100000
ExecStart=/opt/elasticsearch-7.17.1/bin/elasticsearch
User=es
Group=es
[Install]
WantedBy=multi-user.target
赋予执行权限:
chmod +x /usr/lib/systemd/system/elasticsearch.service
systemctl daemon-reload
systemctl enable elasticsearch
systemctl start elasticsearch
systemctl status elasticsearch
=========================================================================
- 感谢你赐予我前进的力量
赞赏者名单
因为你们的支持让我意识到写文章的价值🙏
本文是原创文章,采用CC BY-NC-ND 4.0协议,完整转载请注明来自 halo.taofile.cn。
评论
匿名评论
隐私政策
你无需删除空行,直接评论以获取最佳展示效果

