開篇閑話,如果是新人在接觸ELKstack什么都不懂的情況下,可以先看看各位前人寫的關(guān)于ELKstack的博客,如何對(duì)ELKstack部署安裝及使用,但是別人的東西只能作為借鑒,在自己搭建使用一定要以官方文檔為準(zhǔn)。
十多年的瑞昌網(wǎng)站建設(shè)經(jīng)驗(yàn),針對(duì)設(shè)計(jì)、前端、開發(fā)、售后、文案、推廣等六對(duì)一服務(wù),響應(yīng)快,48小時(shí)及時(shí)工作處理。全網(wǎng)整合營(yíng)銷推廣的優(yōu)勢(shì)是能夠根據(jù)用戶設(shè)備顯示端的尺寸不同,自動(dòng)調(diào)整瑞昌建站的顯示方式,使網(wǎng)站能夠適用不同顯示終端,在瀏覽器中調(diào)整網(wǎng)站的寬度,無(wú)論在任何一種瀏覽器上瀏覽網(wǎng)站,都能展現(xiàn)優(yōu)雅布局與設(shè)計(jì),從而大程度地提升瀏覽體驗(yàn)。創(chuàng)新互聯(lián)從事“瑞昌網(wǎng)站設(shè)計(jì)”,“瑞昌網(wǎng)站推廣”以來(lái),每個(gè)客戶項(xiàng)目都認(rèn)真落實(shí)執(zhí)行。一定要注意軟件版本,這里系統(tǒng)集合類軟件,如果各軟件版本不一致,會(huì)造成不可預(yù)估的后果?。。?
官方文檔: https://www.elastic.co/products/elasticsearch
elasticsearsh權(quán)威指南: http://es.xiaoleilu.com/
kibana中文指南: http://kibana.logstash.es/content/
打開官網(wǎng)-->訪問(wèn)docs
我們以最新版本2.3來(lái)進(jìn)行引導(dǎo)
設(shè)置java環(huán)境
java -version
echo $JAVA_HOME
下載elasticsearch壓縮包
curl -L -O https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/tar/elasticsearch/2.3.3/elasticsearch-2.3.3.tar.gz
解壓壓縮包,解壓后可以直接使用
tar -xvf elasticsearch-2.3.3.tar.gz
cd elasticsearch-2.3.3/bin
啟動(dòng)elasticsearch
./elasticsearch
啟動(dòng)信息:
./elasticsearch
[2014-03-13 13:42:17,218][INFO ][node ] [New Goblin] version[2.3.3], pid[2085], build[5c03844/2014-02-25T15:52:53Z]
[2014-03-13 13:42:17,219][INFO ][node ] [New Goblin] initializing ...
[2014-03-13 13:42:17,223][INFO ][plugins ] [New Goblin] loaded [], sites []
[2014-03-13 13:42:19,831][INFO ][node ] [New Goblin] initialized
[2014-03-13 13:42:19,832][INFO ][node ] [New Goblin] starting ...
[2014-03-13 13:42:19,958][INFO ][transport ] [New Goblin] bound_address {inet[/0:0:0:0:0:0:0:0:9300]}, publish_address {inet[/192.168.8.112:9300]}
[2014-03-13 13:42:23,030][INFO ][cluster.service] [New Goblin] new_master [New Goblin][rWMtGj3dQouz2r6ZFL9v4g][mwubuntu1][inet[/192.168.8.112:9300]], reason: zen-disco-join (elected_as_master)
[2014-03-13 13:42:23,100][INFO ][discovery ] [New Goblin] elasticsearch/rWMtGj3dQouz2r6ZFL9v4g
[2014-03-13 13:42:23,125][INFO ][http ] [New Goblin] bound_address {inet[/0:0:0:0:0:0:0:0:9200]}, publish_address {inet[/192.168.8.112:9200]}
[2014-03-13 13:42:23,629][INFO ][gateway ] [New Goblin] recovered [1] indices into cluster_state
[2014-03-13 13:42:23,630][INFO ][node ] [New Goblin] started
設(shè)置集群名和節(jié)點(diǎn)名
./elasticsearch --cluster.name my_cluster_name --node.name my_node_name
安裝GPG驗(yàn)證KEY
rpm --import https://packages.elastic.co/GPG-KEY-elasticsearch
把下面的源配置加入到 /etc/yum.repos.d/目錄中的 a.repo文件里, 可以起名為:elasticsearch.repo
怎么配elasticsearch的repo源,我想中級(jí)以上的小伙伴都會(huì)
[elasticsearch-2.x]
name=Elasticsearch repository for 2.x packages
baseurl=https://packages.elastic.co/elasticsearch/2.x/centos
gpgcheck=1
gpgkey=https://packages.elastic.co/GPG-KEY-elasticsearch
enabled=1
yum安裝即可
yum install elasticsearch
此處只是分享下salt安裝elasticsearch的模板,寫的比較粗糙,也是剛開始寫,很多自定義配置未加入到模板中,后面會(huì)逐步改進(jìn),內(nèi)容里不會(huì)涉及新手的入門知識(shí),此類入門知識(shí)會(huì)逐步在salt模塊進(jìn)行分享。
配置state目錄
file_roots:
base_init:
- /etc/salt/states
配置top.sls
[root@sz-a-saltstack-xen states]# cat /etc/salt/states/top.sls
'*':
- init.yum_config
- init.selinux_shutdown
- init.limit
- init.sshd_config
- init.clock_config
- init.ntp_config
- init.user_config
- init.salt_minion_config
- init.tty_init
- init.zabbix_agent
'sz-a-qhfaxes0[1,3]-es-hw':
- jdk
- elkstack.es
配置elkstack 目錄es.sls
elasticsearch-2:
pkgrepo.managed:
- humanname: Elasticsearch repository for 2.x packages
- baseurl: https://packages.elastic.co/elasticsearch/2.x/centos
- gpgcheck: 1
- gpgkey: https://packages.elastic.co/GPG-KEY-elasticsearch
elasticsearch-server:
pkg.installed:
- pkgs:
- elasticsearch
- git
- openssl.x86_64
- openssl-devel.x86_64
/etc/elasticsearch/elasticsearch.yml:
file.managed:
- source: salt://elkstack/files/elasticsearch.yml
- template: jinja
- user: elasticsearch
- group: elasticsearch
- require:
- pkg: elasticsearch-server
/data/qhfax_elckstack:
file.directory:
- user: elasticsearch
- group: elasticsearch
- makedirs: True
elasticsearch_log_path:
file.directory:
- name: /var/log/elasticsearch
- user: elasticsearch
- group: elasticsearch
- makedirs: True
elasticsearch:
service.running:
- enable: True
- watch:
- pkg: elasticsearch-server
- file: /etc/elasticsearch/elasticsearch.yml
service_plugins_install:
file.directory:
- name: /root/soft
- makedirs: True
cmd.run:
- cwd: /root/soft
- name: git clone https://github.com/elasticsearch/elasticsearch-servicewrapper.git && ls
- unless: test -d /root/soft/elasticsearch-servicewrapper
mv_service_es:
cmd.run:
- cwd: /root/soft
- name: cp -a elasticsearch-servicewrapper/service/ /usr/share/elasticsearch/bin
- unless:
- test -d /usr/share/elasticsearch/bin/service
- test -d elasticsearch-servicewrapper/service || echo False
head_plugins_install:
cmd.run:
- cwd: /usr/share/elasticsearch/bin
- name: /usr/share/elasticsearch/bin/plugin install mobz/elasticsearch-head
- unless: test -d /usr/share/elasticsearch/plugins/head
license_plugins_install:
cmd.run:
- cwd: /usr/share/elasticsearch/bin
- name: /usr/share/elasticsearch/bin/plugin install license
- unless:
- test -d /usr/share/elasticsearch/plugins/license
marvel_plugins_install:
cmd.run:
- cwd: /usr/share/elasticsearch/bin
- name: /usr/share/elasticsearch/bin/plugin install marvel-agent
- unless:
- test -d /usr/share/elasticsearch/plugins/marvel-agent
上文sls模板存在問(wèn)題:
1. 沒(méi)有很好的使用到各類自定義和動(dòng)態(tài)參數(shù)
2. 沒(méi)有進(jìn)行分層
我考慮應(yīng)該使用一個(gè)應(yīng)用的生命周期來(lái)進(jìn)行分層,服務(wù)器始終保持無(wú)狀態(tài)
安裝前預(yù)環(huán)境 --> 安裝 --> 升級(jí)
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無(wú)理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。