部署ELK
1.搭建客户机Nginx
ls[root@nginx ~]# hostname
nginx
[root@nginx ~]# cat /etc/redhat-release
CentOS release 6.5 (Final)
[root@nginx ~]# uname -r
2.6.32-431.el6.x86_64
[root@nginx ~]# /etc/init.d/iptables stop
iptables:将链设置为政策 ACCEPT:filter [确定]
iptables:清除防火墙规则: [确定]
iptables:正在卸载模块: [确定]
[root@nginx ~]# setenforce 0
setenforce: SELinux is disabled
[root@nginx ~]# chkconfig iptables off
[root@nginx ~]# tar xf nginx-1.13.12.tar.gz -C /usr/src/
[root@nginx ~]# useradd -M -s /sbin/nologin nginx
[root@nginx ~]# cd /usr/src/nginx-1.13.12/
[root@nginx nginx-1.13.12]# ./configure --prefix=/usr/local/nginx --user=nginx --group=nginx && make && make install
[root@nginx nginx-1.13.12]# cp -p /usr/local/nginx/sbin/* /usr/local/sbin/
[root@nginx nginx-1.13.12]# nginx
[root@nginx nginx-1.13.12]# netstat -anpt|grep nginx
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 5605/nginx
2部署客户机Apache:
[root@Apache ~]# hostname
Apache
[root@Apache ~]# cat /etc/redhat-release
CentOS release 6.5 (Final)
[root@Apache ~]# uname -r
2.6.32-431.el6.x86_64
[root@Apache ~]# /etc/init.d/iptables stop
[root@Apache ~]# setenforce 0
[root@Apache ~]# tar xf apr-1.5.1.tar.gz -C /usr/src/
[root@Apache ~]# tar xf apr-util-1.5.1.tar.gz -C /usr/src/
[root@Apache ~]# tar xf httpd-2.4.33.tar.gz -C /usr/src/
[root@Apache ~]# cd /usr/src/apr-1.5.1/
[root@Apache apr-1.5.1]# ./configure prefix=/usr/local/apr && make && make install
[root@Apache apr-1.5.1]# cd ../apr-util-1.5.1/
[root@Apache apr-util-1.5.1]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/ && make && make install
[root@Apache apr-util-1.5.1]# cd ../httpd-2.4.33/
[root@Apache httpd-2.4.33]# ./configure --prefix=/usr/local/httpd --enable-so --enable-rewrite --enable-header --enable-charset-lite --enable-cgi --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/ && make && make install
[root@Apache httpd-2.4.33]# ln -s /usr/local/httpd/bin/* /usr/local/sbin/
[root@Apache httpd-2.4.33]# apachectl start
AH00557: httpd: apr_sockaddr_info_get() failed for Apache
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
[root@Apache httpd-2.4.33]# netstat -anpt|grep httpd
tcp 0 0 :::80 :::* LISTEN 34117/httpd
3.部署Elasticserch(Logstash、Kibana三台都需要安装JDK)
1.查看系统环境:
[root@Elasticserch ~]# hostname
Elasticserch
[root@Elasticserch ~]# cat /etc/redhat-release
CentOS release 6.5 (Final)
[root@Elasticserch ~]# uname -r
2.6.32-431.el6.x86_64
[root@Elasticserch ~]# /etc/init.d/iptables stop
[root@Elasticserch ~]# setenforce 0
2.安装JDK环境:
[root@Elasticserch ~]# tar xf jdk-8u161-linux-x64.tar.gz
[root@Elasticserch ~]# mv jdk1.8.0_161/ /usr/local/java
[root@Elasticserch ~]# vim /etc/profile.d/java.sh
export JAVA_HOME=/usr/local/java
export PATH=$PATH:$JAVA_HOME/bin
[root@Elasticserch ~]# source /etc/profile
[root@Elasticserch ~]# java -version
java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)
3.安装Elasticserch节点:
[root@Elasticserch ~]# tar xf elasticsearch-6.2.4.tar.gz
[root@Elasticserch ~]# mv elasticsearch-6.2.4 /usr/local/elasticsearch
[root@Elasticserch ~]# cd /usr/local/elasticsearch/
[root@Elasticserch elasticsearch]# cd config/
[root@Elasticserch config]# cp elasticsearch.yml{,.default} #备份配置文件,防止修改错误
4.修改配置文件:
[root@Elasticserch config]# vim elasticsearch.yml
cluster.name: my-es-cluster #集群的名称
node.name: node-1 #节点的名称
path.data: /usr/local/elasticsearch/data #数据路径
path.logs: /usr/local/ elasticsearch /logs #日志路径
bootstrap.memory_lock: false #这行去掉注释把ture改成false,不改会造成服务启动报错
bootstrap.system_call_filter: false #添加这行,否则启动会报错。
配置上述两行的原因:
这是在因为Centos6不支持SecComp,而ES5.2.0默认bootstrap.system_call_filter为true进行检测,所以导致检测失败,失败后直接导致ES不能启动。
network.host:
192.168.200.132 # elasticsearch主机地址
http.port: 9200 #端口号
discovery.zen.ping.unicast.hosts:
["node-1"] #启动新节点通过主机列表发现。
discovery.zen.minimum_master_nodes:
1 #总节点数
[root@elasticsearch ~]#
vim /etc/security/limits.d/90-nproc.conf
*
soft nproc 4096
#默认1024,改成4096
[root@elasticsearch ~]#
vim /etc/sysctl.conf
#末尾追加否则服务会报错。
vm.max_map_count=655360
[root@elasticsearch ~]#
sysctl -p #使上述配置生效
3.创建elasticsearch运行的用户:
[root@Elasticserch
config]# useradd elasticsearch
[root@Elasticserch
config]# chown -R elasticsearch.elasticsearch /usr/local/elasticsearch/
4.修改文件句柄数:
[root@Elasticserch
config]# vim /etc/security/limits.conf
#添加下面内容:
*
soft nofile 65536
*
hard nofile 65536
*
soft nproc 65536
*
hard nproc 65536
5.切换用户启动服务
[root@Elasticserch
config]# su - elasticsearch
[elasticsearch@Elasticserch
~]$ cd /usr/local/elasticsearch/
[elasticsearch@elasticsearch
elasticsearch]$ bin/elasticsearch &
注:如果启动错误请看下上述配置过程黄色标记的部分是否有配置错误或者没有配置。
6.查看服务是否启动成功
[root@elasticsearch ~]#
netstat -anpt
Active Internet
connections (servers and established)
Proto Recv-Q Send-Q Local
Address Foreign
Address State PID/Program name
tcp 0
0 0.0.0.0:111
0.0.0.0:*
LISTEN 970/rpcbind
tcp 0
0 0.0.0.0:22
0.0.0.0:* LISTEN 1150/sshd
tcp 0
0 0.0.0.0:56600
0.0.0.0:* LISTEN 988/rpc.statd
tcp 0
0 127.0.0.1:25
0.0.0.0:* LISTEN 1226/master
tcp 0
64 192.168.200.132:22
192.168.200.2:62459
ESTABLISHED 1301/sshd
tcp 0
0 :::111
:::*
LISTEN 970/rpcbind
tcp 0
0
::ffff:192.168.200.132:9200 :::* LISTEN 3990/java
tcp 0
0
::ffff:192.168.200.132:9300 :::*
LISTEN 3990/java
tcp 0
0 :::52916
:::* LISTEN 988/rpc.statd
tcp 0
0 :::22
:::* LISTEN 1150/sshd
tcp 0
0 ::1:25
:::* LISTEN 1226/master
7.简单测试下:
[root@elasticsearch ~]#
curl http://192.168.200.132:9200
{
"name" : "node-1",
"cluster_name" :
"my-es-cluster",
"cluster_uuid" :
"tMW5tRXMTwO0g1i9BAp0rg",
"version" : {
"number" : "6.2.4",
"build_hash" :
"ccec39f",
"build_date" :
"2018-04-12T20:37:28.497551Z",
"build_snapshot" : false,
"lucene_version" :
"7.2.1",
"minimum_wire_compatibility_version"
: "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
},
"tagline" : "You Know, for
Search"
}
说明服务正常。
8.安装head插件:
[root@Elasticserch ~]# vim
/usr/local/elasticsearch/config/elasticsearch.yml
# 增加参数,使head插件可以访问es
http.cors.enabled: true
http.cors.allow-origin:
"*"
下载head插件
wget
https://github.com/mobz/elasticsearch-head/archive/master.zip
安装node
wget https://npm.taobao.org/mirrors/node/latest-v4.x/node-v4.4.7-linux-x64.tar.gz
tar -zxvf node-v4.4.7-linux-x64.tar.gz
配置下环境变量,编辑/etc/profile添加
[root@Elasticserch ~]# vim
/etc/profile.d/node.sh
export
NODE_HOME=/root/node-v4.4.7-linux-x64
export
PATH=$PATH:$NODE_HOME/bin
export
DODE_PATH=$NODE_HOME/lib/node_modules
[root@Elasticserch ~]# .
/etc/profile
安装grunt
grunt是基于Node.js的项目构建工具,可以进行打包压缩、测试、执行等等的工作,head插件就是通过grunt启动
[root@Elasticserch ~]#
unzip master.zip
[root@Elasticserch ~]# cd
elasticsearch-head-master/
[root@Elasticserch
elasticsearch-head-master]# npm install -g grunt-cli # 执行后会生成node_modules文件夹
[root@Elasticserch
elasticsearch-head-master]# grunt -version
grunt-cli v1.2.0
[root@Elasticserch
elasticsearch-head-master]# vim Gruntfile.js
connect: {
server: {
options: {
port:
9100,
base:
'.',
keepalive: true
hostname: '*' #添加这行
[root@Elasticserch
elasticsearch-head-master]# vim _site/app.js
(function( app, i18n ) {
var ui = app.ns("ui");
var services =
app.ns("services");
app.App = ui.AbstractWidget.extend({
defaults: {
base_uri: null
},
init: function(parent) {
this._super();
this.prefs =
services.Preferences.instance();
this.base_uri =
this.config.base_uri || this.prefs.get("app-base_uri") ||
"http://192.168.200.130:9200"; #改成es地址
运行head
[root@Elasticserch
elasticsearch-head-master]# grunt server &
重启es
报错解决方法:
npm config set strict-ssl false
npm config set registry http://registry.cnpmjs.org
npm info underscore
npm --registry http://registry.cnpmjs.org info underscore
编辑 ~/.npmrc 加入下面内容
registry = http://registry.cnpmjs.org
部署ELK的更多相关文章
- [原创]ubuntu14.04部署ELK+redis日志分析系统
ubuntu14.04部署ELK+redis日志分析系统 [环境] host1:172.17.0.4 搭建ELK+redis服务 host2:172.17.0.3 搭建logstash+nginx服务 ...
- Centos7单机部署ELK+x-pack
ELK分布式框架作为现在大数据时代分析日志的常为大家使用.现在我们就记录下单机Centos7部署ELK的过程和遇到的问题. 系统要求:Centos7(内核3.5及以上,2核4G) elk版本:6.2. ...
- Docker 部署 elk + filebeat
Docker 部署 elk + filebeat kibana 开源的分析与可视化平台logstash 日志收集工具 logstash-forwarder(原名lubmberjack)elastics ...
- Kubernetes部署ELK并使用Filebeat收集容器日志
本文的试验环境为CentOS 7.3,Kubernetes集群为1.11.2,安装步骤参见kubeadm安装kubernetes V1.11.1 集群 1. 环境准备 Elasticsearch运行时 ...
- 离线部署ELK+kafka日志管理系统【转】
转自 离线部署ELK+kafka日志管理系统 - xiaoxiaozhou - 51CTO技术博客http://xiaoxiaozhou.blog.51cto.com/4681537/1854684 ...
- 使用Docker快速部署ELK分析Nginx日志实践(二)
Kibana汉化使用中文界面实践 一.背景 笔者在上一篇文章使用Docker快速部署ELK分析Nginx日志实践当中有提到如何快速搭建ELK分析Nginx日志,但是这只是第一步,后面还有很多仪表盘需要 ...
- Docker 部署ELK之Sentinl日志报警
前篇文章简单介绍了Docker 部署ELK,以及使用filebeat收集java日志.这篇我们介绍下日志报警配置,这里我们使用Sentinl插件. 1.修改kibana参数 进入elk容器,修改对应参 ...
- ELK教程1:ElasticSearch集群的部署ELK
在分布式系统中,应用数量众多,应用调用链复杂,常常使用ELK作为日志收集.分析和展示的组件.本篇文章将讲讲解如何部署ELK,然后讲解如何使用Filebeat采集Spring Boot的日志输出到Log ...
- docker-compose部署ELK(亲测)
具体的配置可以参考上面一篇:docker部署ELK 以下是做了一些修改的地方: kibana.yml [root@topcheer config]# cat kibana.yml server.hos ...
- centos7.5部署ELk
第1章 环境规划 1.1 ELK介绍 ELK是ElasticSerach.Logstash.Kibana三款产品名称的首字母集合,用于日志的搜集和搜索. Elasticsearc ...
随机推荐
- 文件input框选择图片实时显示小技巧
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- ZOJ Problem Set - 1010
算法:已知多边形各顶点坐标,求多边形面积的公式 http://www.cnblogs.com/FleetingTime/p/3849957.html http://www.mathchina.net/ ...
- centos7服务搭建常用服务配置之一:SSH
目录 1 SSH服务协议 1.1 ssh服务协议说明 1.2 ssh服务工作机制 1.3 ssh加密技术说明 1.3.1 ssh实现安全链接建立,利用要是和锁头 1.3.2 ssh加密算法 1.4 s ...
- Mybatis传递List集合
完整错误如下: org.apache.ibatis.binding.BindingException: Parameter ‘customerIdList’ not found. Available ...
- 【AtCoder】AGC006
AGC006 A - Prefix and Suffix -- #include <bits/stdc++.h> #define fi first #define se second #d ...
- SpringBoot 对IBM MQ进行数据监听接收以及数据发送
一.需求介绍 后端使用Spring Boot2.0框架,要实现IBM MQ的实时数据JMS监听接收处理,并形成回执通过MQ队列发送. 二.引入依赖jar包 <dependency> < ...
- Spring4学习回顾之路09-基于注解的方式配置bean
一:基于注解配置Bean 首先介绍下组件扫描(component scanning): Spring能够从classpath下自动扫描,侦测和实例化具有特定注解的组件. 包括: -@Component ...
- 第八章 ZYNQ-MIZ701 软硬调试高级技巧
软件和硬件的完美结合才是SOC的优势和长处,那么开发ZYNQ就需要掌握软件和硬件开发的调试技巧,这样才能同时分析软件或者硬件的运行情况,找到问题,最终解决.那么本章将通过一个简单的例子带大家使用v ...
- codeforce E - Minimal Labels+hdu 4857
两个题目的意思差不多 都是希望得出的拓扑序如果有多种 要求输出字典序小的情况 这里引用一个大佬的博客 关于为什么不能直接建图然后用小根堆解决这个问题(http://blog.csdn.net/rgno ...
- SqlServer2008 跨服务器同步数据
最近工作中需要跨服务器同步数据,在数据库DB1中的表T1插入数据,同时触发T1的触发器(这里暂不讨论触发器的效率问题),向另一台服务器DB2中的相同的一张表T2插入数据,查看了一些资料说, 需要打开D ...