項(xiàng)目準(zhǔn)備:
redhat7.6
es+logstash+kibana??6.1
192.168.0.10????elk1
192.168.0.10????elk2
192.168.0.10????elk3
新建主機(jī)初始化
安裝依賴(lài)包
yum -y install tree lrzsz nmap nc telnet vim wget lsof network-tools bash-completion bash-completion-extras net-tools? epel-release? createrepo? lvm2
更新yum源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo?wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
關(guān)閉防火墻
systemctl stop firewalld && systemctl disable firewalld
關(guān)閉SELINUX
setenforce 0 && sed -i 's/^SELINUX=.*/SELINUX=disabled/' /etc/selinux/config
安裝elasticsearch
設(shè)置系統(tǒng)主機(jī)名以及 Host 文件的相互解析
hostnamectl?set-hostname?elk1????#三臺(tái)相同操作這里不在重復(fù)?vim /etc/hosts?192.168.0.208? elk1192.168.0.48? ? elk2192.168.0.213? elk3?
安裝jdk
tar -xvf jdk-8u141-linux-x64.tar.gz?mv?jdk1.8.0_141/?/usr/local/?vim /etc/profile? ? #把下面內(nèi)容寫(xiě)入到 /etc/profileexport?JAVA_HOME=/usr/local/jdk1.8.0_141export PATH=$JAVA_HOME/bin:$PATH export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
執(zhí)行source /etc/profile?刷新環(huán)境變量
執(zhí)行java –version確認(rèn)是否配置成功
如果報(bào)jdk錯(cuò)誤做一個(gè)軟連接which? javaln -s /ziyun/jdk1.8.0_141/bin/java? /usr/bin/?
設(shè)置data目錄哎甲、log目錄
創(chuàng)建/data/es-data目錄卷员,用于elasticsearch數(shù)據(jù)的存放
修改該目錄的擁有者為elasticsearch
mkdir -p? /data/es-data?chown? -R elasticsearch:elasticsearch? /data/es-data
創(chuàng)建/data/es-log目錄,用于elasticsearch日志的存放
修改該目錄的擁有者為elasticsearch?
mkdir? -p? /data/es-log?chown? -R elasticsearch:elasticsearch? /data/es-log
下載elasticsearch軟件包并安裝
下載地址:wget? https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.1.0.rpm?安裝rpm -ivh elasticsearch-6.1.0.rpm?
修改配置文件
先做個(gè)備份cp? /etc/elasticsearch/elasticsearch.yml? /etc/elasticsearch/elasticsearch.ymlbak?vim /etc/elasticsearch/elasticsearch.yml#另外兩臺(tái)同樣操作17 cluster.name: myelk? ? #集群名23?node.name:?elk3????#?節(jié)點(diǎn)名稱(chēng)磕瓷,建議和主機(jī)名一致33 path.data: /data/es-data? #數(shù)據(jù)存放路徑37 path.logs: /data/es-log? #日志路徑55 network.host: 0.0.0.0? ? #監(jiān)聽(tīng)地址59 http.port: 9200? ? ? #端口68 discovery.zen.ping.unicast.hosts: ["elk1", "elk2", "elk3"]? ? #聲明集群里主機(jī)還有誰(shuí)http.cors.enabled: truehttp.cors.allow-origin: "*"
修改limit文件
vim /etc/security/limits.conf?* soft memlock unlimited* hard memlock unlimited* soft nofile 131072*?hard?nofile?131072?
vim /etc/security/limits.d/20-nproc.conf?*? ? ? ? ? soft? ? nproc? ? 2048root? ? ? soft? ? nproc? ? unlimited
查看
ulimit -n
啟動(dòng)服務(wù)
啟動(dòng)systemctl? restart? elasticsearch.service?查看狀態(tài)systemctl? status? elasticsearch.service?設(shè)置開(kāi)機(jī)自啟systemctl? enable? elasticsearch.service?
查看端口
netstat? -utnlp | grep 9200
訪問(wèn)服務(wù)
http://192.168.0.10:9200????#本機(jī)ip+端口
以上步驟其他node節(jié)點(diǎn)跟上面相同操作
查看集群狀態(tài)
http://192.168.0.10:9200/_cluster/health?pretty
索引的分片信息
#Linux控制臺(tái)操作curl?-X?GET?http://192.168.0.10:9200/_cat
顯示health的詳細(xì)信息
#Linux控制臺(tái)操作curl?-X?GET?http://192.168.0.10:9200/_cat/health?v
查看nodes的幫助
#Linux控制臺(tái)操作curl?-X?GET?http://192.168.0.10:9200/_cat/nodes?help
由于篇幅太長(zhǎng)硬贯,logstash方妖,kibana安裝放到下一篇广凸。
更多干貨,公總耗【大隆愛(ài)分享】