1. 安装jdk
jdk1.8 windows + Linux
链接: https://pan.baidu.com/s/1uFAUbBthJ2H5Lrp1B6rGFg 提取码: 7vyp 复制这段内容后打开百度网盘手机App,操作更方便哦
设置环境变量
Linux系统同理
%变量名% 换成 ${变量名} 前面加export 空格
追加到 ~/.bash_profile
source ~/.bash_profile
2. 安装ElasticSearch
官方网站:
Download Elasticsearch | Elastic
Elastic search安装
解压
设定环境变量 ES_HOME
Run bin/elasticsearch
(or bin\elasticsearch.bat
on Windows)
Run curl http://localhost:9200/
or Invoke-RestMethod http://localhost:9200
with PowerShell
对于centos系统
下载速度慢 丢到后台运行, 等下载完了再安装rpm包
[sudo] password for mzh:
warning: elasticsearch-7.3.1-x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID d88e42b4: NOKEY
Preparing... ################################# [100%]
Creating elasticsearch group... OK
Creating elasticsearch user... OK
Updating / installing...
1:elasticsearch-0:7.3.1-1 ################################# [100%]
### NOT starting on installation, please execute the following statements to configure elasticsearch service to start automatically using systemd
sudo systemctl daemon-reload
sudo systemctl enable elasticsearch.service
### You can start elasticsearch service by executing
sudo systemctl start elasticsearch.service
Created elasticsearch keystore in /etc/elasticsearch
启用服务
Created symlink from /etc/systemd/system/multi-user.target.wants/elasticsearch.service to /usr/lib/systemd/system/elasticsearch.service.
启动服务
$ sudo lsof -i:9200
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 19911 elasticsearch 215u IPv4 16574917 0t0 TCP localhost:wap-wsp (LISTEN)
$ curl http://127.0.0.1:9200
{
"name" : "iz2ze5rptd09gfzl0jpc3gz",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "2JYYeBQlTL6EmPAbeBkN_w",
"version" : {
"number" : "7.3.1",
"build_flavor" : "default",
"build_type" : "rpm",
"build_hash" : "4749ba6",
"build_date" : "2019-08-19T20:19:25.651794Z",
"build_snapshot" : false,
"lucene_version" : "8.1.0",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
修改配置文件之后重新加载
停掉服务 service elasticsearch stop
可以不用rpm安装包安装
Download the Elasticsearch archive for your OS:
Linux: elasticsearch-7.3.1-linux-x86_64.tar.gz
macOS: elasticsearch-7.3.1-darwin-x86_64.tar.gz
Windows: elasticsearch-7.3.1-windows-x86_64.zip
Extract the archive:
Linux:
macOS:
Windows PowerShell:
解压之后放到 /opt/elasticsearch/7.3.1
创建data目录并让当前用户可以读写
Start two more instances of Elasticsearch so you can see how a typical multi-node cluster behaves. You need to specify unique data and log paths for each node.
Linux and macOS:
查看服务启动:
$ curl http://127.0.0.1:9200
{
"name" : "iz2ze5rptd09gfzl0jpc3gz",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "qD209wn-SNaG5saFoERMMw",
"version" : {
"number" : "7.3.1",
"build_flavor" : "default",
"build_type" : "tar", // 不是用的rpm包
"build_hash" : "4749ba6",
"build_date" : "2019-08-19T20:19:25.651794Z",
"build_snapshot" : false,
"lucene_version" : "8.1.0",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
$ curl http://127.0.0.1:9200/_cat/health?v
epoch timestamp cluster status node.total node.data shards pri relo init unassign pending_tasks max_task_wait_time active_shards_percent
1567049951 03:39:11 elasticsearch green 3 3 0 0 0 0 0 0 - 100.0%
官方介绍文档:
What is Elasticsearch? | Elasticsearch Guide [8.12] | Elastic
腾讯云实验室
腾讯云 - 值得信赖