您好,登錄后才能下訂單哦!
開篇閑話,如果是新人在接觸ELKstack什么都不懂的情況下,可以先看看各位前人寫的關于ELKstack的博客,如何對ELKstack部署安裝及使用,但是別人的東西只能作為借鑒,在自己搭建使用一定要以官方文檔為準。
一定要注意軟件版本,這里系統集合類軟件,如果各軟件版本不一致,會造成不可預估的后果!!!
官方文檔: https://www.elastic.co/products/elasticsearch
elasticsearsh權威指南: http://es.xiaoleilu.com/
kibana中文指南: http://kibana.logstash.es/content/
打開官網-->訪問docs
我們以最新版本2.3來進行引導
設置java環境
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
啟動elasticsearch
./elasticsearch
啟動信息:
./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
設置集群名和節點名
./elasticsearch --cluster.name my_cluster_name --node.name my_node_name
安裝GPG驗證KEY
rpm --import https://packages.elastic.co/GPG-KEY-elasticsearch
把下面的源配置加入到 /etc/yum.repos.d/目錄中的 a.repo文件里, 可以起名為:elasticsearch.repo
怎么配elasticsearch的repo源,我想中級以上的小伙伴都會
[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的模板,寫的比較粗糙,也是剛開始寫,很多自定義配置未加入到模板中,后面會逐步改進,內容里不會涉及新手的入門知識,此類入門知識會逐步在salt模塊進行分享。
配置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模板存在問題:
1. 沒有很好的使用到各類自定義和動態參數
2. 沒有進行分層
我考慮應該使用一個應用的生命周期來進行分層,服務器始終保持無狀態
安裝前預環境 --> 安裝 --> 升級
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。