手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

ELK Stack集群部署与Grafana及可视化图形

[日期:2017-06-19] 来源:Linux社区  作者:思考 [字体:大 中 小]

6、kibana的安装

rpm -ivh kibana-4.6.1-x86_64.rpm

 

修改配置文件

vim /opt/kibana/config/kibana.yml

 grep -n '^[a-Z]' /opt/kibana/config/kibana.yml

2:server.port: 5601

5:server.host: "0.0.0.0"

15:elasticsearch.url: "http://localhost:9200"

23:kibana.index: ".kibana"

 

安装插件

/opt/kibana/bin/kibana plugin --install elasticsearch/marvel/latest

 

启动服务:

/etc/init.d/kibana start

访问方式

http://172.16.8.208:5601/

wKioL1iyW4fhnHeDAAHTsz_M_tU298.pngwKiom1iyW62yRDlrAAINiodJpwk985.png

6、参数优化(提高ElasticSearch检索效率)

6.1Linux操作系统优化

1)调整系统资源最大句柄数

  /etc/security/limits.conf

   在文件中增加

   * soft nofile 65536

   * hard nofile 65536

2)设置bootstrap.mlockall: 为true来锁住内存。因为当jvm开始swapping时es的效率会降低,所以要保证它不swap,可以把ES_MIN_MEM和ES_MAX_MEM两个环境变量设置成同一个值,并且保证机器有足够的内存分配给es。

同时也要允许elasticsearch的进程可以锁住内存,linux下可以通过`ulimit -l unlimited`命令。

 

3)关闭文件更新时间

cat /etc/fstab

/dev/sda7   /data/1     ext4    defaults,noatime 0 0

 

4)提高ES占用内存(elasticsearch.in.sh)

  ES_MIN_MEM=30g (一般为物理内存一半,但不要超过31G)

  ES_MAX_MEM=30g

https://www.elastic.co/guide/en/elasticsearch/guide/current/heap-sizing.html#compressed_oops(官方建议)

 

6.2Elasticsearch 字段缓存优化

1)Fielddata(字段数据)

Elasticsearh默认会将fielddata全部加载到内存。但是,内存是有限的,需要对fielddata内存做下限制:Indices.fieldata.cache.size 节点用于fielddata的最大内存,如果fielddata达到该阀值,就会把旧数据交换出去。默认设置是不限制,建议设置10%。

2)doc-values

其实就是在elasticsearch 将数据写入索引的时候,提前生成好fileddata内容,并记录到磁盘上。因为fileddata数据是顺序读写的,所以即使在磁盘上,通过文件系统层的缓存,也可以获得相当不错的性能。doc_values只能给不分词(对于字符串字段就是设置了 "index":"not_analyzed",数值和时间字段默认就没有分词) 的字段配置生效。

如相应字段设置应该是:

"@timestamp":{

                    "type":"date",

                    "index":"not_analyzed",

                    "doc_values":true,

                }

7、Grafana安装及配置

也可以参考官方文档来安装

http://docs.grafana.org/installation/rpm/

Grafana安装

yum install initscripts fontconfig

rpm -ivh grafana-4.0.2-1481203731.x86_64.rpm 

yum install fontconfig

yum install freetype*

yum install urw-fonts

 

启动grafana-server服务

systemctl enable grafana-server.service

systemctl start grafana-server.service

 

安装包详细信息

 [root@qas-zabbix ~]# rpm -qc grafana

/etc/grafana/grafana.ini

/etc/grafana/ldap.toml

/etc/init.d/grafana-server

/etc/sysconfig/grafana-server

/usr/lib/systemd/system/grafana-server.service

 

二进制文件 /usr/sbin/grafana-server

服务管理脚本 /etc/init.d/grafana-server

安装默认文件 /etc/sysconfig/grafana-server

配置文件 /etc/grafana/grafana.ini

安装systemd服务(如果systemd可用 grafana-server.service

日志文件 /var/log/grafana/grafana.log

 

访问URL

http://172.16.8.209:3000/

wKiom1iyW_DSPrLBAAGMhGTyRw4175.pngwKioL1iyXCrw2L5aAAM3s9B0SQE276.png

本文永久更新链接地址:http://www.linuxidc.com/Linux/2017-06/144980.htm

linux
相关资讯       Grafana  ELK Stack集群 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款