centOS 安装 elasticsearch 7.0.0和kibana7.0.0_单机版

 cd /opt 

 wget wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.0.0-linux-x86_64.tar.gz

tar -xzvf elasticsearch-7.0.0-linux-x86_64.tar.gz


useradd es

passwd  es 


chown -R es:root elasticsearch-7.0.0  更改所有者


su - es 

cd /opt/elasticsearch-7.0.0/bin

./elasticsearch -d  #启动 es , -d 表示后台运行 


curl http://127.0.0.1:9200    # 测试



{
  "name" : "iZ8vbdrp5nps3bwkpwyfuhZ",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "wO8G-V8vRWa-JdX0QMPjYw",
  "version" : {
    "number" : "7.0.0",
    "build_flavor" : "default",
    "build_type" : "tar",
    "build_hash" : "b7e28a7",
    "build_date" : "2019-04-05T22:55:32.697037Z",
    "build_snapshot" : false,
    "lucene_version" : "8.0.0",
    "minimum_wire_compatibility_version" : "6.7.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}

使用

es 中  的关键概念

索引: 类似关系型数据库中的表

文档:类似关系型数据库中 表的一条记录

创建索引

 curl -H "Content-type:application/json" -XPUT http://127.0.0.1:9200/hotel -d '{"mappings":{"properties":{"title":{"type":"text"},"city":{"type":"keyword"},"price":{"type":"double"}}}}'
{"acknowledged":true,"shards_acknowledged":true,"index":"hotel"}

hotel 为 索引名称 



创建文档  002 为id 

curl -H "Content-type:application/json" -XPOST http://127.0.0.1:9200/hotel/_doc/002 -d '{"title":"希尔顿酒店","city":"深圳市","price":1999.99}'

curl -H "Content-type:application/json" -XPOST http://127.0.0.1:9200/hotel/_doc/007 -d '{"title":"希尔顿宾馆","city":"深圳市","price":79.99}'

curl -H "Content-type:application/json" -XPOST http://127.0.0.1:9200/hotel/_doc/001 -d '{"title":"天上人间","city":"深圳市","price":299.99}'

curl -H "Content-type:application/json" -XPOST http://127.0.0.1:9200/hotel/_doc/003 -d '{"title":"情侣酒店","city":"上海市","price":5999.99}'


搜索 id 为 001 的文档
curl http://127.0.0.1:9200/hotel/_doc/001  

搜索 价格为 299.99的文档
curl -H "Content-type:application/json" -XPOST http://127.0.0.1:9200/hotel/_search -d '{"query":{ "term":{"price":{"value":299.99}}}}'

摸糊搜索 title 希  的文档
curl -H "Content-type:application/json" -XPOST http://127.0.0.1:9200/hotel/_search -d '{"query":{ "match":{"title":"希"}}}'






给合 kibana7.0.0

wget https://artifacts.elastic.co/downloads/kibana/kibana-7.0.0-linux-x86_64.tar.gz


tar -zxvf kibana-7.0.0-linux-x86_64.tar.gz



mv kibana-7.0.0-linux-x86_64 kibana-7.0.0


cd kibana-7.0.0/config


vim kibana.yml  #修改配置


server.host: "0.0.0.0"   # 外网可访问 kibana


elasticsearch.hosts: ["http://localhost:9200"]  # es 地址



cd kibana-7.0.0/config/bin
 
./kibana & #启动


http://ip:56001 访问 kibana

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值