1. 程式人生 > >ES的安裝

ES的安裝

下載地址

Elasticsearch官網: https://www.elastic.co/products/elasticsearch

安裝Elasticsearch(單節點Linux環境)

上傳安裝包

elasticsearch-5.2.2.tar.gz

elasticsearch-head-master.zip 圖形化介面外掛

node-v6.9.2-linux-x64.tar.gz 安裝圖形外掛必備的環境

解壓

[[email protected] software]# tar -zxvf elasticsearch-5.2.2.tar.gz -C /opt/module/

在/opt/module/elasticsearch-5.2.2路徑下建立data和logs資料夾

[[email protected] elasticsearch-5.2.2]# mkdir data
[[email protected] elasticsearch-5.2.2]# mkdir logs

修改配置檔案/opt/module/elasticsearch-5.2.2/config/elasticsearch.yml

	#配置叢集名稱,只要後面的節點名稱一樣會自動關聯到叢集
	cluster.name: my-application
	#
	# ------------------------------------ Node ------------------------------------
	#
	# Use a descriptive name for the node:
	#節點名稱
	node.name: testnote01
	#資料的儲存路徑
	path.data: /opt/module/elasticsearch-5.2.2/data
	
	#日誌的儲存路徑
	# Path to log files:
	#
	path.logs: /opt/module/elasticsearch-5.2.2/logs
	bootstrap.memory_lock: false
	bootstrap.system_call_filter: false
	
	network.host: 192.168.18.50
	discovery.zen.ping.unicast.hosts: ["testnote01"]

在這裡插入圖片描述
中間必須用空格,字型顏色發生變化

配置檔案引數解析:

(1)cluster.name

如果要配置叢集需要兩個節點上的elasticsearch配置的cluster.name相同,都啟動可以自動組成叢集,這裡如果不改cluster.name則預設是cluster.name=my-application

(2)nodename隨意取但是叢集內的各節點不能相同

(3)修改後的每行前面不能有空格,修改後的“:”後面必須有一個空格

配置linux系統環境(參考:http://blog.csdn.net/satiling/article/details/59697916)

root使用者下,編輯limits.conf 新增類似如下內容

 vi /etc/security/limits.conf

# End of file
* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096

切換到root使用者,進入limits.d目錄下修改配置檔案

vi /etc/security/limits.d/90-nproc.conf
修改如下內容:
* soft nproc 1024
#修改為
* soft nproc 2048

切換到root使用者修改配置sysctl.conf

[[email protected] elasticsearch-5.2.2]# vi /etc/sysctl.conf 
新增下面配置:
vm.max_map_count=655360
並執行命令:
[[email protected] elasticsearch-5.2.2]# sysctl -p
然後,重新啟動elasticsearch,即可啟動成功。

出現bug

[[email protected] elasticsearch-5.2.2]# bin/elasticsearch
[2018-12-14T08:10:48,065][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [testnote01] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root

不能用root使用者啟動

解決方案

在root賬號下

useradd es

將es的整個資料夾修改許可權

[[email protected] module]$ chown -R es:es elasticsearch-5.2.2

切換到es賬號.重啟啟動

參考部落格地址
https://blog.csdn.net/showhilllee/article/details/53404042
網頁訪問

在這裡插入圖片描述