`
sillycat
  • 浏览: 2543295 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

ElasticSearch(2)Version Upgrade 6.2.4 and Cluster

 
阅读更多
ElasticSearch(2)Version Upgrade 6.2.4 and Cluster

Try to get Latest Documents here
https://github.com/elastic/elasticsearch

Beats, Logstash, ElasticSearch, Kibana

More documents
https://www.elastic.co/guide/index.html

First of All, Install Elastic Search
https://www.elastic.co/downloads/elasticsearch
Download the tar file from there https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.2.4.tar.gz
> tar zxvf elasticsearch-6.2.4.tar.gz
Put it in the working directory
> sudo ln -s /Users/hluo/tool/elasticsearch-6.2.4 /opt/elasticsearch-6.2.4
> sudo ln -s /opt/elasticsearch-6.2.4 /opt/elasticsearch
Add to the Path

Install X-Pack into ElasticSearch
> bin/elasticsearch-plugin install x-pack

Start ElasticSearch
> bin/elasticsearch

Set up password
> bin/x-pack/setup-passwords auto
Changed password for user kibana
PASSWORD kibana = sBqGvem69d2jeal6rf3j
Changed password for user logstash_system
PASSWORD logstash_system = xn9ElgHqJTbZFcmDPQFy
Changed password for user elastic
PASSWORD elastic = Y2r19FsAXIEtjp26HTcE

Visit
http://localhost:9200/

Username elastic and password

Install Kibana
Go here and download the MAC version for myself https://www.elastic.co/downloads/kibana
> tar zxvf kibana-6.2.4-darwin-x86_64.tar.gz
> mv kibana-6.2.4-darwin-x86_64 ~/tool/kibana-6.2.4
> sudo ln -s /Users/hluo/tool/kibana-6.2.4 /opt/kibana-6.2.4
> sudo ln -s /opt/kibana-6.2.4 /opt/kibana
Add to the Path

Install Kibana Plugin
> bin/kibana-plugin install x-path

Config the username/pasword Kibana connect to ElasticSearch
> vi config/kibana.yml
elasticsearch.username: "kibana"
elasticsearch.password: "sBqGvem69d2jeal6rf3j"

Start Kibana
> bin/kibana

Visit the Page
http://localhost:5601/

Use the elastic username and password.

Try the things in DEV Tools
POST /inspections/report
{
    "business_address": "660 Sacramento St",
    "business_city": "San Francisco",
    "business_id": "2228",
    "business_latitude": "37.793698",
    "business_location": {
      "type": "Point",
      "coordinates": [
        -122.403984,
        37.793698
      ]
    },
    "business_longitude": "-122.403984",
    "business_name": "Tokyo Express",
    "business_postal_code": "94111",
    "business_state": "CA",
    "inspection_date": "2016-02-04T00:00:00.000",
    "inspection_id": "2228_20160204",
    "inspection_type": "Routine",
    "inspection_score": 96,
    "risk_category": "Low Risk",
    "violation_description": "Unclean nonfood contact surfaces",
    "violation_id": "2228_20160204_103142"
}

Search for the Content
GET inspections/report/_search

Update Something with an ID
PUT inspections/report/9527
{
    "business_address": "660 Sacramento St",
    "business_city": "San Francisco",
    "business_id": "2228",
    "business_latitude": "37.793698",
    "business_location": {
      "type": "Point",
      "coordinates": [
        -122.403984,
        37.793698
      ]
    },
    "business_longitude": "-122.403984",
    "business_name": "Tokyo Express",
    "business_postal_code": "94111",
    "business_state": "CA",
    "inspection_date": "2016-02-04T00:00:00.000",
    "inspection_id": "2228_20160204",
    "inspection_type": "Routine",
    "inspection_score": 96,
    "risk_category": "Low Risk",
    "violation_description": "Unclean nonfood contact surfaces",
    "violation_id": "2228_20160204_103142"
}

Delete Index
DELETE inspections

Create the index ahead
PUT /inspections
{
  "settings": {
    "index.number_of_shards": 1,
    "index.number_of_replicas": 0
  }
}

Bulk API
One Simple Example
POST _bulk
{ "index" : { "_index" : "test", "_type" : "_doc", "_id" : "1" } }
{ "field1" : "value1" }
{ "delete" : { "_index" : "test", "_type" : "_doc", "_id" : "2" } }
{ "create" : { "_index" : "test", "_type" : "_doc", "_id" : "3" } }
{ "field1" : "value3" }
{ "update" : {"_id" : "1", "_type" : "_doc", "_index" : "test"} }
{ "doc" : {"field2" : "value2"} }

POST inspections/report/_bulk
{ "index": { "_id": 1 }}
{ "business_address": "315 California St", "business_city": "San Francisco", "business_id":"24936","business_latitude":"37.793199","business_location":{"type":"Point","coordinates":[-122.400152,37.793199]},"business_logitude":"-122.400152","business_name":"San Francisco Soap Company","business_postal_code":"94104","business_state":"CA","inspection_date":"2016-06-09T00:00:00.000","inspection_id":"24936_20160609","inspection_score":77,"inspection_type":"Routine - Unscheduled","risk_category":"Low Risk","violcation_description":"Imporoper food labeling or menu misrepresentation","violation_id":"24936_20160609_103141"}
{ "index": { "_id":2 }}
{"business_address":"10 Mason St","business_city":"San Francisco","business_id":"60354","business_latitude":"37.783527","business_location":{"type":"Point","coordinates":[-122.409061,37.783527]},"business_longitude":"-122.409061","business_name":"Soup Unlimited","business_postal_code":"94102","business_state":"CA","inspection_date":"2016-11-23T00:00:00.000","inspection_id":"60354_20161123","inspection_type":"Routine","inspection_score":95}
{ "index": { "_id":3 }}
{"business_address":"2872 24th St","business_city":"San Francisco","business_id":"1797","business_latitude":"37.752807","business_location":{"type":"Point","coordinates":[-122.409752,37.752807]},"business_longitude":"-122.409752","business_name":"TIO CHILOS GRILL","business_postal_code":"94110","business_state":"CA","inspection_date":"2016-07-05T00:00:00.000","inspection_id":"1797_20160705","inspection_score":90,"inspection_type":"Routine - Unscheduled","risk_category":"Low Risk","violation_description":"Unclean nonfood contact surfaces","violation_id":"1797_20160705_103142"}
{ "index": { "_id": 4 }}
{"business_address":"1661 Tennessee St Suite 38","business_city":"San Francisco Whard Restaurant","business_id":"66198","business_latitude":"37.75072","business_location":{"type":"Point","coordinates":[-122.388478,37.75072]},"business_longitude":"-122.388478","business_name":"San Francisco Restaurant","business_postal_code":"94107","business_state":"CA","inspection_date":"2016-05-27T00:00:00.000","inspection_id":"66198_20160527","inspection_type":"Routine","inspection_score":56}
{ "index": { "_id": 5 }}
{"business_address":"2162 24th Ave","business_city":"San Francisco","business_id":"5794","business_latitude":"37.747228","business_location":{"type":"Point","coordinates":[-122.481299,37.747228]},"business_longitude":"-122.481299","business_name":"Soup House","business_phone_number":"+14155752700","business_postal_code":"94116","business_state":"CA","inspection_date":"2016-09-07T00:00:00.000","inspection_id":"5794_20160907","inspection_score":96,"inspection_type":"Routine - Unscheduled","risk_category":"Low Risk","violation_description":"Unapproved or unmaintained equipment or utensils","violation_id":"5794_20160907_103144"}
{ "index":{ "_id": 6 }}
{"business_address":"2162 24th Ave","business_city":"San Francisco","business_id":"5794","business_latitude":"37.747228","business_location":{"type":"Point","coordinates":[-122.481299,37.747228]},"business_longitude":"-122.481299","business_name":"Soup-or-Salad","business_phone_number":"+14155752700","business_postal_code":"94116","business_state":"CA","inspection_date":"2016-09-07T00:00:00.000","inspection_id":"5794_20160907","inspection_score":96,"inspection_type":"Routine - Unscheduled","risk_category":"Low Risk","violation_description":"Unapproved or unmaintained equipment or utensils","violation_id":"5794_20160907_103144"}

Search on the API
GET inspections/report/_search
These will return:
{
  "took": 0,
  "timed_out": false,
  "_shards": {
    "total": 1,
    "successful": 1,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": 6,
    "max_score": 1,
    "hits": [
      {
        "_index": "inspections",
        "_type": "report",
        "_id": "1",
        "_score": 1,
        "_source": {
          "business_address": "315 California St",
          "business_city": "San Francisco",
          "business_id": "24936",
          "business_latitude": "37.793199",
          "business_location": {
            "type": "Point",
            "coordinates": [
              -122.400152,
              37.793199

Search with One Property
GET inspections/report/_search
{
  "query":{
    "match":{
      "business_name":"soup"
    }
  }
}

Match Phrase
GET inspections/report/_search
{
  "query":{
    "match_phrase": {
      "business_name": "san francisco"
    }
  }
}

Search 2 properties with AND
//bool - must, should, must_not, filter
GET inspections/report/_search
{
  "query":{
    "bool":{
      "must”:[
        {
          "match":{
            "business_name":"soup"
          }
        },
        {
          "match":{
            "violation_description": "Unapproved"
          }
        }
      ]
    }
  }
}

Must Not
GET inspections/report/_search
{
  "query": {
    "bool":{
      "must_not":[
        {
          "match":{
            "business_name":"soup"
          }
        }
      ]
    }
  }
}

Should OR Search with Boost
GET inspections/report/_search
{
  "query":{
    "bool":{
      "should":[
        {
          "match_phrase":{
            "business_name":{
              "query":"soup",
              "boost":3
            }
          }
        },
        {
          "match":{
            "inspection_type":{
              "query":"routine"
            }
          }
        }
      ]
    }
  }
}

Search with High Lights
GET inspections/report/_search
{
  "query":{
    "match":{
      "business_name":"soup"
    }
  },
  "highlight": {
    "fields": {
      "business_name":{}
    }
  }
}

Aggregations with Search
GET inspections/report/_search
{
  "query": {
    "match": {
      "business_name": "soup"
    }
  },
  "aggregations": {
    "healthscore":{
      "range": {
        "field": "inspection_score",
        "ranges": [
          {
            "key": "0-80",
            "from": 0,
            "to": 80
          },
          {
            "key" : "81-90",
            "from": 81,
            "to": 90
          },
          {
            "key": "91-100",
            "from" : 91,
            "to" : 100
          }
        ]
      }
    }
  }
}

Check the Index Mapping
GET inspections/_mapping/report


ElasticSearch
https://www.elastic.co/webinars/get-started-with-elasticsearch

Kibana
https://www.elastic.co/webinars/getting-started-kibana?baymax=default&elektra=docs&storm=top-video

Logstash
https://www.elastic.co/webinars/getting-started-logstash?baymax=default&elektra=docs&storm=top-video


References:
http://www.cnblogs.com/dennisit/p/4132269.html
http://guoze.me/2015/04/04/elasticsearch-optimization/

redis logstash, elastic search kibana
http://nkcoder.github.io/blog/20141031/elkr-log-platform-deploy/
http://nkcoder.github.io/blog/20141106/elkr-log-platform-deploy-ha/

kibana
http://kibana.logstash.es/content/

http://sillycat.iteye.com/blog/2153824
分享到:
评论

相关推荐

    elasticsearch and logstash版本6.2.4同步mysql

    **Elasticsearch 6.2.4 和 Logstash 6.2.4 集成MySQL数据同步** 在现代大数据处理和分析中,Elasticsearch 和 Logstash 是两个非常重要的工具。Elasticsearch 是一个分布式、RESTful 风格的搜索和分析引擎,而 ...

    elasticsearch-6.2.4.tar.gz.zip

    Elasticsearch 6.2.4 是一个高度可扩展、高性能的开源全文搜索引擎,它基于 Lucene 库构建,但提供了更高级别的分布式、实时、近实时搜索和分析功能。这个压缩包“elasticsearch-6.2.4.tar.gz.zip”包含了这个版本的...

    elasticsearch 6.2.4 jar

    2. **版本6.2.4**:此版本是Elasticsearch的一个稳定版本,它引入了一些新特性、性能优化和修复了已知问题。例如,可能包括改进的聚合性能、对SQL查询的支持增强以及对Kibana和Logstash的集成改进。 3. **Java API*...

    elasticsearch-analysis-ik-6.2.4(编译版)

    **Elasticsearch Analysis IK 插件 6.2.4 编译版详解** Elasticsearch 是一个功能强大的开源搜索引擎,广泛应用于数据检索、分析和可视化。为了更好地处理中文文本,Elasticsearch 提供了多种分词器插件,其中最...

    elasticsearch-6.2.4.rar

    Elasticsearch 6.2.4 是一个高度可扩展的开源全文搜索引擎,它设计用于处理大量数据并提供快速、近实时的搜索与分析能力。这个版本的Elasticsearch是其发展过程中的一个重要里程碑,提供了许多改进和新特性,旨在...

    Flume1.8+Elasticsearch6.2.4+Kibana6.2.4项目linux搭建

    在本项目中,我们将搭建一个基于Linux环境的实时数据流处理系统,主要涉及Flume 1.8、Elasticsearch 6.2.4和Kibana 6.2.4。这个组合常用于大数据日志收集、存储和分析。以下是详细步骤: 一、**Elasticsearch安装与...

    elasticsearch-6.2.4.zip

    在6.2.4这个版本中,Elasticsearch提供了诸多特性和改进,使得数据的存储、检索和分析变得更加高效和便捷。本篇文章将深入探讨Elasticsearch 6.2.4的关键知识点。 首先,Elasticsearch的分布式特性是其一大亮点。它...

    elasticsearch-6.2.4.tar.gz与kibana-6.2.4-linux-x86_64.tar.gz

    Elasticsearch 6.2.4 和 Kibana 6.2.4 是两个非常重要的开源工具,广泛用于大数据分析和日志管理领域。Elasticsearch 是一个分布式、RESTful 风格的搜索和数据分析引擎,而 Kibana 是一个数据可视化界面,可以将 ...

    elasticsearch-6.2.4.tar.gz&kibana;-6.2.4-linux-x86_64..tar.gz

    Elasticsearch 6.2.4 和 Kibana 6.2.4 是两个非常重要的开源工具,它们在IT行业中,特别是在数据搜索、分析和可视化领域具有广泛的应用。这两个工具通常一起使用,构建一个强大的实时数据分析平台。 **Elastic...

    elasticsearch-6.2.4&kibana-6.2.4.zip

    elasticsearch-6.2.4版本,包含ik分词。kibana-6.2.4-windows-x86_64。

    elasticsearch-6.2.4.tar.gz

    安装Elasticsearch 6.2.4时,你需要先解压缩"elasticsearch-6.2.4.tar.gz",然后在终端中导航到解压后的"es6.2.4"目录,执行启动脚本`bin/elasticsearch`。确保你的系统满足Elasticsearch的硬件和软件需求,并根据...

    elasticsearch-6.2.4

    **Elasticsearch 6.2.4:在Linux 64位CentOS 7系统上的安装与验证** Elasticsearch是一款高性能、分布式、全文搜索引擎,常用于大数据分析和实时搜索应用。版本6.2.4是其历史版本之一,包含了众多优化和改进,尤其...

    elasticsearch-6.2.4.rpm

    elasticsearch-6.2.4.rpm

    elasticsearch-6.2.4+kibana-6.2.4打包

    **Elasticsearch 6.2.4 和 Kibana 6.2.4 知识点详解** Elasticsearch 是一款流行的开源搜索引擎和数据分析工具,它基于 Lucene 库,提供了一个分布式、RESTful 风格的搜索和分析引擎服务。6.2.4 版本是 Elastic...

    elasticsearch-analysis-ik-6.2.4.zip

    elasticsearch-analysis-ik-6.2.4.zip 插件,elasticsearch-analysis-ik-6.2.4.zip 插件,elasticsearch-analysis-ik-6.2.4.zip 插件

    ElasticSearch6.2.4最新实战教程.zip

    elasticsearch 6.x 实战教程 ElasticSearch是一个基于Lucene的搜索服务器。它提供了一个分布式多用户能力的全文搜索引擎,基于RESTfulweb接口。ElasticSearch是用Java开发的,并作为Apache许可条款下的开放源码发布...

    elasticsearch6.2.4压缩包

    Elasticsearch 6.2.4 是一个高度可扩展的开源全文搜索引擎,它以其强大的分布式、实时搜索和分析能力而闻名。这个版本是Elasticsearch发展中的一个重要里程碑,提供了许多新特性和性能优化。 首先,让我们深入了解...

    elasticsearch-head6.2.4.zip

    在学习Elasticsearch的过程中,必不可少需要通过一些工具查看es的运行状态以及数据。如果都是通过rest请求,未免太过麻烦,而且也不够人性化。此时,head可以完美的帮助你快速学习和使用Elasticsearch。

Global site tag (gtag.js) - Google Analytics