1 环境准备:
A:配置主机名hostname node1
vim /etc/hosts
192.168.100.110 node1
192.168.100.111 node2
1 环境准备:
A:配置主机名hostname node1
vim /etc/hosts
192.168.100.110 node1
192.168.100.111 node2
systemctl stop firewalld.service
setenforce 0
scp /etc/hosts root@192.168.100.111:/etc/
B配置主机名hostname node2
vim /etc/hosts
bash
systemctl stop firewalld.service
setenforce 0
2 安装Elasticsearch
A:rpm -ivh elasticsearch-5.5.0.rpm
systemctl start elasticsearch.service
systemctl enable elasticsearch.service
systemctl daemon-reload
3 修改配置文件
A :vim /etc/elasticsearch/elasticsearch.yml
set nu
17myELK
23node1
33 /data/elk_data
37/var/log/elasticsearch/
43 false
55 192.168.100.110
59 9200
68 [node1/node2]
A :mkdir -p /data/elk_data
chown elasticsearch:elasticsearch /data/elk_data
systemctl restart elasticsearch.service
netstat -naptu |grep 9200
4 安装Elasticsearch-head 插件
A : ll
tar xf node-v8.2.2
cd node-v8.2.1/
./configure && make && make install
B:tar xf node-v8.2.1.tar.gz
cd node-v8.2.1/
./configure && make && make install
B phantomjs
tar xf phantomjs-2.1.1-linux-x86_64.tar.bz2
cp phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/local/bin/
C 安装 elasticsearch-head.tar.gz
tar xf elasticsearch-head.tar.gz
cd elasticsearch-head/
npm install
D修改配置文件
vim /etc/elasticsearch/elasticsearch.yml
http.cors.enabled: true
http.cors.allow-origin: “*”
重启服务
systemctl restart elasticsearch.service
npm run start &
netstat -naptu |grep 9200
netstat -naptu |grep 9100
访问192.168.100.110:9100
B vim /etc/elasticsearch/elasticsearch.yml
systemctl restart elasticsearch.service
netstat -naptu |grep 9200
5 安装logstash
B rpm -ivh logstash-5.5.1.rpm
mount /dev/cdrom /media/cdrom
yum list
yum -y install httpd
history
systemctl start logstash.service
ln -s /usr/share/logstash/bin/logstash /usr/local/bin/
echo ‘
hqhqhq
’ > /var/www/html/index.htmlsystemctl start httpd
5 配置logstash文件
C cd /etc/logstash/conf.d/
touch apache_log.conf
vim apache_log.conf
input {
file{
path => “/etc/httpd/logs/access_log”
type => “access”
start_position => “beginning”
}
file{
path => “/etc/httpd/logs/error_log”
type => “error”
start_position => “beginning”
}
}
output {
if [type] == “access” {
elasticsearch {
hosts => [“192.168.100.110:9200”]
index => “apache_access-%{+YYYY.MM.dd}”
}
}
if [type] == “error” {
elasticsearch {
hosts => [“192.168.100.110:9200”]
index => “apache_error-%{+YYYY.MM.dd}”
}
}
}
/usr/share/logstash/bin/logstash -f apache_log.conf
systemctl restart logstash.service
6 安装kibana
A
rpm ivh kibana-5.5.5-x86.rpm
vim /etc/kibana/kibana.yml
2 5601
7 “0.0.0.0”
21 192.168.100.110
30 kibana
systemctl restart kibana.service
systemctl stop firewalld.service
setenforce 0
scp /etc/hosts root@192.168.100.111:/etc/
B配置主机名hostname node2
vim /etc/hosts
bash
systemctl stop firewalld.service
setenforce 0
2 安装Elasticsearch
A:rpm -ivh elasticsearch-5.5.0.rpm
systemctl start elasticsearch.service
systemctl enable elasticsearch.service
systemctl daemon-reload
3 修改配置文件
A :vim /etc/elasticsearch/elasticsearch.yml
set nu
17myELK
23node1
33 /data/elk_data
37/var/log/elasticsearch/
43 false
55 192.168.100.110
59 9200
68 [node1/node2]
A :mkdir -p /data/elk_data
chown elasticsearch:elasticsearch /data/elk_data
systemctl restart elasticsearch.service
netstat -naptu |grep 9200
4 安装Elasticsearch-head 插件
A : ll
tar xf node-v8.2.2
cd node-v8.2.1/
./configure && make && make install
B:tar xf node-v8.2.1.tar.gz
cd node-v8.2.1/
./configure && make && make install
B phantomjs
tar xf phantomjs-2.1.1-linux-x86_64.tar.bz2
cp phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/local/bin/
C 安装 elasticsearch-head.tar.gz
tar xf elasticsearch-head.tar.gz
cd elasticsearch-head/
npm install
D修改配置文件
vim /etc/elasticsearch/elasticsearch.yml
http.cors.enabled: true
http.cors.allow-origin: “*”
重启服务
systemctl restart elasticsearch.service
npm run start &
netstat -naptu |grep 9200
netstat -naptu |grep 9100
访问192.168.100.110:9100
B vim /etc/elasticsearch/elasticsearch.yml
systemctl restart elasticsearch.service
netstat -naptu |grep 9200
5 安装logstash
B rpm -ivh logstash-5.5.1.rpm
mount /dev/cdrom /media/cdrom
yum list
yum -y install httpd
history
systemctl start logstash.service
ln -s /usr/share/logstash/bin/logstash /usr/local/bin/
echo ‘
hqhqhq
’ > /var/www/html/index.htmlsystemctl start httpd
5 配置logstash文件
C cd /etc/logstash/conf.d/
touch apache_log.conf
vim apache_log.conf
input {
file{
path => “/etc/httpd/logs/access_log”
type => “access”
start_position => “beginning”
}
file{
path => “/etc/httpd/logs/error_log”
type => “error”
start_position => “beginning”
}
}
output {
if [type] == “access” {
elasticsearch {
hosts => [“192.168.100.110:9200”]
index => “apache_access-%{+YYYY.MM.dd}”
}
}
if [type] == “error” {
elasticsearch {
hosts => [“192.168.100.110:9200”]
index => “apache_error-%{+YYYY.MM.dd}”
}
}
}
/usr/share/logstash/bin/logstash -f apache_log.conf
systemctl restart logstash.service
6 安装kibana
A
rpm ivh kibana-5.5.5-x86.rpm
vim /etc/kibana/kibana.yml
2 5601
7 “0.0.0.0”
21 192.168.100.110
30 kibana
systemctl restart kibana.service