Es集羣&kibana

環境準備,防火牆&selinux

[root@localhost ~]#systemctl stop firewalld
[root@localhost ~]#systemctl disable firewalld
[root@localhost ~]#sed -i 's/^SELINUX=.*/SELINUX=disabled/' /etc/selinux/config
[root@localhost ~]#setenforce 0

##修改系統環境該變量,修改完需要重啓才能生效!!

[root@localhost ~]#echo 'vm.max_map_count=262144' >> /etc/sysctl.conf

##允許打開的最大文件描述

[root@localhost ~]#echo '
* soft memlock unlimited
* hard memlock unlimited

* soft nofile 65536
* hard nofile 131072

* soft nproc 2048
* hard nproc 4096
' >> /etc/security/limits.conf
[root@localhost ~]#ulimit -n 65535
[root@localhost ~]#sysctl -p

安裝jdk

[root@localhost ~]#yum install -y java-1.8.0-openjdk
[root@localhost ~]#useradd es
[root@localhost ~]#passwd es

安裝es

安裝es

[root@localhost ~]#wget  https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.6.2.tar.gz

##沒外網手動下載包上傳

[root@localhost ~]#tar -axf elasticsearch-6.6.2.tar.gz  -C /opt/
[root@localhost ~]#chown -R es:es /opt/elasticsearch-6.6.2/
[root@localhost ~]#cd /opt/elasticsearch-6.6.2/

#修改JVM分配大小 3G這兩個值要一致

[root@localhost ~]#vim ./config/jvm.options

在這裏插入圖片描述

修改配置文件,添加參數

[root@localhost ~]#echo 'cluster.name: my-es
node.name: es002
node.master: true
node.data:true
network.host: 152.215.131.172
http.port: 9200
transport.tcp.port: 9300
discovery.zen.ping.unicast.hosts: ["es002", "es003",”es004”]
discovery.zen.minimum_master_nodes: 2
http.cors.enabled: true
http.cors.allow-origin: "*"
' >> /opt/elasticsearch-6.6.2/config/elasticsearch.yml

修改本地解析hosts

[root@localhost ~]# echo '152.215.131.172 my-es_es002
152.215.131.173 my-es_es003
152.215.131.174 my-es_es004'>> /ets/hosts

以es用戶啓動服務

[root@localhost ~]#su - es -c "sh /opt/elasticsearch-6.6.2/bin/elasticsearch &> /home/es/run.txt &"

檢測集羣狀態

[root@localhost ~]#curl  http://152.215.131.172:9200/_cluster/health?pretty

安裝head插件

安裝kibana

###安裝kibana

[root@localhost ~]#wget https://artifacts.elastic.co/downloads/kibana/kibana-6.6.2-linux-x86_64.tar.gz
[root@localhost ~]#tar -axf kibana-6.6.2-linux-x86_64.tar.gz  -C /opt
[root@localhost ~]#vim /opt/kibana-6.6.2-linux-x86_64/config/kibana.yml

修改三個字段
server.port: 5601 #服務端口
server.host: “0.0.0.0” #監聽地址
elasticsearch.hosts: [“http://152.215.131.172:9200”] #es地址

##啓動命令

[root@localhost ~]#nohup /opt/kibana-6.6.2-linux-x86_64/bin/kibana > /tmp/kibana.log 2>&1 & 

Kibana訪問地址:http://152.215.131.171:5601
在這裏插入圖片描述
檢查es集羣以及kibana狀態是否正常

在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章