ELK安装配置

1.安装elasticsearch

初步设计elasticsearch为两个节点

  系统初始化(centos7)

#防火墙
systemctl status iptables
systemctl status firewalld
systemctl stop firewalld
systemctl disable firewalld
systemctl status firewalld
#selinux 关闭
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
setenforce 0
#打开文件数
sed -i '/# End of file/i\*\t\t-\tnofile\t\t65536' /etc/security/limits.conf
cat /etc/security/limits.conf
ulimit -HSn 65536
ulimit -n
#内核参数调整
echo 'net.ipv4.ip_forward = 1' > /etc/sysctl.conf
echo 'net.ipv4.tcp_timestamps = 1' >> /etc/sysctl.conf
echo 'net.ipv4.tcp_tw_recycle = 1' >> /etc/sysctl.conf
echo 'net.ipv4.tcp_fin_timeout = 30' >> /etc/sysctl.conf
echo 'vm.max_map_count=262144' >> /etc/sysctl.conf
sysctl -p
#配置yum源为aliyun
cd /etc/yum.repos.d
rm -rf *
rpm -ivh http://source.zhaolibin.com/scripts/wget-1.14-10.el7_0.1.x86_64.rpm
wget -O 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
yum clean all
yum makecache

  java环境安装

wget http://source.zhaolibin.com/elk/jdk-8u144-linux-x64.tar.gz
tar -zxvf jdk-8u144-linux-x64.tar.gz
mv jdk1.8.0_144 java
mv java /usr/local/
#添加JDK变量环境
echo '#JAVA#'>> /etc/profile
echo 'JAVA_HOME=/usr/local/java'>> /etc/profile
echo 'CLASSPATH=$JAVA_HOME/lib:$JAVA_HOME/jre/lib'>> /etc/profile
echo 'PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin'>> /etc/profile
echo 'export PATH CLASSPATH JAVA_HOME'>> /etc/profile
source /etc/profile

  elasticsearch 安装

mkdir /data/
tar -zxvf elasticsearch-5.5.0.tar.gz -C /data/
ln -s /data/elasticsearch-5.5.0/ /data/elasticsearch
#新建用户
useradd elasticsearch
echo "123456"|passwd --stdin elasticsearch
chown -R elasticsearch.elasticsearch /data/elasticsearch*
#修改配置文件
#vim /data/elasticsearch/config/jvm.options
#调整
#-Xms3g(设置为合适的大小)
#-Xmx3g

  elasticsearch 配置文件(暂未做优化)

cluster.name: my-es
node.name: es1
network.host: 172.28.50.201
http.port: 9200
http.cors.enabled: true
http.cors.allow-origin: "*"

  elasticsearch head插件安装

cd /data
wget http://source.zhaolibin.com/elk/node-v8.3.0-linux-x64.tar.gz
yum install bzip2 -y
tar -zxvf node-v8.3.0-linux-x64.tar.gz
ln -s /data/node-v8.3.0-linux-x64/ /data/node
ln -s /data/node/bin/npm /usr/local/bin/node
ln -s /data/node/bin/npm /usr/local/bin/npm
npm install -g cnpm --registry=https://registry.npm.taobao.org
yum -y install git
git clone git://github.com/mobz/elasticsearch-head.git
cd elasticsearch-head/
npm install grunt --save-dev
/usr/local/elasticsearch-head/node_modules/grunt/bin/grunt server

  

 

posted @ 2017-08-15 19:29  悉达多尊  阅读(175)  评论(0编辑  收藏  举报