This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def drop_all_doc_types(es: Elasticsearch, type_=ES_DOC_TYPE): | |
| while es.count()["count"] > 0: | |
| r = es.search( | |
| index=ES_INDEX, | |
| doc_type=type_, | |
| filter_path=["hits.hits._id"], | |
| body={"query": {"match_all": {}}}, | |
| size=10000, | |
| ) | |
| ids = [x["_id"] for x in r["hits"]["hits"]] if r else [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| kubectl -n <namespace> scale deployment <depl-name> --replicas=0 && kubectl -n <namespace> scale deployment <depl-name> --replicas=1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # pill from [Errno 98] Address already in use | |
| socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) | |
| socket.setsockopt(socket.SOL_SOCKET, socket.SO_LINGER, struct.pack('ii', 1, 0)) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sudo docker rm -v $(sudo docker ps -a -q) && sudo docker rmi $(sudo docker images -q) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- selects approx size of all databases | |
| SELECT | |
| table_schema AS "Database", | |
| SUM( data_length + index_length )/1024/1024 AS "Size, MB" | |
| FROM information_schema.TABLES | |
| GROUP BY table_schema; | |
| SELECT | |
| CONCAT(table_schema, '.', table_name) AS "Table", | |
| ROUND(((data_length + index_length) / 1024 / 1024), 2) AS "Total size, MB", |