# 软件版本
jdk-8u112elasticsearch-5.5.0logstash-5.5.0kibana-5.5.0nodejs-v6.11.1
# 设置系统参数
echo'vm.max_map_count=655360'>> /etc/sysctl.confecho'* hard nofile 65536'>> /etc/security/limits.confecho'* soft nofile 65536'>> /etc/security/limits.confsysctl -pyum install bzip2useradd devopsmkdir -p /datachown devops:devops /data -Rsu - devops
# 安装 jdk-8u112
mkdir -p /data/app/jdk/tmpwget http://dl.gm.tn/java/jdk-8u112-linux-x64.tar.gz -P /data/app/jdk/tmpunzip /data/app/jdk/tmp/jdk-8u112-linux-x64.tar.gztar -xf /data/app/jdk/tmp/jdk-8u112-linux-x64.tar.gz -C /data/app/jdk/
cat <> ~/.bash_profileexportJAVA_HOME=/data/app/jdk/jdk1.8.0_112exportJRE_HOME=\$JAVA_HOME/jreexportPATH=\$PATH:\$JAVA_HOME/bin:\$JRE_HOME/binexportCLASSPATH=\$CLASSPATH:.:\$JAVA_HOME/lib/dt.jar:\$JAVA_HOME/lib/tools.jarEOF
source~/.bash_profilejava -version
# 安装 elasticsearch
mkdir-p /data/app/elasticsearch/tmpmkdir-p /data/{data/elasticsearch,logs/elasticsearch}wget http://dl.gm.tn/elasticsearch/elasticsearch-5.5.0.tar.gz -P /data/app/elasticsearch/tmptar -xf /data/app/elasticsearch/tmp/elasticsearch-5.5.0.tar.gz -C /data/app/elasticsearch/
cat <>/data/app/elasticsearch/elasticsearch-5.5.0/config/elasticsearch.ymlcluster.name: elasticsearchnode.name: es-node-1path.data:/data/data/elasticsearchpath.logs:/data/logs/elasticsearchnetwork.host:0.0.0.0http.port:9200http.cors.enabled:truehttp.cors.allow-origin:"*"EOF
cat <> ~/.bash_profileexportELASTICSEARCH_HOME=/data/app/elasticsearch/elasticsearch-5.5.0exportPATH=\$PATH:\$ELASTICSEARCH_HOME/binEOF
source~/.bash_profileelasticsearch -Vnohup elasticsearch > /data/logs/elasticsearch/elasticsearch.log2>&1&jps | grep Elasticsearchsudonetstat -nltp | grep -E'9200|9300'
访问 http://ip:9200
启动 elasticsearch nohup elasticsearch >/data/logs/elasticsearch/elasticsearch.log2>&1& jps |grepElasticsearch sudo netstat -nltp |grep-E'9200|9300'关闭 elasticsearch jps |grepElasticsearch | cut -d' '-f1 | xargskill-15jps |grepElasticsearch sudo netstat -nltp |grep-E'9200|9300'
# 安装node-v6.11.1(用于安装 elasticsearch-head 稍后介绍elasticsearch-head)
mkdir -p /data/app/nodejs/tmpwget http://dl.gm.tn/nodejs/node-v6.11.1-linux-x64.tar.gz -P /data/app/nodejs/tmptar -xf /data/app/nodejs/tmp/node-v6.11.1-linux-x64.tar.gz -C /data/app/nodejsmv /data/app/nodejs/node-v6.11.1-linux-x64 /data/app/nodejs/node-v6.11.1
cat <> ~/.bash_profileexportNODE_HOME=/data/app/nodejs/node-v6.11.1exportPATH=\$PATH:\$NODE_HOME/binexportNODE_PATH=\$NODE_HOME/lib/node_modulesEOF
source~/.bash_profilenode -v
# 安装 elasticsearch-head
elasticsearch-head 是一个用于管理Elasticsearch的web前端插件。
mkdir -p /data/app/elasticsearch-head/tmpwgethttp://dl.gm.tn/elasticsearch-head/elasticsearch-head-for-elasticsearch-5.5.0.tar.gz -P/data/app/elasticsearch-head/tmptar -xf /data/app/elasticsearch-head/tmp/elasticsearch-head-for-elasticsearch-5.5.0.tar.gz -C/data/app/elasticsearch-headcd /data/app/elasticsearch-head/elasticsearch-head-for-elasticsearch-5.5.0npm installcp /data/app/elasticsearch-head/elasticsearch-head-for-elasticsearch-5.5.0/_site/app.js /data/app/elasticsearch-head/elasticsearch-head-for-elasticsearch-5.5.0/_site/app.js_baksed -i's/localhost:9200/Elasticsearch服务器IP:9200/g'/data/app/elasticsearch-head/elasticsearch-head-for-elasticsearch-5.5.0/_site/app.js cp /data/app/elasticsearch-head/elasticsearch-head-for-elasticsearch-5.5.0/Gruntfile.js /data/app/elasticsearch-head/elasticsearch-head-for-elasticsearch-5.5.0/Gruntfile.js_baksed -i -e"/port: 9100/a\hostname: '0.0.0.0',"/data/app/elasticsearch-head/elasticsearch-head-for-elasticsearch-5.5.0/Gruntfile.js
cat <> ~/.bash_profileexportELASTICSEARCH_HEAD_HOME=/data/app/elasticsearch-head/elasticsearch-head-for-elasticsearch-5.5.0/node_modules/grunt/bin/exportGRUNT_PATH=\$NODE_HOME/node_modules/grunt-cli/bin/EOF
source~/.bash_profilegrunt -V/data/app/elasticsearch-head/elasticsearch-head-for-elasticsearch-5.5.0/node_modules/grunt/bin/grunt server &
# 安装 bigdesk
bigdesk是elasticsearch的一个集群监控工具,可以通过它来查看es集群的各种状态。
mkdir-p /data/app/bigdesk/tmpwget http://dl.gm.tn/bigdesk/bigdesk-for-elasticsearch-5.5.0.tar.gz -P /data/app/bigdesk/tmptar -xf /data/app/bigdesk/tmp/bigdesk-for-elasticsearch-5.5.0.tar.gz -C /data/app/bigdeskcd /data/app/bigdesk/bigdesk-for-elasticsearch-5.5.0/_sitenohup python -mSimpleHTTPServer &
# 安装 kibana
Kibana是一个开源的分析与可视化平台,设计出来用于和Elasticsearch一起使用的。
mkdir-p /data/app/kibana/tmpmkdir-p /data/logs/kibanawget http://dl.gm.tn/kibana/kibana-5.5.0-linux-x86_64.tar.gz -P /data/app/kibana/tmptar -xf /data/app/kibana/tmp/kibana-5.5.0-linux-x86_64.tar.gz -C /data/app/kibana
cat <>/data/app/kibana/kibana-5.5.0-linux-x86_64/config/kibana.ymlserver.port:5601server.host:"0.0.0.0"server.name:"kibana"elasticsearch.url:"http://Elasticsearch服务器IP:9200"EOF
cat <> ~/.bash_profileexportKIBANA_HOME=/data/app/kibana/kibana-5.5.0-linux-x86_64exportPATH=\$PATH:\$KIBANA_HOME/binEOF
source~/.bash_profilekibana -Vnohup kibana > /data/logs/kibana/kibana.log2>&1&
访问 http://ip:5601
#安装 x-pack插件
X-Pack是一个Elastic Stack的扩展,将安全,警报,监视,报告和图形功能包含在一个易于安装的软件包中。
网友评论