Commit 0b747b69 authored by 吴升宇's avatar 吴升宇

add es alias script

parent 3e194800
......@@ -55,3 +55,22 @@ celery -A physical beat
### physical策略端脚本
在Alp-Test-Cos-test001服务器上,通过crontab -l查看
### es常用命令
```bash
#修改别名:
curl -X POST -H "Content-Type: application/json" "http://172.17.32.22:9200/_aliases" -d '{"actions":[{"remove":{"index":"mv-alpha-product-prod-190904001","alias":"gm-dbmw-product-read"}},{"add":{"index":"mv-alpha-product-prod-191018401","alias":"gm-dbmw-product-read"}}]}'
#查看别名
curl -H "Content-Type: application/json" "http://172.17.32.22:9200/_aliases?pretty"
#查看所有索引
curl -H "Content-Type: application/json" "http://172.17.32.22:9200/_cat/indices?v"
#简单查询
curl -H "Content-Type: application/json" "http://172.17.32.22:9200/gm-dbmw-topic-high-star-read/_search?pretty" -d '{"query":{"term":{"id":"46710078"}}}'
```
### es同步确认脚本
cd /data/log/physical/app/index_contrast/
import os
os.system(
"""
source /srv/envs/physical/bin/activate
&& curl -X POST -H "Content-Type: application/json" "http://172.17.32.22:9200/_aliases" -d '{"actions":[{"remove":{"index":"mv-alpha-user-prod-190905002","alias":"gm-dbmw-user-read"}},{"add":{"index":"mv-alpha-user-prod-191018401","alias":"gm-dbmw-user-read"}}]}'
&& curl -X POST -H "Content-Type: application/json" "http://172.17.32.22:9200/_aliases" -d '{"actions":[{"remove":{"index":"mv-alpha-topic-prod-190928002","alias":"gm-dbmw-topic-read"}},{"add":{"index":"mv-alpha-topic-prod-191018401","alias":"gm-dbmw-topic-read"}}]}'
&& curl -X POST -H "Content-Type: application/json" "http://172.17.32.22:9200/_aliases" -d '{"actions":[{"remove":{"index":"mv-alpha-topic-high-star-prod-190928002","alias":"gm-dbmw-topic-high-star-read"}},{"add":{"index":"mv-alpha-topic-high-star-prod-191018401","alias":"gm-dbmw-topic-high-star-read"}}]}'
&& curl -X POST -H "Content-Type: application/json" "http://172.17.32.22:9200/_aliases" -d '{"actions":[{"remove":{"index":"mv-alpha-tag-prod-190904001","alias":"gm-dbmw-tag-read"}},{"add":{"index":"mv-alpha-tag-prod-191018401","alias":"gm-dbmw-tag-read"}}]}'
&& curl -X POST -H "Content-Type: application/json" "http://172.17.32.22:9200/_aliases" -d '{"actions":[{"remove":{"index":"mv-alpha-product-prod-190904001","alias":"gm-dbmw-product-read"}},{"add":{"index":"mv-alpha-product-prod-191018401","alias":"gm-dbmw-product-read"}}]}'
"""
)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment