https://www.elastic.co/guide/index.html(推薦) ES官方英文原版文檔,一般會更新到最新版本
https://www.elastic.co/cn/downloads/ ES下載地址
https://www.cnblogs.com/zhuwenjoyce/p/10632628.html 安裝jdk1.8
下載 Elasticsearch6.7.0
cd /home/soft
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.7.0.tar.gz 建議離線下載elasticsearch
tar -zxvf elasticsearch-6.7.0.tar.gz 解壓
./bin/elasticsearch 嘗試啟動ES
備注: network.host: 0.0.0.0 如需遠程連接ES,需修改elasticsearch.yml,把其中的network.host改成0.0.0.0
不能以root用戶啟動 can not run elasticsearch as root
useradd elastic 新建linux用戶elastic
chown -R elastic:elastic elasticsearch-6.7.0 賦予elastic用戶和組讀寫es目錄權限
su elastic 從root用戶切換到elastic用戶
普通用戶獲取文件夾讀寫權限:
chmod 777 elasticsearch-6.7.0 賦予elastic用戶目錄所有權權限 或者加sudo命令:sudo chmod -R 777 elasticsearch-6.7.0 獲得sudo命令使用權的方法 https://www.cnblogs.com/zox2011/archive/2013/05/28/3103824.html
cd elasticsearch-6.7.0/ 進入ES目錄
./bin/elasticsearch 前台啟動es,ctrl + c 終止。
./bin/elasticsearch -d 后台啟動es,停止方法如下截圖:
es啟動和停止服務命令:
sudo systemctl daemon-reload
sudo systemctl enable elasticsearch.service
sudo systemctl start elasticsearch.service
驗證啟動成功: http://localhost:9200/?pretty
有用的URL
URL | |
http://192.168.10.110:9200/ | 基本信息 |
http://192.168.10.110:9200/_all/_search?pretty | 搜索引擎數據 |
http://192.168.10.110:9200/_xpack/security/_authenticate?pretty | 權限信息 |
http://192.168.10.110:9200/_license | 許可證信息 |
http://192.168.10.110:9200/_xpack | xpack信息 |
http://192.168.10.110:9200/_cluster/state?pretty | 集群信息 |
ES常見啟動錯誤
ES安裝目錄/logs/elasticsearch.log可以查看啟動日志。除了不能以root用戶啟動ES意外,還有3個常見啟動錯誤:
ERROR: [3] bootstrap checks failed [1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535] [2]: max number of threads [3766] for user [elastic] is too low, increase to at least [4096] [3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[1][2]兩個錯誤解決方法:
vim /etc/security/limits.conf
增加以下配置:
* soft nofile 65536 * hard nofile 65536 * soft nproc 4096 * hard nproc 4096
[3]解決方法:
vim /etc/sysctl.conf
vm.max_map_count=262144 增加這行配置
sysctl -p 重新生效配置文件sysctl.conf
cd ES安裝目錄
./bin/elasticsearch -d 后台啟動,注意不要使用root用戶啟動。
瀏覽器打開驗證:http://localhost:9200/_all/_search?pretty