https://www.elastic.co/guide/index.html(推薦) ES官方英文原版文檔,通常會更新到最新版本html
https://www.elastic.co/cn/downloads/ ES下載地址linux
http://www.javashuo.com/article/p-ubbuyuqc-kc.html 安裝jdk1.8bootstrap
下載 Elasticsearch6.7.0vim
cd /home/soft瀏覽器
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.7.0.tar.gz 建議離線下載elasticsearchelasticsearch
tar -zxvf elasticsearch-6.7.0.tar.gz 解壓ide
./bin/elasticsearch 嘗試啓動ESui
備註: network.host: 0.0.0.0 如需遠程鏈接ES,需修改elasticsearch.yml,把其中的network.host改爲0.0.0.0搜索引擎
不能以root用戶啓動 can not run elasticsearch as root 3d
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