下面是我这周目前的总结, 因工作繁忙, 内容比较简单, 希望大家见谅。
命令行常用的几个快捷键
代码语言:javascript复制ctrl a:跳到本行的行首
ctrl e:跳到页尾
Ctrl u:删除当前光标前面的文字 (还有剪切功能)
ctrl k:删除当前光标后面的文字(还有剪切功能)
Ctrl L:进行清屏操作
Ctrl y:粘贴Ctrl u或ctrl k剪切的内容
Ctrl w:删除光标前面的单词的字符
curl 命令的简单使用
返回头部和内容
代码语言:javascript复制curl -i http://www.baidu.co
只返回头部
代码语言:javascript复制curl -I http://www.baidu.com
代码语言:javascript复制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的增删改查
创建
代码语言:javascript复制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
}
查询
代码语言:javascript复制curl 127.0.0.1:9200/synctest/article/5?pretty
{
"_index" : "synctest",
"_type" : "article",
"_id" : "5",
"_version" : 1,
"found" : true,
"_source" : {
"name" : "test"
}
}
更新
代码语言:javascript复制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
}
}
删除
代码语言:javascript复制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
}
}
检查文档是否存在(不返回数据)
代码语言:javascript复制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
查询不存在的数据
代码语言:javascript复制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
代码语言:javascript复制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 的数组
今天在地铁感觉突然忘记好多,查了一路相关锁的概念,后来在《芋道源码》上看到了这幅图,希望对大家也能有所帮助。
接下来会寻找机会摸鱼, 整理更多的东西分享出来