ELK集群的搭建和Elasticsearchd api的简单使用
为什么80%的码农都做不了架构师?>>>
Elasticsearchd的安装,具体的安装步骤很简单不过有些配置还是需要注意的,下面简单介绍下安装步骤
第一步:从官网下载最新的版本:elasticsearch-5.4.1_1,安装前先安装jdk8,elasticsearch是java开发的,解压到你想放的位置:修改配置文件,配置文件的位置:/usr/local/elasticsearch-5.4.1_1/config/elasticsearch.yml,因为为了安全elasticsearch不能用root用户启动,需要从新建立新的用户,并且给文件夹赋值权限给新用户,例如用户名叫elasticsearch,在root用户下chown -R elasticsearch:elasticsearch /usr/local/elasticsearch-5.4.1_1然后修改一下系统的参数:
a.添加 /etc/security/limits.conf
* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096
b./etc/security/limits.d/90-nproc.conf
把soft nproc 1024这行的1024改大就行了。
c.vi /etc/sysctl.conf
添加下面配置:
vm.max_map_count=262144
d.并执行命令:
sysctl -p
E.修改elasticsearch.yml
cluster.name: es_test_1bootstrap.memory_lock: false
bootstrap.system_call_filter: false
node.name: esc_test_node_1
http.enabled: true
node.master: true
node.data: true
// 文件的位置
path.logs: /path/to/logs
// 日志的位置
path.logs: /home/data/elasticsearch/log///这个要设置下不然外网无法访问
network.host: 193.168.6.87
http.port: 9201
transport.tcp.port: 9301http.cors.enabled: true
http.cors.allow-origin: /.*/
http.cors.allow-credentials: true// 这个是集群的配置单机不需要配置
discovery.zen.ping.unicast.hosts: ["x.x.x.x"]
// 2个节点
node.max_local_storage_nodes: 2
bin目录启动服务:./elasticsearch -d,看日志/home/data/elasticsearch/log/,如果日志正常就说明启动成功
常见错误
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:84) ~[elasticsearch-5.4.1.jar:5.4.1]
Caused by: java.lang.RuntimeException: can not run elasticsearch as rootat org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:106) ~[elasticsearch-5.4.1.jar:5.4.1]at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:194) ~[elasticsearch-5.4.1.jar:5.4.1]at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:350) ~[elasticsearch-5.4.1.jar:5.4.1]at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:123) ~[elasticsearch-5.4.1.jar:5.4.
正常启动日志:
[2017-08-20T15:56:07,031][INFO ][o.e.n.Node ] [esc_test_node_1] JVM arguments [-Xms512m, -Xmx512m, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+DisableExplicitGC, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -Djdk.io.permissionsUseCanonicalPath=true, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Dlog4j.skipJansi=true, -XX:+HeapDumpOnOutOfMemoryError, -Des.path.home=/usr/local/elasticsearch-5.4.1_1]
[2017-08-20T15:56:07,889][INFO ][o.e.p.PluginsService ] [esc_test_node_1] loaded module [aggs-matrix-stats]
[2017-08-20T15:56:07,889][INFO ][o.e.p.PluginsService ] [esc_test_node_1] loaded module [ingest-common]
[2017-08-20T15:56:07,889][INFO ][o.e.p.PluginsService ] [esc_test_node_1] loaded module [lang-expression]
[2017-08-20T15:56:07,890][INFO ][o.e.p.PluginsService ] [esc_test_node_1] loaded module [lang-groovy]
[2017-08-20T15:56:07,890][INFO ][o.e.p.PluginsService ] [esc_test_node_1] loaded module [lang-mustache]
[2017-08-20T15:56:07,890][INFO ][o.e.p.PluginsService ] [esc_test_node_1] loaded module [lang-painless]
[2017-08-20T15:56:07,890][INFO ][o.e.p.PluginsService ] [esc_test_node_1] loaded module [percolator]
[2017-08-20T15:56:07,890][INFO ][o.e.p.PluginsService ] [esc_test_node_1] loaded module [reindex]
[2017-08-20T15:56:07,890][INFO ][o.e.p.PluginsService ] [esc_test_node_1] loaded module [transport-netty3]
[2017-08-20T15:56:07,890][INFO ][o.e.p.PluginsService ] [esc_test_node_1] loaded module [transport-netty4]
[2017-08-20T15:56:07,891][INFO ][o.e.p.PluginsService ] [esc_test_node_1] no plugins loaded
[2017-08-20T15:56:09,451][INFO ][o.e.d.DiscoveryModule ] [esc_test_node_1] using discovery type [zen]
[2017-08-20T15:56:10,205][INFO ][o.e.n.Node ] [esc_test_node_1] initialized
[2017-08-20T15:56:10,205][INFO ][o.e.n.Node ] [esc_test_node_1] starting ...
[2017-08-20T15:56:10,387][INFO ][o.e.t.TransportService ] [esc_test_node_1] publish_address {192.168.6.87:9300}, bound_addresses {192.168.6.87:9300}
[2017-08-20T15:56:10,394][INFO ][o.e.b.BootstrapChecks ] [esc_test_node_1] bound or publishing to a non-loopback or non-link-local address, enforcing bootstrap checks
[2017-08-20T15:56:13,446][INFO ][o.e.c.s.ClusterService ] [esc_test_node_1] new_master {esc_test_node_1}{xSFrf7feRD25YuwgtBeSLw}{G4byr3dMRc6T1QN_PRxxDQ}{192.168.6.87}{192.168.6.87:9300}, reason: zen-disco-elected-as-master ([0] nodes joined)
[2017-08-20T15:56:13,465][INFO ][o.e.h.n.Netty4HttpServerTransport] [esc_test_node_1] publish_address {192.168.6.87:9200}, bound_addresses {192.168.6.87:9200}
[2017-08-20T15:56:13,468][INFO ][o.e.n.Node ] [esc_test_node_1] started
[2017-08-20T15:56:14,573][INFO ][o.e.g.GatewayService ] [esc_test_node_1] recovered [11] indices into cluster_state
第二步:安装logstash,这个安装很简单,从官网下载最新的版本解压
创建一个输入输出文件sample.conf
input {stdin {}
}
output {elasticsearch {hosts => ["192.168.6.87:9201"] }stdout {codec => rubydebug }
}
启动服务:
第三步安装kibana-5.1.1-linux-x86_64,修改配置文件/usr/local/kibana-5.1.1-linux-x86_64/config/kibana.yml,修改一下server.host: "192.168.x",不然无法访问的通过外网,启动服务
[root@localhost bin]# ./kibanalog [08:09:06.517] [info][status][plugin:kibana@5.1.1] Status changed from uninitialized to green - Readylog [08:09:06.593] [info][status][plugin:elasticsearch@5.1.1] Status changed from uninitialized to yellow - Waiting for Elasticsearchlog [08:09:06.625] [info][status][plugin:console@5.1.1] Status changed from uninitialized to green - Readylog [08:09:06.648] [warning] You're running Kibana 5.1.1 with some different versions of Elasticsearch. Update Kibana or Elasticsearch to the same version to prevent compatibility issues: v5.4.1 @ 192.168.6.87:9200 (192.168.6.87)log [08:09:06.657] [error][status][plugin:elasticsearch@5.1.1] Status changed from yellow to red - Elasticsearch is still initializing the kibana index.log [08:09:06.865] [info][status][plugin:timelion@5.1.1] Status changed from uninitialized to green - Readylog [08:09:06.871] [info][listening] Server running at http://192.168.6.87:5601log [08:09:06.872] [error][status][ui settings] Status changed from uninitialized to red - Elasticsearch plugin is red
浏览器里打开kibana,然后输入“星儿”
Elasticsearchd的使用实际很简单的,一切都是resful,用postman简单的做个例子,插入一条消息到elsearch中
可以获取的到
下次博客会比较详细的介绍下elsearch的用法
转载于:https://my.oschina.net/zaxb/blog/1517641
ELK集群的搭建和Elasticsearchd api的简单使用相关推荐
- ELK 集群 + Redis 集群 + Nginx ,分布式的实时日志(数据)搜集和分析的监控系统搭建,简单上手使用
简述 ELK实际上是三个工具的集合,ElasticSearch + Logstash + Kibana,这三个工具组合形成了一套实用.易用的监控架构,很多公司利用它来搭建可视化的海量日志分析平台. 官 ...
- [k8s]elk架构设计-k8s集群里搭建
elasticsearch和mysql的对比 https://blog.csdn.net/qq_21383435/article/details/79323383 Mapping ~ Schema m ...
- @ELK集群环境部署搭建
文章目录 ELK部署搭建 1.ELK简述 2.ELK功能介绍 3.ELK组件官方下载 4.ELK部署安装 1)elk组件下载 2)es部署安装 3)kibana部署安装 4)Logstash部署安装 ...
- 关于CentOS7搭建ELK集群遇到的问题及解决办法
使用虚拟机安装的CentOS7系统搭建ELK集群过程中遇到的问题记录如下,对阿里云等虚拟环境或有参考作用. 安装过程可以参考:https://www.cnblogs.com/bixiaoyu/p/94 ...
- Elastic search入门到集群实战操作详解(原生API操作、springboot整合操作)-step1
Elastic search入门到集群实战操作详解(原生API操作.springboot整合操作)-step2 https://blog.csdn.net/qq_45441466/article/de ...
- Centos7环境下etcd集群的搭建
Centos7环境下etcd集群的搭建一.简介"A highly-available key value store for shared configuration and service ...
- 深入剖析Redis系列(三) - Redis集群模式搭建与原理详解
前言 在 Redis 3.0 之前,使用 哨兵(sentinel)机制来监控各个节点之间的状态.Redis Cluster 是 Redis 的 分布式解决方案,在 3.0 版本正式推出,有效地解决了 ...
- 学习笔记之-Kubernetes(K8S)介绍,集群环境搭建,Pod详解,Pod控制器详解,Service详解,数据存储,安全认证,DashBoard
笔记来源于观看黑马程序员Kubernetes(K8S)教程 第一章 kubernetes介绍 应用部署方式演变 在部署应用程序的方式上,主要经历了三个时代: 传统部署:互联网早期,会直接将应用程序部署 ...
- 配置三台服务器组成的ELK集群(二)
上一篇里主要是介绍了ES和ES-Head的安装过程,这一篇继续介绍ELK集群的其他核心组件安装过程. 五.安装Logstash: 本案的Logstash安装在10.113.130.117上:燃鹅,Lo ...
最新文章
- altium designer PCB 屏蔽DRC报错
- 网络推广——企业新站还得是专业网络推广公司来维护!
- tcp的无延时发送_腾讯网红程序员,详解带宽、延时、吞吐率、PPS 这些都是啥?...
- SqlHelper简单实现(通过Expression和反射)2.特性和实体设计
- 服务器2003 系统修复,第十一篇 Windows Server 2003系统修复.pdf
- linux 编译安装picocom,Linux pico命令
- python 两阶段聚类_Python,如何对多元时间序列进行聚类?
- JSP JavaBean作用范围
- python tab键自动补全_设置python中TAB键自动补全方法
- 汉密尔顿路径(哈密顿路径)解析
- php require找不到文件,第一次运行Fatal error: require_once找不到文件
- Latex表格排版大全 基于 IEEE双栏论文(设置单元格行列间距,自动换行设置)
- 南财计算机专业学科评估,江苏软件工程专业大学排名:江苏哪些大学软件工程比较好?...
- 01_配置yum源-银河麒麟V10(Kylin Linux Advanced Server V10 (Tercel))操作系统
- 扫地机器人朋友圈文案_最近,一台不务正业的愚大宝扫地机器人火遍朋友圈
- 怎样获得手机的外网ip???
- linux shell bash -c $IFS ${IFS}
- python+图书管理系统
- superset设置起止时间为明天
- 整流线性单元(Relu)及其变种(Leaky Relu、PRelu、ELU、SELU、CRelu、RRelu)
热门文章
- 百度商桥修改服务器,百度商桥 · 响应式网站编辑器使用手册 · 看云
- requestWindowFeature()的应用
- nmcli命令详解_【高新课堂】第一百二十五期Liunx必备命令
- 计算机网络的网络实验有哪几种,计算机网络实验一 网络设备的认识.doc
- mysql 表结构关系_mysql 表关系 与 修改表结构
- linux GDB详解
- Codeforces Round #535 (Div. 3) [codeforces div3 难度测评]
- jsp+servlet+mysql增删改查
- 三相不平衡的原因、危害以及解决措施
- Lotus Sametime 服务器的安装和配置