環(huán)境準備
1. 安裝 JDK荔烧,版本 1.8 以上
2. 下載elasticsearch7.3.0安裝包
3. 創(chuàng)建ES賬號做盅,elasticsearch禁止使用root用戶啟動
4. 關(guān)閉防火墻或者開放elasticsearch服務(wù)所監(jiān)聽的端口9200、9300
開始安裝
增加用戶
#useradd es
#passwd es
上傳安裝包至服務(wù)器,解壓至指定目錄
tar -zxvf elasticsearch-7.3.0-linux-x86_64.tar.gz -C /usr/local
更改elasticsearch文件夾及子目錄下所有文件(夾)所屬的用戶和組
chown -R es:es /usr/local/elasticsearch-7.3.0/
進入elasticsearch安裝目錄
cd?/usr/local/elasticsearch-7.3.0/
修改config/elasticsearch.yml文件
node.name: node-1
network.host: 0.0.0.0
cluster.initial_master_nodes: ["node-1"]
#新增,支持跨域
http.cors.enabled: true
http.cors.allow-origin: "*"
修改config/jvm.options參數(shù)
#根據(jù)實際需要進行修改
-Xms1g
-Xmx1g
修改Linux系統(tǒng)參數(shù)設(shè)置
最大虛擬內(nèi)存區(qū)域
#sysctl -w vm.max_map_count=655360
文件描述符
#vi /etc/security/limits.conf
* soft nofile 131072
* hard nofile 131072
* soft nproc 131072
* hard nproc 131072
* soft core unlimited
* hard core unlimited
* soft memlock 50000000
* hard memlock 50000000
啟動elasticsearch
#su es
#bin/elasticsearch
驗證是否啟動成功
打開新的命令終端,輸入curl 127.0.0.1:9200蝶桶,出現(xiàn)如下說明啟動成功
{
? "name" : "node-1",
? "cluster_name" : "elasticsearch",
? "cluster_uuid" : "1KDcMeaWTXmJw4Y6KOp9VQ",
? "version" : {
? ? "number" : "7.3.0",
? ? "build_flavor" : "default",
? ? "build_type" : "tar",
? ? "build_hash" : "de777fa",
? ? "build_date" : "2019-07-24T18:30:11.767338Z",
? ? "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"
}