1.在windows上安装和启动Elasticseach

1、安装JDK,至少1.8.0_73以上版本,java -version
2、下载和解压缩Elasticsearch安装包。Elasticsearch和Kibana的版本必须一致,这里都是使用elasticsearch-5.2.0.zip和kibana-5.2.0-windows-x86.zip
3、启动Elasticsearch:bin\elasticsearch.bat,es本身特点之一就是开箱即用,如果是中小型应用,数据量少,操作不是很复杂,直接启动就可以用了

4、检查ES是否启动成功:http://localhost:9200/?pretty

name: node名称
cluster_name: 集群名称(默认的集群名称就是elasticsearch)
version.number: 5.2.0,es版本号

{
"name" : "4onsTYV",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "nKZ9VK_vQdSQ1J0Dx9gx1Q",
"version" : {
"number" : "5.2.0",
"build_hash" : "24e05b9",
"build_date" : "2017-01-24T19:52:35.800Z",
"build_snapshot" : false,
"lucene_version" : "6.4.0"
},
"tagline" : "You Know, for Search"
}

5、修改集群名称:elasticsearch.yml
6、下载和解压缩Kibana安装包,使用里面的开发界面,去操作elasticsearch
7、启动Kibana:bin\kibana.bat
8、进入Dev Tools界面
9、GET _cluster/health

2.简单的集群管理

(1)快速检查集群的健康状况

es提供了一套api,叫做cat api,可以查看es中各种各样的数据

GET /_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
1488006741 15:12:21 elasticsearch yellow 1 1 1 1 0 0 1 0 - 50.0%

epoch timestamp cluster status node.total node.data shards pri relo init unassign pending_tasks max_task_wait_time active_shards_percent
1488007113 15:18:33 elasticsearch green 2 2 2 1 0 0 0 0 - 100.0%

epoch timestamp cluster status node.total node.data shards pri relo init unassign pending_tasks max_task_wait_time active_shards_percent
1488007216 15:20:16 elasticsearch yellow 1 1 1 1 0 0 1 0 - 50.0%

如何快速了解集群的健康状况?green、yellow、red?

green:每个索引的primary shard和replica shard都是active状态的
yellow:每个索引的primary shard都是active状态的,但是部分replica shard不是active状态,处于不可用的状态
red:不是所有索引的primary shard都是active状态的,部分索引有数据丢失了

为什么现在会处于一个yellow状态?

我们现在就一个笔记本电脑,就启动了一个es进程,相当于就只有一个node。现在es中有一个index,就是kibana自己内置建立的index。由于默认的配置是给每个index分配5个primary shard和5个replica shard,而且primary shard和replica shard不能在同一台机器上(为了容错)。现在kibana自己建立的index是1个primary shard和1个replica shard。当前就一个node,所以只有1个primary shard被分配了和启动了,但是一个replica shard没有第二台机器去启动。

做一个小实验:此时只要启动第二个es进程,就会在es集群中有2个node,然后那1个replica shard就会自动分配过去,然后cluster status就会变成green状态。

(2)快速查看集群中有哪些索引

GET /_cat/indices?v

health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
yellow open .kibana rUm9n9wMRQCCrRDEhqneBg 1 1 1 0 3.1kb 3.1kb

(3)简单的索引操作

创建索引:PUT /test_index?pretty

health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
yellow open test_index XmS9DTAtSkSZSwWhhGEKkQ 5 1 0 0 650b 650b
yellow open .kibana rUm9n9wMRQCCrRDEhqneBg 1 1 1 0 3.1kb 3.1kb

删除索引:DELETE /test_index?pretty

health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
yellow open .kibana rUm9n9wMRQCCrRDEhqneBg 1 1 1 0 3.1kb 3.1kb

安装和启动Elasticseach的更多相关文章

  1. 在windows上安装和启动Elasticseach、Kibana

    写在前面的话:读书破万卷,编码如有神-------------------------------------------------------------------- 参考内容: <Ela ...

  2. Mongodb在windows下的安装和启动

    在windows下安装的参考官方地址:https://docs.mongodb.com/manual/tutorial/install-mongodb-on-windows/ Mongodb的安装与启 ...

  3. MySQL 安装和启动服务,“本地计算机 上的 MySQL 服务启动后停止。某些服务在未由其他服务或程序使用时将自动停止。”

    MySQL 安装和启动服务,以及遇到的问题 MySQL版本: mysql-5.7.13-winx64.zip (免安装,解压放到程序文件夹即可,比如 C:\Program Files\mysql-5. ...

  4. Linux下memcached安装和启动方法

    Linux下memcached安装和启动方法 1. 首先下载memcached 和 libevent 包. Memcached用到了libevent这个库用于Socket的处理.下面是下载的两个包文件 ...

  5. MongoDB安装,启动,注册为windows系统服务

    MongoDB安装与启动 周建旭 2014-08-10 解压完后配置环境变量 下载Windows 32-bit或64-bit版本并解压缩,程序文件都在bin目录中,其它两个目录分别是C++调用是的头文 ...

  6. memcached 在windows下安装及启动

    memcached 在windows下安装及启动   Memcached 是一个高性能的分布式内存对象缓存系统,用于动态Web应用以减轻数据库负载.它通过在内存中缓存数据和对象来减少读取数据库的次数, ...

  7. Android 安装和启动另外一个应用

    有时候一个应用需要启动另外一个应用来完成操作,比如在某些应用中打开闹钟,相机,日历等等. 启动或安装相应的应用的方法: Step1:判断是否安装目标应用.只要知道目标应用的安装包名就可以通过判断&qu ...

  8. node.js安装和启动

    在Windows上安装 Node.js十分方便,我们只需要访问node.js官网http://www.nodejs.org/,点击Download链接,然后选择Windows Installer(32 ...

  9. MongoDB入门学习(一)—— 安装和启动

    最近由于工作需要,开始学习MongoDB数据库了.第一篇博文就从这里开始吧,以此记录下学习中的点点滴滴,为自己加油呢! (一) MongoDB简介 网上搜搜了一下:(来源:http://www.run ...

随机推荐

  1. 洛谷 P2813 母舰

    题目描述 在小A的星际大战游戏中,一艘强力的母舰往往决定了一场战争的胜负.一艘母舰的攻击力是普通的MA(Mobile Armor)无法比较的. 对于一艘母舰而言,它是由若干个攻击系统和若干个防御系统组 ...

  2. hdu 1576扩展欧几里得算法

    #include<stdio.h> #define ll long long /* 2.那么x,y的一组解就是x1*m1,y1*m1,但是由于满足方程的解无穷多个, 在实际的解题中一般都会 ...

  3. uva 10276 / pc 110908

    黑书上说用二分图的知识来解,但我想不出来,只好找规律 发现,一条柱时为1,两条柱时为4.三条柱时为8.. 这些1,3,7,11的数字加1后,都是下一条柱的最底部的数字,而且一条柱的数字之和总是按照这样 ...

  4. TagCloud with xml

    Django后台开发 加了个3D标签云的插件 3DTagCloudwithXML 中使用的是xml生成方式 为了xml自己主动化生成 而不须要去手工改动xml 特地写了个xmlgenerator 比較 ...

  5. msyql null 引起的错误

    mysql 默认值不要为null,最好为空 否则,当你查询的时候,会引起一些异常 比如 select  * from a where b!='new' 假设有一条数据b=null,你是查询不出来的 解 ...

  6. 11gR2 Database Services for &quot;Policy&quot; and &quot;Administrator&quot; Managed Databases (文档 ID 1481647.1)

    In this Document   Purpose   _afrLoop=1459311711568804&id=1481647.1&displayIndex=6&_afrW ...

  7. luogu1541 乌龟棋 动态规划

    题目大意 一行格子,每个格子里有数字.一些卡片,卡片上有1.2.3.4这几种数字.一开始你在格子1,随后每次选一个卡片,你可以前进卡片上的数字个格子,得到格子上的分数,然后讲该卡片丢弃.求取卡片的顺序 ...

  8. Spring如何加载XSD文件(org.xml.sax.SAXParseException: Failed to read schema document错误的解决方法)

    今天配置Spring的xml出现了错误 Multiple annotations found at this line: - schema_reference.4: Failed to read sc ...

  9. ubuntu清华源【转】

    https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/ 可以选择ubuntu的版本更新源.

  10. ASP.NET Razor - C# and VB Code Syntax

    http://www.w3schools.com/aspnet/razor_syntax.asp Razor supports both C# (C sharp) and VB (Visual Bas ...