安裝jdk,原系統安裝的openjava
參考https://www.cnblogs.com/Dylansuns/p/6974272.html
注意配置/etc/profile 時,要注意自己安裝的是哪個文件夾
下載es安裝包
https://www.elastic.co/cn/downloads/elasticsearch
創建一個es用戶組和用戶
groupadd es
useradd esv-g es
passwd es
修改文件所有者
chown -R es:es /usr/local/es
修改執行權限
chmod 770 /usr/local/es
切換到es用戶,es在root用戶下不能啟動
su es
安裝到 /usr/local/es
啟動es 命令如:/usr/local/es/elasticsearch-6.2.2/bin/elasticsearch -d
-d可以在后台運行,啟動可能會稍慢,等一會就會正常啟動
查看運行進程
ps -ef | grep elasticsearch
關閉進程
kill 3268
配置參考
cluster.name: es-cluster-5.3.1 配置集群名稱 三台服務器保持一致
node.name: node-1 配置單一節點名稱,每個節點唯一標識
network.host: 0.0.0.0 設置綁定的ip地址
http.port: 9200 端口
discovery.zen.ping.unicast.hosts: ["172.16.31.220", "172.16.31.221","172.16.31.224"] 集群節點ip或者主機
discovery.zen.minimum_master_nodes: 3 設置這個參數來保證集群中的節點可以知道其它N個有master資格的節點。默認為1,對於大的集群來說,可以設置大一點的值(2-4)
下面兩行配置為haad插件配置,三台服務器一致。
http.cors.enabled: true
http.cors.allow-origin: "*"
查看是否正常啟動
Run curl http://localhost:9200/ or Invoke-RestMethod http://localhost:9200 with PowerShell
不能訪問查看防火牆
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall開機啟動
firewall-cmd --state #查看默認防火牆狀態(關閉后顯示notrunning,開啟后顯示running)
關閉防火牆參考
https://www.linuxidc.com/Linux/2015-05/117473.htm
服務器多了最好進行名稱配置
查看服務器相關信息
hostnamectl status
修改服務器名稱
hostnamectl set-hostname es1
hostnamectl set-hostname es2
kibana安裝到如下路徑
/usr/local/es/kibana-6.2.2-linux-x86_64/bin/kibana
配置參考
http://doc.okbase.net/jstarseven/archive/262258.html
LogStash安裝配置
啟動命令
logstash -f iislog.conf
我遇到的問題1
max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]
原因:最大虛擬內存太小
解決方案:切換到root用戶下,修改配置文件sysctl.conf
vi /etc/sysctl.conf
添加下面配置:
vm.max_map_count=655360
並執行命令:
sysctl -p
然后重新啟動elasticsearch,即可啟動成功。
問題2
在linux系統:
/etc/security/limits.conf
編輯該文件,后面加上:
xq soft nofile 65536
xq hard nofile 65536
x-pack 安裝
離線包安裝命令bin/elasticsearch-plugin install file:///path/to/file/x-pack-6.2.1.zip
修改elastic用戶密碼命令
bin/x-pack/setup-passwords interactive
其他問題參考
http://doc.okbase.net/jstarseven/archive/262258.html
http://www.chepoo.com/elasticsearch-installation-parameters-configuration-considerations.html