ELK搭建
2017-06-05 本文已影响0人
GuiPulp
1.机器初始化
相关安装包
-
elasticsearch-5.4.0.tar.gz
-
logstash-5.4.0.tar.gz
安装ansible,配置hosts
配置阿里云yum源
# curl -s -L http://mirrors.aliyun.com/repo/Centos-7.repo -o /etc/yum.repos.d/CentOS-Base.repo && curl -s -L http://mirrors.aliyun.com/repo/epel-7.repo -o /etc/yum.repos.d/epel.repo
修改anxible hosts文件
#cat /etc/ansible/hosts
[elk]
zf-inf-elk-01.vm ansible_ssh_host=10.10.10.30 ansible_ssh_user="root" ansible_ssh_port=22 ansible_ssh_pass="newmedia"
zf-inf-elk-02.vm ansible_ssh_host=10.10.10.31 ansible_ssh_user="root" ansible_ssh_port=22 ansible_ssh_pass="newmedia"
zf-inf-elk-03.vm ansible_ssh_host=10.10.10.32 ansible_ssh_user="root" ansible_ssh_port=22 ansible_ssh_pass="newmedia"
[cdh]
zf-inf-cdh-01.vm ansible_ssh_host=10.10.10.33 ansible_ssh_user="root" ansible_ssh_port=22 ansible_ssh_pass="newmedia"
zf-inf-cdh-02.vm ansible_ssh_host=10.10.10.34 ansible_ssh_user="root" ansible_ssh_port=22 ansible_ssh_pass="newmedia"
zf-inf-cdh-03.vm ansible_ssh_host=10.10.10.35 ansible_ssh_user="root" ansible_ssh_port=22 ansible_ssh_pass="newmedia"
配置hosts,修改hostname
[root@zf-inf-elk-01 ~]# cat /etc/hosts
127.0.0.1 localhost
10.10.10.30 zf-inf-elk-01.vm
10.10.10.31 zf-inf-elk-02.vm
10.10.10.32 zf-inf-elk-03.vm
10.10.11.33 zf-inf-cdh-01.vm
10.10.11.34 zf-inf-cdh-02.vm
10.10.11.35 zf-inf-cdh-03.vm
同步host文件
ansible all -m copy -a 'src=/etc/hosts dest=/etc/hosts'
建立信任关系
[root@zf-inf-elk-01 ~]# ssh-keygen #一路回车
[root@zf-inf-elk-01 ~]# ansible all -m copy -a 'src=/root/.ssh/id_rsa.pub dest=/root/.ssh/authorized_keys'
JDK 安装
[root@zf-inf-elk-01 opt]# ansible all -m copy -a 'src=/opt/jdk-7u80-linux-x64.tar.gz dest=/opt/'
修改/etc/profile
export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_31
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH