关于curl的介绍,请移步

Elasticsearch学习概念之curl

  启动es,请移步

Elasticsearch的前后台运行与停止(tar包方式)

Elasticsearch的前后台运行与停止(rpm包方式)

  

  创建索引库,我这里命名为zhouls

[hadoop@djt002 elasticsearch-2.4.3]$ curl -XPUT 'http://192.168.80.200:9200/zhouls'
{"acknowledged":true}[hadoop@djt002 elasticsearch-2.4.3]$

这里,是跟之前的elasticsearch.yml修改对应起来的。

  我们可以验证下,输入localhost或者127.0.0.1都会出现无法连接,不信你尝试。

[hadoop@djt002 elasticsearch-2.4.3]$ curl -XPUT 'http://192.168.80.200:9200/zhouls'
{"acknowledged":true}[hadoop@djt002 elasticsearch-2.4.3]$ curl -XPUT 'http://localhost:9200/zhouls'
curl: (7) couldn't connect to host
[hadoop@djt002 elasticsearch-2.4.3]$ curl -XPUT 'http://127.0.0.1:9200/zhouls'
curl: (7) couldn't connect to host
[hadoop@djt002 elasticsearch-2.4.3]$

为了方便,更改为0.0.0.0

  然后,重启es

[hadoop@djt002 elasticsearch-2.4.3]$ jps
2811 Jps
2741 Elasticsearch
[hadoop@djt002 elasticsearch-2.4.3]$ curl -XPUT 'http://localhost:9200/zhouls'
{"error":{"root_cause":[{"type":"index_already_exists_exception","reason":"already exists","index":"zhouls"}],"type":"index_already_exists_exception","reason":"already exists","index":"zhouls"},"status":400}[hadoop@djt002 elasticurl -XPUT 'http://127.0.0.1:9200/zhouls'
{"error":{"root_cause":[{"type":"index_already_exists_exception","reason":"already exists","index":"zhouls"}],"type":"index_already_exists_exception","reason":"already exists","index":"zhouls"},"status":400}[hadoop@djt002 elasticurl -XPUT 'http://192.168.80.200:9200/zhouls'
{"error":{"root_cause":[{"type":"index_already_exists_exception","reason":"already exists","index":"zhouls"}],"type":"index_already_exists_exception","reason":"already exists","index":"zhouls"},"status":400}[hadoop@djt002 elasticsearch-2.4.3]$

报这个错误,是正常的,因为,你重复创建索引库。根据经验之谈,一般用内网ip。如我的192.168.80.200。建议指定内网ip

服务器一般都会有多种ip地址,
本地回环地址:127.0.0.1
内网地址:192.168.80.200
外网地址:10.29.0.2
    在这里0.0.0.0 表示可以通过上面所有ip都可以访问 

  以上是,Elasticsearch之curl创建索引库的方式1,以下是,Elasticsearch之curl创建索引库的方式2

[hadoop@djt002 elasticsearch-2.4.3]$ curl -XPUT 'http://192.168.80.200:9200/zhouls'
{"error":{"root_cause":[{"type":"index_already_exists_exception","reason":"already exists","index":"zhouls"}],"type":"index_already_exists_exception","reason":"already exists","index":"zhouls"},"status":400}[hadoop@djt002 elasticsearch-2.4.3]$ curl -XPOST 'http://192.168.80.200:9200/zhouls1'
{"acknowledged":true}[hadoop@djt002 elasticsearch-2.4.3]$

  测试完,及时删除。

[hadoop@djt002 elasticsearch-2.4.3]$ curl -XPUT 'http://192.168.80.200:9200/zhouls'
{"error":{"root_cause":[{"type":"index_already_exists_exception","reason":"already exists","index":"zhouls"}],"type":"index_already_exists_exception","reason":"already exists","index":"zhouls"},"status":400}[hadoop@djt002 elasticsearch-2.4.3]$ curl -XPOST 'http://192.168.80.200:9200/zhouls1'
{"acknowledged":true}[hadoop@djt002 elasticsearch-2.4.3]$ curl -XDELETE 'http://192.168.80.200:9200/zhouls1'
{"acknowledged":true}[hadoop@djt002 elasticsearch-2.4.3]$

Elasticsearch之curl创建索引库的更多相关文章

  1. Elasticsearch之curl创建索引库和索引时注意事项

    前提, Elasticsearch之curl创建索引库 Elasticsearch之curl创建索引 注意事项 1.索引库名称必须要全部小写,不能以下划线开头,也不能包含逗号 2.如果没有明确指定索引 ...

  2. Elasticsearch之curl创建索引

    前提,是 Elasticsearch之curl创建索引库 [hadoop@djt002 elasticsearch-2.4.3]$ curl -XPUT 'http://192.168.80.200: ...

  3. Elasticsearch之curl删除索引库

    关于curl创建索引库的介绍,请移步 Elasticsearch之curl创建索引库 [hadoop@djt002 elasticsearch-2.4.3]$ curl -XPUT 'http://1 ...

  4. (转)ElasticSearch Java Api-检索索引库

    上篇博客记录了如何用java调用api把数据写入索引,这次记录下如何搜索. 一.准备数据 String data1 = JsonUtil.model2Json(new Blog(1, "gi ...

  5. lucene中创建索引库

    package com.hope.lucene;import org.apache.commons.io.FileUtils;import org.apache.lucene.document.Doc ...

  6. elasticsearch kabana中创建索引

    在kabana中创建索引和索引类型语法 PUT clockin{ "mappings": { "time": { } }} 查询索引下的所有数据 GET clo ...

  7. Elasticsearch之cur查询索引

    前提, Elasticsearch之curl创建索引库 Elasticsearch之curl创建索引 Elasticsearch之curl创建索引库和索引时注意事项 Elasticsearch之cur ...

  8. Elasticsearch之CURL命令的DELETE

    也可以看我写的下面的博客 Elasticsearch之curl删除 Elasticsearch之curl删除索引库 删除,某一条数据,如下 [hadoop@master elasticsearch-] ...

  9. Elasticsearch之curl删除

    扩展下, Elasticsearch之curl删除索引库 [hadoop@djt002 elasticsearch-2.4.3]$ curl -XDELETE 'http://192.168.80.2 ...

随机推荐

  1. 【thrift】初识thrift

    Reference:http://www.ibm.com/developerworks/cn/java/j-lo-apachethrift/ http://jacksongblack.blog.51c ...

  2. php类和对象(二)

    面向对象第三大特性:多态 概念: 当父类引用指向子类实例的时候,由于子类对父类函数进行了重写,导致我们在使用该引用取调用相应方法时表现出的不同 条件: 1.必须有继承 2.子类必须对父类的方法进行重写 ...

  3. GDI+在绘制验证码中的使用

    GDI+最简单的理解就是用来绘图的.其中包括点.直线.矩形.字符串等等. 先简单来个例子,说明如何在winform窗体中绘制一条直线,并且这条直线不随着窗体的移动而消失. using System; ...

  4. min/max优化,count ,group by

    min/max优化 在表中,一般都是经过优化的. 如下地区表 id area pid 1 中国 0 2 北京 1 ... 3115 3113 我们查min(id), id是主键,查Min(id)非常快 ...

  5. Future模式实例

    Future模式 /** * qccr.com Inc. * Copyright (c) 2014-2016 All Rights Reserved. */ package com.youqianhu ...

  6. Blog迁移至Jekyll

    后续的Blog都将在 http://zhwbqd.github.io/ 为您呈现

  7. Spark- 流量日志分析

    日志生成 package zx.Utils import java.io.{File, FileWriter} import java.util.Calendar import org.apache. ...

  8. Myeclipse或者Eclipse恢复默认启动时显示选择workspace的问题

    [问题描述] 不知道是不是Myeclipse8.5的Bug,我最近安装了8.5之后,前面几天打开MyEclipse的时候都是让我自己选择工作空间的,但是最近突然每次打开的时候都自己打开了C盘下面工作空 ...

  9. iis_rewrite3突然无法使用(因为它过期啦)

    转自http://www.b1y.cn/post/216.html ISAPI_Rewrite3完全版会有45天的试用期,过期了需要99美元进行够买,网上有很多破解版的,方法如下: 1.先从官网下一个 ...

  10. JQuery表单验证插件EasyValidator

    本插件的宗旨是:用户无需写一行JS验证代码,只需在要验证的表单中加入相应的验证属性即可,让验证功能易维护,可扩展,更容易上手. DEMO中已经包含了常用的正则表达式,可以直接复用,为了考虑扩展性,所以 ...