单点部署ElasticSearch

单点部署ES

1.什么是ElasticSearch

Elasticsearch 是一个分布式、RESTful 风格的搜索和数据分析引擎,能够解决不断涌现出的各种用例。

作为 Elastic Stack 的核心,Elasticsearch 会集中存储您的数据,让您飞快完成搜索,微调相关性,进行强大的分析,并轻松缩放规模。

说白了,ES的核心作用就是存储数据和快速进行模糊查询。

2.下载部署ES软件包

官网地址:https://www.elastic.co/

下载页面:https://www.elastic.co/downloads/past-releases/elasticsearch-7-17-23

1.在Ubuntu系统下载使用下面的命令
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.17.23-amd64.deb

2.安装软件包
dpkg -i elasticsearch-7.17.22-amd64.deb

3.修改配置文件
root@elk91:~# egrep -v "^#|^$" /etc/elasticsearch/elasticsearch.yml
cluster.name: Linu93
path.data: /var/lib/elasticsearch
path.logs: /var/log/elasticsearch
network.host: 0.0.0.0
http.port: 9200
transport.port: 9300
discovery.type: single-node
(注释:可以复制我过滤出来的内容,直接追加到elasticsearch.yml文件里)
---------------------------------
上面相关参数说明:
	cluster.name: 
		指定ES集群的名称
	path.data: 
		指定数据目录
	path.logs: 
		指定日志目录
	network.host: 
		指定宿主机的监听IP。
	http.port: 9200
		对外提供http|https接口的端口。
	transport.port: 9300
		集群内部数据传输的端口,会优先启动该端口选举master后在启动9200端口。
	discovery.type: 
		指定ES集群的类型,single-node表示的是单点。

4.启动ES服务
root@elk91:~# systemctl enable --now elasticsearch.service 

5.检查监听的端口号
root@elk91:~# ss -lntup|egrep "9200|9300"
tcp   LISTEN 0      4096               *:9200            *:*    users:(("java",pid=1598,fd=293))         
tcp   LISTEN 0      4096               *:9300            *:*    users:(("java",pid=1598,fd=291))       

6.测试访问
[root@elk93 ~]# curl 10.0.0.91:9200
{
  "name" : "elk91",
  "cluster_name" : "oldboyedu-linux93",
  "cluster_uuid" : "rYh3jwB7SFu0MKTiwCfOwQ",
  "version" : {
    "number" : "7.17.22",
    "build_flavor" : "default",
    "build_type" : "deb",
    "build_hash" : "38e9ca2e81304a821c50862dafab089ca863944b",
    "build_date" : "2024-06-06T07:35:17.876121680Z",
    "build_snapshot" : false,
    "lucene_version" : "8.11.3",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}
[root@elk93 ~]# 
[root@elk93 ~]# 
[root@elk93 ~]# curl 10.0.0.91:9200/_cat/nodes
10.0.0.91 15 97 12 0.24 0.19 0.08 cdfhilmrstw * elk91
[root@elk93 ~]# 
[root@elk93 ~]# curl 10.0.0.91:9200/_cat/nodes?v
ip        heap.percent ram.percent cpu load_1m load_5m load_15m node.role   master name
10.0.0.91           15          97   0    0.22    0.18     0.08 cdfhilmrstw *      elk91

3.ES服务卸载

	1.停止ES服务
[root@elk91 ~]# systemctl disable --now elasticsearch.service 

	2.删除数据
[root@elk91 ~]# \rm -rf  /var/{lib,log}/elasticsearch/ /tmp/*  /etc/elasticsearch

	3.删除软件
[root@elk91 ~]# dpkg -r elasticsearch 
[root@elk91 ~]#
[root@elk91 ~]# rm -f elasticsearch-7.17.22-amd64.deb 
posted @ 2024-12-02 16:53  无聊点  阅读(121)  评论(0)    收藏  举报