1.启动镜像
docker run --name esearch -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node” bdaab402b2202
2.查看docker进程
Docker ps
3.重用某个镜像
Docker restart 镜像名
Es相关操作:
1.检查ES节点是否正常启动
curl http://10.0.7.124:9200
2.cat检测集群健康状况
curl http://10.0.7.124:9200/_cat/health?v
3.查询es中所有索引,所有已存在的索引
curl http://10.0.7.124:9200/_cat/indices?v
4.创建新的索引【索引要求是全小写字符,可以有下划线隔开】
curl -XPUT http://10.0.7.124:9200/laylatest?pretty
5.对新增的索引,插入一条数据
type是user, id指定为1
curl -H “Content-Type: application/json” -XPUT http://10.0.7.124:9200/laylatest/user/1?pretty -d ‘{“name”:“张三”,“age”:“23”}’
6.根据ID,获取刚刚索引中新增的数据
curl -XGET http://10.0.7.124:9200/laylatest/user/1?pretty
7.修改数据
7.1先新增一条数据
curl -XPUT http://192.168.6.16:9200/my_new_index/user/2?pretty -d ‘{“name”:“李四”,“age”:"25”}’
7.2 根据ID查询这条数据
curl -XGET http://192.168.6.16:9200/my_new_index/user/2?pretty
7.3修改id为2的数据
curl -XPUT http://192.168.6.16:9200/my_new_index/user/2?pretty -d ‘{“name”:“李四修改”,“age”:"28”}’
8.更新数据,使用POST请求,注意请求体,格式
curl -XPOST http://192.168.6.16:9200/my_new_index/user/2/_update?pretty -d '{“doc”:{“name”:“李四更新”,“age”:“230”}}’
Es采集资料:
https://developer.qiniu.com/insight/manual/4765/es-reader
Es的查询:
Gte :>=
Lte :<=
Gt: >
Lt :<
清除es下的某个索引的数据
curl -XPOST ‘10.0.7.162:9200/laylatest/nathan008/_delete_by_query?’ -H ‘Content-Type: application/json’ -d ‘{“query”:{“match_all”:{}}}’
条件删除
curl -XPOST ‘192.168.18.248:9200/log/message/_delete_by_query?’ -H ‘Content-Type: application/json’ -d '{“query”:{“range":{“id”:{“gte”:1000001}}}}’
查看es的后10条日志:
docker logs -f -t --tail 10 esearch
进入容器内部:
docker exec -ti 容器ID /bin/bash
Curl 查询Es的数据条数:
curl -XGET http://10.0.7.162:9200/log/message/_search
curl -XGET http://192.168.18.248:9200/log/message/_search
curl -XPOST 192.168.18.248:9200/log/message/_delete_by_query
./esinsert -h http://192.168.18.248:9200
./ESinsert -h 192.168.18.248:9200
删除镜像:
docker rm $(docker ps -a -q)
查看dcoker版本:
Docker version
删除索引:
curl -XDELETE http://192.168.18.248:9200/nathan_test
curl -XDELETE http://10.0.7.162:9200/message
删除带身份认证的es的索引:
curl -XDELETE -u elastic:changeme http://10.0.7.163:9200/message
nohup ./daemonInsert.sh a673a704b6b7 > ./daemon.log 2>&1 &
Es的后台插入数据:
nohup ./esinsert -h http://192.168.18.248:9200 > ./insert.log 2>&1 &
Panads:
Git:
Sql:
容器内部的配置错误导致容器无法启动时:
1.选择将容器内部的配置拷贝出来,修改完成后,在拷贝回去
https://www.cnblogs.com/liongis/p/11132736.html