快捷鍵、curl命令、es簡單使用、鎖

不知不覺的再堅持一天要週五啦, 週末就要來了。你們嗨起來呀html

下面是我這周目前的總結, 因工做繁忙, 內容比較簡單, 但願你們見諒。數組

命令行經常使用的幾個快捷鍵

ctrl+a:跳到本行的行首
ctrl+e:跳到頁尾
Ctrl+u:刪除當前光標前面的文字 (還有剪切功能)
ctrl+k:刪除當前光標後面的文字(還有剪切功能)
Ctrl+L:進行清屏操做
Ctrl+y:粘貼Ctrl+u或ctrl+k剪切的內容
Ctrl+w:刪除光標前面的單詞的字符
複製代碼

curl 命令的簡單使用

返回頭部和內容bash

curl -i http://www.baidu.co
複製代碼

只返回頭部curl

curl -I http://www.baidu.com
複製代碼
HTTP/1.1 200 OK
Accept-Ranges: bytes
Cache-Control: private, no-cache, no-store, proxy-revalidate, no-transform
Connection: Keep-Alive
Content-Length: 277
Content-Type: text/html
Date: Wed, 13 Mar 2019 08:42:40 GMT
Etag: "575e1f60-115"
Last-Modified: Mon, 13 Jun 2016 02:50:08 GMT
Pragma: no-cache
Server: bfe/1.0.8.18
複製代碼

關於es的增刪改查

建立

curl -X PUT 127.0.0.1:9200/synctest/article/5/
_create?pretty -d '{"name":"test"}'
{
  "_index" : "synctest",
  "_type" : "article",
  "_id" : "5",
  "_version" : 1,
  "_shards" : {
    "total" : 2,
    "successful" : 1,
    "failed" : 0
  },
  "created" : true
}

複製代碼

查詢

curl 127.0.0.1:9200/synctest/article/5?pretty
{
  "_index" : "synctest",
  "_type" : "article",
  "_id" : "5",
  "_version" : 1,
  "found" : true,
  "_source" : {
    "name" : "test"
  }
}
複製代碼

更新

curl -X POST 127.0.0.1:9200/synctest/article/5/_update?pretty -d ' {"doc":{"idx":"cc"}}'

{
  "_index" : "synctest",
  "_type" : "article",
  "_id" : "5",
  "_version" : 2,
  "_shards" : {
    "total" : 2,
    "successful" : 1,
    "failed" : 0
  }
}
複製代碼

刪除

curl -X DELETE 127.0.0.1:9200/synctest/article/5

{
    "found":true,
    "_index":"synctest",
    "_type":"article",
    "_id":"5",
    "_version":2,
    "_shards":{
        "total":2,
        "successful":1,
        "failed":0
    }
}
複製代碼

檢查文檔是否存在(不返回數據)

curl -i -X HEAD 127.0.0.1:9200/synctest/article/5?pretty

HTTP/1.1 200 OK
Content-Type: text/plain; charset=UTF-8
Content-Length: 0
複製代碼

查詢不存在的數據url

curl -I -X HEAD 127.0.0.1:9200/synctest/article/66?pretty

HTTP/1.1 404 Not Found
Content-Type: text/plain; charset=UTF-8
Content-Length: 0
複製代碼

批量查詢

查詢id=3或4spa

curl -X POST 127.0.0.1:9200/synctest/article/_mget?pretty -d '{"id s":["3","4"]}'

{
  "docs" : [ {
    "_index" : "synctest",
    "_type" : "article",
    "_id" : "3",
    "_version" : 2,
    "found" : true,
    "_source" : {
      "id" : 3,
      "is_deleted" : 0,
      "name" : "5333",
      "update_time" : "2018-11-02T11:13:33+08:00"
    }
  }, {
    "_index" : "synctest",
    "_type" : "article",
    "_id" : "4",
    "_version" : 14,
    "found" : true,
    "_source" : {
      "id" : 4,
      "cc" : 1,
      "views" : 6
    }
  } ]
}
複製代碼

ids 表示 id 的數組命令行

今天在地鐵感受忽然想起忘記一切,查了一路相關鎖的概念,後來在《芋道源碼》上看到了這幅圖,但願對你們也能有所幫助。

接下來會尋找機會摸魚, 整理更多的東西分享出來code

相關文章
相關標籤/搜索