Why?(使用ES目标)
解决根据progress和账号获取订单列表Mysql性能瓶颈
How?
将每个订单的查询条件都存储到ES,进行索引,所有订单支持搜索的条件都添加到索引Mapping字段中去,(如何解决延迟问题?)
一、安装
- 依赖
- Java
- Node
- 下载
- 部署ES - 主节点配置文件 - elasticsearch-master/config/elasticsearch.yml添加- 1 
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11- # 允许ElasticSearch-Head访问 
 http.cors.enabled: true
 http.cors.allow-origin: "*"
 # 设置集群名称
 cluster.name: order
 # 设置节点名称
 node.name: master
 # 设置为主节点
 node.master: true
 # 指定主机IP
 network.host: 127.0.0.1
- 从节点配置文件 - elasticsearch-slave/config/elasticsearch.yml添加- 1 
 2
 3
 4
 5
 6
 7
 8- # 设置集群名称 
 cluster.name: order
 # 设置节点名称
 node.name: slave01
 # 指定端口
 http.port: 9201
 # 指定集群主节点IP
 discovery.zen.ping.unicast.hosts: ["127.0.0.1"]
- 启动 - ./bin/elasticsearch -d
 
- 部署ES-HEAD - 1 
 2
 3- cd elasticsearch-head 
 npm install
 npm run start
二、使用
1.创建索引
| 1 | PUT http://127.0.0.1:9200/chengdan | 
2.创建文档
| 1 | POST http://127.0.0.1:9200/chengdan/order/34756359 | 
3.查询文档
| 1 | POST http://127.0.0.1:9200/chengdan/order/_search | 
4.修改文档
| 1 | POST http://127.0.0.1:9200/chengdan/order/34756359/_update |