es搭建

准备文件:
elasticsearch-6.4.2.tar.gz
kibana-6.4.2-x86_64.rpm
logstash-6.4.2.tar.gz
环境:
JDK 和 NodeJS
可参考https://www.extlight.com/2017/09/27/Elasticsearch-%E5%9F%BA%E7%A1%80%E5%85%A5%E9%97%A8/

1.安装elasticsearch和启动
tar zxvf ./elasticsearch-6.4.2.tar.gz
cd elasticsearch-6.4.2
bin/elasticsearch 或 bin/elasticsearch -d # -d 表示后台启动

2.(非必须,启动有问题可参考)因为 Elasticsearch 可以执行脚本文件,为了安全性,默认不允许通过 root 用户启动服务。我们需要新创建用户名和用户组启动服务
#增加 es 组
groupadd es
#增加 es 用户并附加到 es 组
useradd es -g es -p es
#给目录权限
chown -R es:es elasticsearch-5.6.1
#使用es用户
su es

3.(非必须,启动有问题可参考)默认情况下,Elasticsearch 只允许本机访问,如果需要远程访问,需要修改其配置文件
vim config/elasticsearch.yml
network.host: 0.0.0.0
4.(非必须,启动有问题可参考)启动报错:max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
ulimit -n 65536 #需要设置在root用户下,再设置es用户
5.(非必须,启动有问题可参考)启动报错:max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
vim /etc/sysctl.conf
vm.max_map_count=262144
或者root用户下执行:sysctl -w vm.max_map_count = 262144

6.验证es启动成功
访问http://10.72.66.151:9200/,返回json在界面
关闭ps aux | grep ‘elastic’ #记住是用es用户
kill -9 XXX

7.安装logstash和启动
tar zxvf ./logstash-6.4.2.tar.gz
cd logstash-6.4.2.tar.gz
bin/logstash -f log2es.conf
bin/logstash -f kafka2es.conf
cat test.conf #需要新增输入输出配置文件XXX.config
./bin/logstash -f yhf.conf& #启动
重启前可删除data下的rm .lock文件
#验证成功在kafka发数据的时候,logstash可以接受到数据

8.修改kafka参数
zookeeper.properties文件中的:

the directory where the snapshot is stored.

dataDir=/tmp/zookeeper/dataDir
dataLogDir=/tmp/zookeeper/log

the port at which the clients will connect

clientPort=2181

disable the per-ip limit on the number of connections since this is a non-production config

maxClientCnxns=0
tickTime=2000
initLimit=10
syncLimit=5

server.1=10.72.66.151:2888:3888

9.修改kafka参数:
server.properties中listeners=PLAINTEXT://yourhostname :9093

10.安装kibana
详见https://www.elastic.co/guide/cn/kibana/current/rpm.html

11.添加elk和kafka开机启动
在/etc/init.d/下添加elk和kafka的配置文件
需要查看下新增的文件是否有权限:ll
没有权限需要加载权限:chmod 777 elk
重新加载配置:systemctl daemon-reload
重新启动:systemctl restart elk

http://note.youdao.com/noteshare?id=1d552c0ad8764b5881e4c6acae448629&sub=043A3E7185884562B8D038E777EE6055

=
http://note.youdao.com/noteshare?id=dd1674ad9a5e3517b41dc63d50c673fd&sub=DB7392893FA34E01959FB639433620F9

=
[root@centos145 ELK]# cat /etc/init.d/elk

=
nohup ./bin/logstash -f ganges.conf&

systemctl stop sshd ##关闭指定服务

systemctl start sshd ##开启指定服务

systemctl restart sshd ##从新启动服务

systemctl enable sshd ##设定指定服务开机开启

systemctl disable sshd ##设定指定服务开机关闭

systemctl reload sshd ##使指定服务从新加载配置

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值