快捷键、curl命令、es简单使用、锁

不知不觉的再坚持一天要周五啦, 周末就要来了。大家嗨起来呀

下面是我这周目前的总结, 因工作繁忙, 内容比较简单, 希望大家见谅。

命令行常用的几个快捷键

ctrl+a:跳到本行的行首
ctrl+e:跳到页尾
Ctrl+u:删除当前光标前面的文字 (还有剪切功能)
ctrl+k:删除当前光标后面的文字(还有剪切功能)
Ctrl+L:进行清屏操作
Ctrl+y:粘贴Ctrl+u或ctrl+k剪切的内容
Ctrl+w:删除光标前面的单词的字符
复制代码

curl 命令的简单使用

返回头部和内容

curl -i http://www.baidu.co
复制代码

只返回头部

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
复制代码

查询不存在的数据

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或4

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 的数组

今天在地铁感觉突然想起忘记一切,查了一路相关锁的概念,后来在《芋道源码》上看到了这幅图,希望对大家也能有所帮助。

接下来会寻找机会摸鱼, 整理更多的东西分享出来

转载于:https://juejin.im/post/5c88bebd51882536fe67b225

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值