前提準備:
1,安裝jdk, We recommend installing Java version 1.8.0_131 or later.
2, 設置文件最大打開數(使用命令ulimit -n查看)
ulimit -n 65536
3, 建立用戶elastic/用戶組elastic
groupadd elastic
useradd elastic -g elasticnode
4,設置用戶可鎖定內存
修改/etc/security/limits.conf,linux
添加行:
# allow user 'elastic' mlockall
elastic soft memlock unlimited
elastic hard memlock unlimitedbootstrap
5,設置最大虛擬內存:
vi /etc/sysctl.conf
添加行:vm.max_map_count=655360
而後執行命令:
sysctl -p瀏覽器
elastic用戶登陸安裝和啓動:
1,下載對應的elastic search版本
cd /usr/local
mkdir elasticsearch
cd elasticsearch
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.6.12.zip
sha1sum elasticsearch-5.6.12.zip
unzip elasticsearch-5.6.12.zip
cd elasticsearch-5.6.12/安全
2, 配置elastic search
cd /usr/local/elasticsearch/elasticsearch-5.6.12/conf
vi elasticsearch.ymljvm
#設置集羣名稱和本節點名稱
cluster.name: skywalking-es-cluster
#每一個節點名字不同
node.name: node-masterelasticsearch
#設置日誌目錄和數據目錄,最好是掛在不一樣的磁盤驅動器,提升刷盤速度
path.data: /elastic-search/data
path.logs: /elastic-search/logurl
#鎖定elastic search進程使用的mmap內存(磁盤文件mmap到內存中提升查詢和寫速度),防止被linux操做系統進行交換到磁盤,此功能須要和前提準備的設置linux用戶鎖定內存大小配合
bootstrap.memory_lock: truespa
#綁定對外服務的Ip和端口
network.host: 192.168.0.1
http.port: 9200操作系統
#設置集羣發現參數
#獲取整個集羣節點信息的節點來源,從下面ip的節點交換信息來獲取
discovery.zen.ping.unicast.hosts: ["10.218.33.71", "10.218.33.70", "10.218.33.72"]
#配置最少參與選舉master節點的個數,防止腦裂(集羣存在多個Master的狀況)
discovery.zen.minimum_master_nodes: 3
#禁止掉安全認證,部署skywalking時須要
xpack.security.enabled: false
3,配置jvm啓動參數
cd /usr/local/elasticsearch/elasticsearch-5.6.12/conf
vi jvm.options
#設置最大堆內存
-Xms2g
-Xmx2g
#設置內存溢出時,堆導出目錄
# generate a heap dump when an allocation from the Java heap fails
# heap dumps are created in the working directory of the JVM
-XX:+HeapDumpOnOutOfMemoryError
# specify an alternative path for heap dumps
# ensure the directory exists and has sufficient space
-XX:HeapDumpPath=${heap.dump.path}
4,拷貝配置好的安裝文件夾到其餘集羣機器
scp ....
5,啓動
./bin/elasticsearch -d -p pid
三臺機器都起來,才能選舉成功,服務才能真正起來,否則會掛起等待選舉
kibana安裝:
1,下載
wget https://artifacts.elastic.co/downloads/kibana/kibana-5.6.12-linux-x86_64.tar.gz
sha1sum kibana-5.6.12-linux-x86_64.tar.gz
tar -xzf kibana-5.6.12-linux-x86_64.tar.gz
cd kibana-5.6.12-linux-x86_64/
2,安裝xpack
cd bin
./kibana-plugin install x-pack
3,配置
cd ../config
vi kibana.yaml
修改
server.host: 當前主機的Ip地址,外部能訪問到Ip
server.port: 對外的端口,注意打開防火牆
elasticsearch.url: 制定你安裝es主機的Ip地址
若是es配置了x-pack安全認證,須要配置
elasticsearch.username: and elasticsearch.password:
4,啓動
nohup ./kibana &
打開瀏覽器輸入: http://searver.host:port便可訪問到kibana界面