Tags: elasticsearch
主機(jī)環(huán)境
配置:
節(jié)點(diǎn)數(shù) | 4 |
---|---|
操作系統(tǒng) | CentOS Linux release 7.4.1708 (Core) |
內(nèi)存 | 16GB |
軟件環(huán)境
軟件 | 版本 | 下載地址 |
---|---|---|
jdk | jdk-8u172-linux-x64 | 點(diǎn)擊下載 |
elasticsearch | elasticsearch-6.3.1 | 點(diǎn)擊下載 |
kibana | kibana-6.3.1-linux-x86_64 | 點(diǎn)擊下載 |
主機(jī)規(guī)劃
4個(gè)節(jié)點(diǎn)角色規(guī)劃如下:
主機(jī)名 | pycdhnode1 | pycdhnode2 | pycdhnode3 | pycdhnode4 |
---|---|---|---|---|
IP | 192.168.0.158 | 192.168.0.159 | 192.168.0.160 | 192.168.0.161 |
master節(jié)點(diǎn) | yes | yes | yes | yes |
data節(jié)點(diǎn) | yes | yes | yes | yes |
kibana | yes | no | no | no |
注: 在實(shí)際生產(chǎn)中闷畸,還是建議master節(jié)點(diǎn)和data節(jié)點(diǎn)分離
主機(jī)安裝前準(zhǔn)備
1. 關(guān)閉所有節(jié)點(diǎn)的 SELinux
sed -i 's/^SELINUX=.*$/SELINUX=disabled/g' /etc/selinux/config
setenforce 0
2. 關(guān)閉所有節(jié)點(diǎn)防火墻 firewalld
or iptables
systemctl disable firewalld;
systemctl stop firewalld;
systemctl disable iptables;
systemctl stop iptables;
3. 開(kāi)啟所有節(jié)點(diǎn)時(shí)間同步 ntpdate
echo "*/5 * * * * /usr/sbin/ntpdate [asia.pool.ntp.org](http://asia.pool.ntp.org/) | logger -t NTP" >> /var/spool/cron/root
4. 設(shè)置所有節(jié)點(diǎn)語(yǔ)言編碼以及時(shí)區(qū)
echo 'export TZ=Asia/Shanghai' >> /etc/profile
echo 'export LANG=en_US.UTF-8' >> /etc/profile
. /etc/profile
5. 所有節(jié)點(diǎn)添加elasticsearch用戶(hù)
useradd -m elasticsearch
echo 'elasticsearch' | passwd --stdin elasticsearch
修改家目錄
mv /home/elasticsearch /application
chown -R elasticsearch. /application/elasticsearch
vi /etc/passwd
毛肋,修改elasticsearch用戶(hù)家目錄:
elasticsearch:x:1001:1001::/application/[elasticsearch:/bin/bash](http://elasticsearch/bin/bash)
設(shè)置PS1
su - elasticsearch
echo 'export PS1="\u@\h:\$PWD>"' >> ~/.bash_profile
echo "alias mv='mv -i'
alias rm='rm -i'" >> ~/.bash_profile
. ~/.bash_profile
6. 設(shè)置elasticsearch用戶(hù)之間免密登錄
首先在pycdhnode1主機(jī)生成秘鑰
su - elasticsearch
ssh-keygen -t rsa # 一直回車(chē)即可生成elasticsearch用戶(hù)的公鑰和私鑰
cd .ssh
vi id_rsa.pub # 去掉私鑰末尾的主機(jī)名 elasticsearch@pycdhnode1
cat id_rsa.pub > authorized_keys
chmod 600 authorized_keys
壓縮.ssh文件夾
su - elasticsearch
zip -r ssh.zip .ssh
隨后分發(fā)ssh.zip到pycdhnode2-4主機(jī)elasticsearch用戶(hù)家目錄解壓即完成免密登錄
7. 主機(jī)內(nèi)核參數(shù)優(yōu)化以及最大文件打開(kāi)數(shù)原朝、最大進(jìn)程數(shù)等參數(shù)優(yōu)化
不同主機(jī)優(yōu)化參數(shù)有可能不一樣,故這里不作出具體優(yōu)化方法瞻坝,但如果elasticsearch環(huán)境用于正式生產(chǎn)墩虹,必須優(yōu)化航厚,linux默認(rèn)參數(shù)可能會(huì)導(dǎo)致elasticsearch無(wú)法啟動(dòng)或者集群性能低下昆码。
注: 以上操作需要使用 root
用戶(hù)气忠,到目前為止操作系統(tǒng)環(huán)境已經(jīng)準(zhǔn)備完成邻储,以下開(kāi)始正式安裝赋咽,后面的操作如果不做特殊說(shuō)明均使用 elasticsearch
用戶(hù)
安裝jdk1.8
所有節(jié)點(diǎn)都需要安裝,安裝方式都一樣
解壓 jdk-8u172-linux-x64.tar.gz
tar zxvf jdk-8u172-linux-x64.tar.gz
mkdir -p /application/elasticsearch/app
mv jdk-8u172-linux-x64 /application/elasticsearch/app/jdk
rm -f jdk-8u172-linux-x64.tar.gz
配置環(huán)境變量
vi ~/.bash_profile
添加以下內(nèi)容:
#java
export JAVA_HOME=/application/elasticsearch/app/jdk
export CLASSPATH=.:$JAVA_HOME/lib:$CLASSPATH
export PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin
加載環(huán)境變量
. ~/.bash_profile
查看是否安裝成功 java -version
java version "1.8.0_172"
Java(TM) SE Runtime Environment (build 1.8.0_172-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.172-b11, mixed mode)
如果出現(xiàn)以上結(jié)果證明安裝成功吨娜。
安裝elasticsearch
首先在pycdhnode1上安裝
解壓 elasticsearch-6.3.1.tar.gz
tar zxvf elasticsearch-6.3.1.tar.gz
mv elasticsearch-6.3.1 /application/elasticsearch/app/elasticsearch
rm -f elasticsearch-6.3.1.tar.gz
設(shè)置環(huán)境變量
vi ~/.bash_profile
添加以下內(nèi)容:
#elasticsearch
export ELASTICSEARCH_HOME=/application/elasticsearch/app/elasticsearch
export PATH=$PATH:$ELASTICSEARCH_HOME/bin
加載環(huán)境變量
. ~/.bash_profile
添加配置文件
vi /application/elasticsearch/app/elasticsearch/config/elasticsearch.yml
:
# ======================== Elasticsearch Configuration =========================
#
# NOTE: Elasticsearch comes with reasonable defaults for most settings.
# Before you set out to tweak and tune the configuration, make sure you
# understand what are you trying to accomplish and the consequences.
#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.
#
# Please consult the documentation for further information on configuration options:
# [https://www.elastic.co/guide/en/elasticsearch/reference/index.html](https://www.elastic.co/guide/en/elasticsearch/reference/index.html)
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
#[cluster.name](http://cluster.name/): py_es_6.3
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
#[node.name](http://node.name/): pyesnode-1
#
# Add custom attributes to the node:
#
#node.attr.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
#path.data: /path/to/data
#
# Path to log files:
#
#path.logs: /path/to/logs
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
#bootstrap.memory_lock: true
#
# Make sure that the heap size is set to about half the memory available
# on the system and that the owner of the process is allowed to use this
# limit.
#
# Elasticsearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# Set the bind address to a specific IP (IPv4 or IPv6):
#
#network.host: 192.168.0.1
#
# Set a custom port for HTTP:
#
#http.port: 9200
#
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when new node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
#discovery.zen.ping.unicast.hosts: ["host1", "host2"]
#
# Prevent the "split brain" by configuring the majority of nodes (total number of master-eligible nodes / 2 + 1):
#
#discovery.zen.minimum_master_nodes:
#
# For more information, consult the zen discovery module documentation.
#
# ---------------------------------- Gateway -----------------------------------
#
# Block initial recovery after a full cluster restart until N nodes are started:
#
#gateway.recover_after_nodes: 3
#
# For more information, consult the gateway module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true
#集群的名稱(chēng)
[cluster.name](http://cluster.name/): pyes6.3
#節(jié)點(diǎn)名稱(chēng),其余3個(gè)節(jié)點(diǎn)分別為pyesnode-2,pyesnode-3,pyesnode-4
[node.name](http://node.name/): pyesnode-1
#指定該節(jié)點(diǎn)是否有資格被選舉成為master節(jié)點(diǎn)脓匿,默認(rèn)是true,es是默認(rèn)集群中的第一臺(tái)機(jī)器為master宦赠,如果這臺(tái)機(jī)掛了就會(huì)重新選舉master
node.master: true
#允許該節(jié)點(diǎn)存儲(chǔ)數(shù)據(jù)(默認(rèn)開(kāi)啟)
node.data: true
#實(shí)際生產(chǎn)可以master節(jié)點(diǎn)和data數(shù)據(jù)分離
#索引數(shù)據(jù)的存儲(chǔ)路徑,多個(gè)目錄使用 , 分割
path.data: /application/elasticsearch/data/esdata
#日志文件的存儲(chǔ)路徑
path.logs: /application/elasticsearch/app/elasticsearch/logs
#設(shè)置為true來(lái)鎖住內(nèi)存陪毡。因?yàn)閮?nèi)存交換到磁盤(pán)對(duì)服務(wù)器性能來(lái)說(shuō)是致命的,當(dāng)jvm開(kāi)始swapping時(shí)es的效率會(huì)降低勾扭,所以要保證它不swap
#bootstrap.memory_lock: true
bootstrap.memory_lock: false
#服務(wù)器內(nèi)存小毡琉,設(shè)置允許使用swap
#綁定的ip地址
network.host: 0.0.0.0
#設(shè)置對(duì)外服務(wù)的http端口,默認(rèn)為9200
http.port: 9200
# 設(shè)置節(jié)點(diǎn)間交互的tcp端口,默認(rèn)是9300
transport.tcp.port: 9300
#Elasticsearch將綁定到可用的環(huán)回地址妙色,并將掃描端口9300到9305以嘗試連接到運(yùn)行在同一臺(tái)服務(wù)器上的其他節(jié)點(diǎn)桅滋。
#這提供了自動(dòng)集群體驗(yàn),而無(wú)需進(jìn)行任何配置。數(shù)組設(shè)置或逗號(hào)分隔的設(shè)置丐谋。每個(gè)值的形式應(yīng)該是host:port或host
#(如果沒(méi)有設(shè)置芍碧,port默認(rèn)設(shè)置會(huì)transport.profiles.default.port 回落到transport.tcp.port)。
#請(qǐng)注意号俐,IPv6主機(jī)必須放在括號(hào)內(nèi)泌豆。默認(rèn)為127.0.0.1, [::1]
discovery.zen.ping.unicast.hosts: ["pycdhnode1:9300", "pycdhnode2:9300", "pycdhnode3:9300", "pycdhnode4:9300"]
#如果沒(méi)有這種設(shè)置,遭受網(wǎng)絡(luò)故障的集群就有可能將集群分成兩個(gè)獨(dú)立的集群 - 分裂的大腦 - 這將導(dǎo)致數(shù)據(jù)丟失,一般設(shè)置(N/2)+1
discovery.zen.minimum_master_nodes: 3
#為了使新加入的節(jié)點(diǎn)快速確定master位置吏饿,可以將data節(jié)點(diǎn)的默認(rèn)的master發(fā)現(xiàn)方式有multicast修改為unicast:選擇性配置
#discovery.zen.ping.multicast.enabled: false
#discovery.zen.ping.unicast.hosts: ["pycdhnode1", "pycdhnode2", "pycdhnode3", "pycdhnode4"]
- 其中的
[node.name](http://node.name/)
配置每個(gè)節(jié)點(diǎn)必須不一樣
設(shè)置節(jié)點(diǎn)內(nèi)存使用量 vi /application/elasticsearch/app/elasticsearch/config/jvm.options
-Xms3g
-Xmx3g
- 最小與最大必須設(shè)置一樣
- 由于jvm內(nèi)存回收的原因踪危,當(dāng)內(nèi)存使用超過(guò)32G時(shí),性能會(huì)降低猪落,故每個(gè)節(jié)點(diǎn)推薦最高設(shè)置31G
- elasticsearch 2.x 版本設(shè)置內(nèi)存使用在 $ELASTICSEARCH_HOME/bin/elasticsearch.in.sh中
ES_MIN_MEM=3g
與
ES_MAX_MEM=3g
創(chuàng)建所需目錄
mkdir -p /application/elasticsearch/data/esdata
復(fù)制elasticsearch到pycdhnode2-4
scp ~/.bash_profile [pycdhnode2:/application/elasticsearch](http://pycdhnode2/application/elasticsearch)
scp ~/.bash_profile [pycdhnode3:/application/elasticsearch](http://pycdhnode3/application/elasticsearch)
scp ~/.bash_profile [pycdhnode4:/application/elasticsearch](http://pycdhnode4/application/elasticsearch)
scp -pr /application/elasticsearch/app/elasticsearch [pycdhnode2:/application/elasticsearch/app](http://pycdhnode2/application/elasticsearch/app)
scp -pr /application/elasticsearch/app/elasticsearch [pycdhnode3:/application/elasticsearch/app](http://pycdhnode3/application/elasticsearch/app)
scp -pr /application/elasticsearch/app/elasticsearch [pycdhnode4:/application/elasticsearch/app](http://pycdhnode4/application/elasticsearch/app)
ssh pycdhnode2 "mkdir -p /application/elasticsearch/data/esdata"
ssh pycdhnode3 "mkdir -p /application/elasticsearch/data/esdata"
ssh pycdhnode4 "mkdir -p /application/elasticsearch/data/esdata"
- 修改pycdhnode1-4
/application/elasticsearch/app/elasticsearch/config/elasticsearch.yml
中的[node.name](http://node.name/)
pycdhnode1為:pyesnode-1 陨倡;pycdhnode2為:pyesnode-2 ;pycdhnode3為:pyesnode-3 许布;pycdhnode4為:pyesnode-4
優(yōu)化所有主機(jī)參數(shù)兴革,否則無(wú)法啟動(dòng)
vi /etc/sysctl.conf
vm.max_map_count=655360
生效
sysctl -p
vi /etc/security/limits.conf
添加以下內(nèi)容:
* soft nofile 65536
* hard nofile 65536
* soft nproc 65536
* hard nproc 65536
vi /etc/security/limits.d/20-nproc.conf
添加以下內(nèi)容:
* soft nproc 65536
root soft nproc unlimited
重啟登錄 ulimit -a
查看是否生效
$ ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 63488
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 65536
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 65536
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
啟動(dòng)elasticsearch
4個(gè)節(jié)點(diǎn)均啟動(dòng)
/application/elasticsearch/app/elasticsearch/bin/elasticsearch -d
- -d 后臺(tái)服務(wù)的方式啟動(dòng)
- 如果啟動(dòng)異常,查看日志
/application/elasticsearch/app/elasticsearch/logs/pyes6.3.log
查看進(jìn)程
jps
其中 Elasticsearch
進(jìn)程即為 elasticsearch
停止elasticsearch
kill pid
查看集群狀態(tài)
$ curl pycdhnode1:9200/_cat/health?v
epoch timestamp cluster status node.total node.data shards pri relo init unassign pending_tasks max_task_wait_time active_shards_percent
1531123674 16:07:54 pyes6.3 green 4 4 0 0 0 0 0 0 - 100.0%
- es 集群一共3種狀態(tài):
green
蜜唾,yellow
杂曲,red
- 可以看到集群節(jié)點(diǎn)有4個(gè),集群狀態(tài)為
green
袁余,正常
head插件安裝
ElasticSearch-head是一個(gè)H5編寫(xiě)的ElasticSearch集群操作和管理工具擎勘,可以對(duì)集群進(jìn)行傻瓜式操作。
- 顯示集群的拓?fù)?并且能夠執(zhí)行索引和節(jié)點(diǎn)級(jí)別操作
- 搜索接口能夠查詢(xún)集群中原始json或表格格式的檢索數(shù)據(jù)
- 能夠快速訪問(wèn)并顯示集群的狀態(tài)
- 有一個(gè)輸入窗口,允許任意調(diào)用RESTful API颖榜。這個(gè)接口包含幾個(gè)選項(xiàng),可以組合在一起以產(chǎn)生有趣的結(jié)果;
- 5.0版本之前可以通過(guò)plugin安裝棚饵,直接解壓便可運(yùn)行,很綠色掩完,5.0之后安裝就需要使用nodejs噪漾,然后以獨(dú)立服務(wù)的方式啟動(dòng),不太方便且蓬,可以直接通過(guò)安裝谷歌瀏覽器插件 elasticsearch-head-chrome欣硼。
首先在es集群所有節(jié)點(diǎn)添加配置文件 vi /application/elasticsearch/app/elasticsearch/config/elasticsearch.yml
http.cors.enabled: true
http.cors.allow-origin: "*"
在pycdhnode1上面安裝,然后其他主機(jī)可以選裝恶阴,安裝方法一樣诈胜。
安裝NodeJS
wget [https://npm.taobao.org/mirrors/node/latest-v4.x/node-v4.5.0-linux-x64.tar.gz](https://npm.taobao.org/mirrors/node/latest-v4.x/node-v4.5.0-linux-x64.tar.gz)
tar zxvf node-v4.5.0-linux-x64.tar.gz
mv node-v4.5.0-linux-x64 app/node
rm -f node-v4.5.0-linux-x64.tar.gz
添加環(huán)境變量 vi ~/.bash_profile
#node
export NODE_HOME=/application/elasticsearch/app/node
export PATH=$PATH:$NODE_HOME/bin
export NODE_PATH=$NODE_HOME/lib/node_modules
加載環(huán)境變量
. ~/.bash_profile
安裝npm與grunt
npm install -g cnpm --registry=[https://registry.npm.taobao.org](https://registry.npm.taobao.org/)
npm install -g grunt
npm install -g grunt-cli --registry=[https://registry.npm.taobao.org](https://registry.npm.taobao.org/) --no-proxy
下載head插件并安裝
wget [https://github.com/mobz/elasticsearch-head/archive/master.zip](https://github.com/mobz/elasticsearch-head/archive/master.zip)
unzip master.zip
mv elasticsearch-head-master app
修改配置文件
vi /application/elasticsearch/app/elasticsearch-head-master/Gruntfile.js
, 修改以下內(nèi)容
connect: {
server: {
options: {
hostname: '0.0.0.0',
port: 9100,
base: '.',
keepalive: true
}
}
}
- 可以不修改,默認(rèn)監(jiān)聽(tīng)9100
繼續(xù)編輯 vi /application/elasticsearch/app/elasticsearch-head-master/_site/app.js
, 修改以下內(nèi)容
this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "[http://pycdhnode1:9200](http://pycdhnode1:9200/)";
- 如不修改冯事,默認(rèn)連接
[http://pycdhnode1:9200
焦匈,這里可以修改為集群任一主機(jī)](http://pycdhnode1:9200`%EF%BC%8C%E8%BF%99%E9%87%8C%E5%8F%AF%E4%BB%A5%E4%BF%AE%E6%94%B9%E4%B8%BA%E9%9B%86%E7%BE%A4%E4%BB%BB%E4%B8%80%E4%B8%BB%E6%9C%BA/)
下載依賴(lài)安裝
cd /application/elasticsearch/app/elasticsearch-head-master
npm install
- 必須在head插件目錄中操作
啟動(dòng) head 插件
方法1:使用npm
cd /application/elasticsearch/app/elasticsearch-head-master
npm run start
方法2:直接使用grunt
cd /application/elasticsearch/app/elasticsearch-head-master
grunt server
- 必須在head插件目錄中操作
- npm 啟動(dòng)方式本質(zhì)上都是調(diào)用grunt啟動(dòng)
- 兩種啟動(dòng)方式都不是后臺(tái)啟動(dòng),如需后臺(tái)運(yùn)行昵仅,請(qǐng)使用nohup
訪問(wèn) head:
停止 head:
首先通過(guò) ps aux|grep grunt
查找到進(jìn)程 pid
缓熟,然后 kill pid
ElasticHQ管理工具安裝
ElasticHQ 是一款開(kāi)源的具有良好體驗(yàn)、直觀和功能強(qiáng)大的 ElasticSearch 的管理和監(jiān)控工具。提供實(shí)時(shí)監(jiān)控荚虚、全集群管理薛夜、搜索和查詢(xún),無(wú)需額外軟件安裝版述。最新版本支持ElasticSearch 2.x, 5.x, 6.x梯澜。
特點(diǎn):
1、激活ES集群和節(jié)點(diǎn)實(shí)時(shí)監(jiān)控渴析;
2晚伙、管理索引、分片俭茧、映射咆疗、別名、節(jié)點(diǎn)母债;
3午磁、為多個(gè)索引查詢(xún)提供查詢(xún)UI;
4毡们、REST UI迅皇,不需要cURL和繁瑣的JSON格式;
5衙熔、100%基于瀏覽器登颓,不需下載軟件;
6红氯、免費(fèi)框咙;
ElasticHQ 是基于python的Django開(kāi)發(fā)的,最新版本的安裝需要python3.4以上痢甘,安裝與啟動(dòng)程序比較簡(jiǎn)單喇嘱,但要安裝python3.4以上環(huán)境比較麻煩,故我們直接采用官方提供的docker容器安裝产阱,簡(jiǎn)單方便
首先在pull最新官方鏡像
docker pull elastichq/elasticsearch-hq
啟動(dòng)容器
docker run -d -p 9999:5000 --name es elastichq/elasticsearch-hq
訪問(wèn)
- 打開(kāi)首頁(yè)后在輸入框輸入es集群隨意一臺(tái)節(jié)點(diǎn)地址確認(rèn)即可
更多詳情參見(jiàn):https://github.com/ElasticHQ/elasticsearch-HQ
kibana安裝
Kibana 是一個(gè)開(kāi)源的分析和可視化平臺(tái)婉称,旨在與 Elasticsearch 合作块仆。Kibana 提供搜索构蹬、查看和與存儲(chǔ)在 Elasticsearch 索引中的數(shù)據(jù)進(jìn)行交互的功能。開(kāi)發(fā)者或運(yùn)維人員可以輕松地執(zhí)行高級(jí)數(shù)據(jù)分析悔据,并在各種圖表庄敛、表格和地圖中可視化數(shù)據(jù)。
kibana本身只提供單點(diǎn)安裝科汗,如果想避免單點(diǎn)故障藻烤,需要結(jié)合lvs,haproxy,nginx等負(fù)載均衡軟件實(shí)現(xiàn)高可用怖亭,在這里我們 只在pycdhnode1上面安裝涎显,然后其他主機(jī)可以選裝,安裝方法一樣兴猩。
安裝kibana
tar -zxvf kibana-6.3.1-linux-x86_64.tar.gz
mv kibana-6.3.1-linux-x86_64 app/kibana
rm -f kibana-6.3.1-linux-x86_64.tar.gz
添加環(huán)境變量 vi ~/.bash_profile
#kibana
export KIBANA_HOME=/application/elasticsearch/app/kibana
export PATH=$PATH:$KIBANA_HOME/bin
加載環(huán)境變量
. ~/.bash_profile
配置文件 vi /application/elasticsearch/app/kibana/config/kibana.yml
# Kibana is served by a back end server. This setting specifies the port to use.
server.port: 5601
# 監(jiān)聽(tīng)端口
# Specifies the address to which the Kibana server will bind. IP addresses and host names are both valid values.
# The default is 'localhost', which usually means remote machines will not be able to connect.
# To allow connections from remote users, set this parameter to a non-loopback address.
server.host: "0.0.0.0"
# 監(jiān)聽(tīng)地址
# Enables you to specify a path to mount Kibana at if you are running behind a proxy.
# Use the `server.rewriteBasePath` setting to tell Kibana if it should remove the basePath
# from requests it receives, and to prevent a deprecation warning at startup.
# This setting cannot end in a slash.
#server.basePath: ""
# Specifies whether Kibana should rewrite requests that are prefixed with
# `server.basePath` or require that they are rewritten by your reverse proxy.
# This setting was effectively always `false` before Kibana 6.3 and will
# default to `true` starting in Kibana 7.0.
#server.rewriteBasePath: false
# The maximum payload size in bytes for incoming server requests.
#server.maxPayloadBytes: 1048576
# The Kibana server's name. This is used for display purposes.
[server.name](http://server.name/): "pycdhnode1"
# The URL of the Elasticsearch instance to use for all your queries.
elasticsearch.url: "[http://pycdhnode1:9200](http://pycdhnode1:9200/)"
# es連接地址期吓,只能配置一個(gè)節(jié)點(diǎn)地址,如果需要高可用倾芝,需要es集群配合lvs讨勤,haproxy負(fù)載均衡提供
# When this setting's value is true Kibana uses the hostname specified in the server.host
# setting. When the value of this setting is false, Kibana uses the hostname of the host
# that connects to this Kibana instance.
#elasticsearch.preserveHost: true
# Kibana uses an index in Elasticsearch to store saved searches, visualizations and
# dashboards. Kibana creates a new index if the index doesn't already exist.
#kibana.index: ".kibana"
# The default application to load.
#kibana.defaultAppId: "home"
# If your Elasticsearch is protected with basic authentication, these settings provide
# the username and password that the Kibana server uses to perform maintenance on the Kibana
# index at startup. Your Kibana users still need to authenticate with Elasticsearch, which
# is proxied through the Kibana server.
#elasticsearch.username: "user"
#elasticsearch.password: "pass"
# Enables SSL and paths to the PEM-format SSL certificate and SSL key files, respectively.
# These settings enable SSL for outgoing requests from the Kibana server to the browser.
#server.ssl.enabled: false
#server.ssl.certificate: /path/to/your/server.crt
#server.ssl.key: /path/to/your/server.key
# Optional settings that provide the paths to the PEM-format SSL certificate and key files.
# These files validate that your Elasticsearch backend uses the same key files.
#elasticsearch.ssl.certificate: /path/to/your/client.crt
#elasticsearch.ssl.key: /path/to/your/client.key
# Optional setting that enables you to specify a path to the PEM file for the certificate
# authority for your Elasticsearch instance.
#elasticsearch.ssl.certificateAuthorities: [ "/path/to/your/CA.pem" ]
# To disregard the validity of SSL certificates, change this setting's value to 'none'.
#elasticsearch.ssl.verificationMode: full
# Time in milliseconds to wait for Elasticsearch to respond to pings. Defaults to the value of
# the elasticsearch.requestTimeout setting.
#elasticsearch.pingTimeout: 1500
# Time in milliseconds to wait for responses from the back end or Elasticsearch. This value
# must be a positive integer.
#elasticsearch.requestTimeout: 30000
# List of Kibana client-side headers to send to Elasticsearch. To send *no* client-side
# headers, set this value to [] (an empty list).
#elasticsearch.requestHeadersWhitelist: [ authorization ]
# Header names and values that are sent to Elasticsearch. Any custom headers cannot be overwritten
# by client-side headers, regardless of the elasticsearch.requestHeadersWhitelist configuration.
#elasticsearch.customHeaders: {}
# Time in milliseconds for Elasticsearch to wait for responses from shards. Set to 0 to disable.
#elasticsearch.shardTimeout: 30000
# Time in milliseconds to wait for Elasticsearch at Kibana startup before retrying.
#elasticsearch.startupTimeout: 5000
# Logs queries sent to Elasticsearch. Requires logging.verbose set to true.
#elasticsearch.logQueries: false
# Specifies the path where Kibana creates the process ID file.
#pid.file: /var/run/kibana.pid
# Enables you specify a file where Kibana stores log output.
#logging.dest: stdout
# Set the value of this setting to true to suppress all logging output.
#logging.silent: false
# Set the value of this setting to true to suppress all logging output other than error messages.
#logging.quiet: false
# Set the value of this setting to true to log all events, including system usage information
# and all requests.
#logging.verbose: false
# Set the interval in milliseconds to sample system and process performance
# metrics. Minimum is 100ms. Defaults to 5000.
#ops.interval: 5000
# The default locale. This locale can be used in certain circumstances to substitute any missing
# translations.
#i18n.defaultLocale: "en"
xpack.security.enabled: false
# 關(guān)閉xpack驗(yàn)證;由于集群為配置xpack晨另,故必須關(guān)閉潭千,否則無(wú)法正常連接es集群
啟動(dòng) kibana
方法1:控制臺(tái)啟動(dòng)
kibana
- 退出回話或者
ctrl + c
會(huì)退出
方法2:使用nohup后臺(tái)啟動(dòng)
cd /application/elasticsearch/app/kibana
mkdir logs
nohup kibana > logs/server.log 2>&1 &
訪問(wèn) kibana:
停止 kibana:
首先通過(guò) ps aux|grep kibana
查找到進(jìn)程 pid
,然后 kill pid
更多kibana使用方法參考官網(wǎng):https://www.elastic.co/guide/en/kibana/6.3/index.html