Mac下安装ElasticSearch 6.6.2

一。下载ElasticSearch 6.6.2

下载地址:https://www.elastic.co/cn/downloads/past-releases#elasticsearch

二。启动ElasticSearch

1. 将下载好的压缩文件解压,然后cd /Users/sunww/Documents/JAVA/elasticsearch-6.6.2/bin

 

2. 执行bin下的elasticsearch 启动ES

 

3. 启动执行情况,如下图ES已经正常启动了

 

[2019-07-03T11:23:32,541][INFO ][o.e.t.TransportService   ] [szjihGQ] publish_address {127.0.0.1:9300}, bound_addresses {[::1]:9300}, {127.0.0.1:9300}

ES启动了一个Tcp的服务且端口在9300上

 

[2019-07-03T11:23:35,672][INFO ][o.e.h.n.Netty4HttpServerTransport] [szjihGQ] publish_address {127.0.0.1:9200}, bound_addresses {[::1]:9200}, {127.0.0.1:9200}

ES启动了一个Http的服务且端口在9200上

三. 查看ES运行情况

在浏览器中打开 http://localhost:9200

可以看到如下 图,说明ES已经正常启动并运行了

四。测试添加记录与查询记录

添加3条记录
curl -XPUT 'http://localhost:9200/twitter/_doc/1?pretty' -H 'Content-Type: application/json' -d '
{
    "user": "kimchy",
    "post_date": "2009-11-15T13:12:00",
    "message": "Trying out Elasticsearch, so far so good?"
}'

curl -XPUT 'http://localhost:9200/twitter/_doc/2?pretty' -H 'Content-Type: application/json' -d '
{
    "user": "kimchy",
    "post_date": "2009-11-15T14:12:12",
    "message": "Another tweet, will it be indexed?"
}'

curl -XPUT 'http://localhost:9200/twitter/_doc/3?pretty' -H 'Content-Type: application/json' -d '
{
    "user": "elastic",
    "post_date": "2010-01-15T01:46:38",
    "message": "Building the site, should be kewl"
}'
查询刚刚添加的语句
curl -XGET 'http://localhost:9200/twitter/_doc/1?pretty=true'
curl -XGET 'http://localhost:9200/twitter/_doc/2?pretty=true'
curl -XGET 'http://localhost:9200/twitter/_doc/3?pretty=true'

在终端中输入上面的部分测试截图:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值