大數據開發卷五
---Elasticsearch 分佈式安裝步驟
考慮需要安裝elasticsearch-head作爲web展示 所以首先安裝nodejs 主要是利用npm
-
wget https://npm.taobao.org/mirrors/node/v11.0.0/node-v11.0.0.tar.gz
-
tar –zxvf node-v11.0.0.tar.gz
-
cd node-v11.0.0
-
yum install gcc gcc-c++
-
./configure
-
Make
-
Make install
- Node –v
開始安裝elasticsearch
1. 安裝3臺虛擬機
2. 安裝jdk
-
解壓 tar –zxvf elasticsearch6.2.2
-
切換用戶 su cm(elasticsearch 不能在root用戶下啓動)
- 啓動後宿主機不能訪問處理方案(啓動命令:在bin目錄下 sh elasticsearch)
a) 修改config/elasticsearch.yml
cluster.name: es-app #集羣名稱,可以自行修改
node.name: es-1 #節點名稱,自行修改
network.host: 192.168.235.133 #主機地址,這裏寫本機IP
http.port: 9200 #端口
http.cors.enabled: true #設置跨域
http.cors.allow-origin: "*" #設置訪問
b) 再啓動查看不能啓動原因
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
[2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
i. 問題 1 系統最大文件數太低
修改 vi /etc/security/limits.conf 文件末尾追加
cm soft nofile 65536
cm hard nofile 131072
cm soft nproc 4096
cm hard nproc 4096
ii. 問題 2 虛擬內存太低
修改vi /etc/sysctl.conf文件末尾追加
vm.max_map_count=655360
切換到root權限
sysctl -p
iii. java.nio.file.AccessDeniedException: …/elasticsearch-6.2.2/config/jvm.options
chown 用戶名 elasticsearch-6.2.2安裝目錄路徑 -R
- 可以先安裝elasticsearch-head監控elasticsearch集羣環境
a) tar –zxvf elasticsearch-head-master
b) npm install
c) npm run start
- 配置從節點服務器
cluster.name: es-app #集羣名稱,可以自行修改
node.name: es-2 #節點名稱,自行修改
network.host: 192.168.235.132 #主機地址,這裏寫本機IP
http.port: 9200 #端口
discovery.zen.ping.unicast.hosts: ["192.168.235.133"]#設置集羣的指揮
- 同理配置第3節點
開始安裝LogStash
nodejs文件是c編寫的,需要先yum install gcc gcc-c++
然後直接make進行編譯nodejs文件