• 谷粒商城安装ES及入门(十六)


    102、全文检索-ElasticSearch-简介 --109、全文检索-ElasticSearch-入门-删除数据&bulk批量操作导入样本测试数据

     安装

    [root@play ~]# docker pull elasticsearch:7.4.2
    7.4.2: Pulling from library/elasticsearch
    d8d02d457314: Pull complete
    f26fec8fc1eb: Pull complete
    8177ad1fe56d: Pull complete
    d8fdf75b73c1: Pull complete
    47ac89c1da81: Pull complete
    fc8e09b48887: Pull complete
    367b97f47d5c: Pull complete
    Digest: sha256:543bf7a3d61781bad337d31e6cc5895f16b55aed4da48f40c346352420927f74
    Status: Downloaded newer image for elasticsearch:7.4.2
    docker.io/library/elasticsearch:7.4.2
    [root@play ~]# free -m
                  total        used        free      shared  buff/cache   available
    Mem:           7821        2802         476          16        4542        4703
    Swap:          1639          11        1628
    
    [root@play ~]# mkdir -p /mydata/elasticsearch/config
    [root@play ~]# mkdir -p /mydata/elasticsearch/data
    [root@play ~]# echo "http.host: 0.0.0.0" > /mydata/elasticsearch/config/elasticsearch.yml
    [root@play ~]# cat /mydata/elasticsearch/config/elasticsearch.yml
    http.host: 0.0.0.0
    [root@play ~]# docker run --name elasticsearch -p 9200:9200 -p 9300:9300 --privileged=true 
    > -e "discovery.type=single-node"  
    > -e ES_JAVA_OPTS="-Xms128m -Xms256m"  
    > -v /mydata/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml   
    > -v /mydata/elasticsearch/data:/usr/share/elasticsearch/data   
    > -v /mydata/elasticsearch/plugins:/usr/share/elasticsearch/plugins   
    > -d elasticsearch:7.4.2  

    但是会报错显示权限不足

     安装kibana

    [root@play elasticsearch]# chmod 777 -R .
    [root@play elasticsearch]# ll
    total 0
    drwxrwxrwx. 2 root root 31 Jun  8 11:26 config
    drwxrwxrwx. 2 root root  6 Jun  8 11:23 data
    drwxrwxrwx. 2 root root  6 Jun  8 11:35 plugins
    [root@play elasticsearch]# docker ps -l
    CONTAINER ID        IMAGE                 COMMAND                  CREATED             STATUS                     PORTS               NAMES
    174c44e86f31        elasticsearch:7.4.2   "/usr/local/bin/dock…"   2 minutes ago       Exited (1) 2 minutes ago                       elasticsearch
    [root@play elasticsearch]# docker start 174c44e86f31
    174c44e86f31
    [root@play elasticsearch]# docker pull kibana:7.4.2
    7.4.2: Pulling from library/kibana
    d8d02d457314: Already exists
    bc64069ca967: Pull complete
    c7aae8f7d300: Pull complete
    8da0971e3b41: Pull complete
    58ea4bb2901c: Pull complete
    b1e21d4c2a7e: Pull complete
    3953eac632cb: Pull complete
    5f4406500758: Pull complete
    340d85e0d1c7: Pull complete
    1768564d16fb: Pull complete
    Digest: sha256:355f9c979dc9cdac3ff9a75a817b8b7660575e492bf7dbe796e705168f167efc
    Status: Downloaded newer image for kibana:7.4.2
    docker.io/library/kibana:7.4.2
    [root@play elasticsearch]# docker ps -a
    CONTAINER ID        IMAGE                 COMMAND                  CREATED                                                                                       STATUS              PORTS                                            NAME                                                                          S
    174c44e86f31        elasticsearch:7.4.2   "/usr/local/bin/dock…"   12 minutes ag                                                                          o      Up 9 minutes        0.0.0.0:9200->9200/tcp, 0.0.0.0:9300->9300/tcp   elas                                                                          ticsearch
    [root@play elasticsearch]# docker run --name kibana -e ELASTICSEARCH_HOSTS=http:                                                                          //192.168.1.119:9200 -p 5601:5601 -d kibana:7.4.2
    7ab7bf7aa2e5b88e561e6d43c5aa054d49724d30d16bc6d444b8ad4883edf35c
    [root@play elasticsearch]# docker ps -a
    CONTAINER ID        IMAGE                 COMMAND                  CREATED             STATUS              PORTS                                            NAMES
    7ab7bf7aa2e5        kibana:7.4.2          "/usr/local/bin/dumb…"   7 seconds ago       Up 6 seconds        0.0.0.0:5601->5601/tcp                           kibana
    174c44e86f31        elasticsearch:7.4.2   "/usr/local/bin/dock…"   13 minutes ago      Up 10 minutes       0.0.0.0:9200->9200/tcp, 0.0.0.0:9300->9300/tcp   elasticsearch
    

    Cat  

    GET /_cat/nodes: 查看所有节点
    GET /_cat/health: 查看es健康状况
    GET /_cat/master: 查看主节点
    GET /_cat/indices: 查看所有索引

     

     

     

     106、全文检索-ElasticSearch-入门-put&post新增数据

     

     

     

    107、全文检索-ElasticSearch-入门-get查询数据&乐观锁字段

     

     108、全文检索-ElasticSearch-入门-put&post修改数据

     

     PUT和没有update的POST进行更新的时候,是直接覆盖

    109、全文检索-ElasticSearch-入门-删除数据&bulk批量操作导入样本测试数据

     批量插入

     Json地址:

    https://github.com/elastic/elasticsearch/blob/master/docs/src/test/resources/accounts.json
  • 相关阅读:
    HDU6397
    容斥原理推导错排通项公式
    重复排列的证明
    圆排列证明
    rock-paper-scissors
    The more, The Better
    趁着情人节写点东西
    分层图最短路问题
    背包问题是否装满问题
    Python面向对象编程扑克牌发牌程序,另含大量Python代码!
  • 原文地址:https://www.cnblogs.com/dalianpai/p/13069927.html
Copyright © 2020-2023  润新知