본문 바로가기
반응형

개발 이야기42

Elasticsearch Too many dynamic script compilations within, ~ 에러 해결하기 elasticsearch 디폴트 설정 값이 150/5m 으로 되어 있어서 100000/1m 으로 바꾼다 PUT method를 이용해서 호출하면 정상적으로 바뀌고 더 이상 에러가 나지 않는다 이외에 스크립트 자체를 static으로 바꾸는 것도 해결법 중 하나이다 참고 자료 : https://alexmarquardt.com/2020/10/21/elasticsearch-too-many-script-compilations/ 2024. 3. 28.
Nginx - index 페이지 기본 탐색기 적용하기 server { ... content ... location / { autoindex on; } } fancy index를 활용하면 날짜 포맷도 바꿀 수 있음 sudo apt-get -y install libnginx-mod-http-fancyindex server { ... content ... location / { autoindex on; fancyindex on; fancyindex_time_format "%Y-%m-%d %H:%M:%S"; } } reference : https://installati.one/install-libnginx-mod-http-fancyindex-ubuntu-18-04/?expand_article=1 2024. 2. 29.
Django 에서 GROUP_CONCAT 커스텀 사용 시 order_by, separator 추가하기 class CustomConcat(Aggregate): function = 'GROUP_CONCAT' allow_distinct = True def __init__(self, expression, distinct=False, **extra): # order by = group_concat 의 정렬 기준 # separator = group_concat 의 구분자(default = ",") expr_separator = '' expr_order_by = '' order_by = extra.get('order_by') separator = extra.get('separator') if order_by: expr_order_by = f' ORDER BY {order_by} ' if separator: expr_.. 2024. 2. 27.
Python 이중 for loop 를 itertools 를 활용하여 개선하기 a = [1,2,3,4] b = ['A', 'B'] 의 두 리스트에 대해 (1,A), (1,B), (2,A), (2,B), ... 반복을 하려면 무지성으로 구현했을 때 for x in a: for y in b: function(x, y) 처럼 구현할 수 있다. 하지만 itertools 의 product 를 활용하면 좀 더 깔끔하게 구현이 가능하다 [function(x, y) for x, y in product(a, b)] 2024. 2. 26.
Nginx 프록시 대상에게 Client IP 정보 넘겨주기 location { ... proxy_set_headerX-Real-IP$remote_addr; proxy_set_headerX-Forwarded-For$proxy_add_x_forwarded_for; ... } 위와 같이 세팅하면 proxy 대상 서버에서는 x-forwarded-for header를 읽으면 IP가 찍혀 있다. 2024. 2. 20.
Gunicorn 에서 print() output 이 로깅 되지 않을 때 해결법 # myapp.service StandardOutput=journal StandardError=journal 을 추가하면 print() 문구가 노출된다 2023. 11. 22.
반응형