전체 글
-
SpringBoot와 Kafka 연동 시 발생한 ErrorHandlingDeserializer 관련 오류Apache Kafka/오류 해결 2024. 1. 14. 23:27
문제 스프링부트에서 STOMP를 활용한 채팅방을 구현하기 위해 기존 In memory broker 방식에서 External broker 중 하나인 Kafka를 통해 아래 형태의 메시지를 전달하려는데, @Getter @NoArgsConstructor @ToString public class Message { @NotNull private MessageType type; private String roomId; @NotNull private String sender; @NotNull private String message; @Builder private Message(MessageType type, String roomId, String sender, String message) { this.type = ..
-
SpringBoot와 Docker compose로 pull 받은 Kafka 연동 시 발생한 오류Apache Kafka/오류 해결 2024. 1. 14. 23:23
문제 1 현재 카프카의 경우, AWS LightSail 서버에 Docker로 올려둔 상황이며, 로컬 환경에서의 스프링부트와 연동하고자 하는데 아래와 같은 문제가 발생했다. INFO 33496 --- [ntainer#0-0-C-1] org.apache.kafka.clients.NetworkClient : [Consumer clientId=consumer-chatting-1, groupId=chatting] Node 1001 disconnected. WARN 33496 --- [ntainer#0-0-C-1] org.apache.kafka.clients.NetworkClient : [Consumer clientId=consumer-chatting-1, groupId=chatting] Connection to ..
-
[Kafka 개념] Kafka 브로커, 클러스터, 주키퍼Apache Kafka/개념 정리 2024. 1. 14. 23:17
카프카 브로커, 클러스터, 주키퍼 카프카 브로커는 카프카 클라이언트와 데이터를 주고받기 위해 사용하는 주체이자, 데이터를 분산 저장하여 장애가 발생하더라도 안전하게 사용할 수 있도록 도와주는 애플리케이션이다. 기본적으로 하나의 서버에는 한 개의 카프카 브로커 프로세스가 실행되나, 데이터를 안전하게 보관하고 처리하기 위해서는 3대 이상의 브로커 서버를 1개의 클러스터로 묶어서 운영하는 것이 좋다. 카프카 클러스터로 묶인 브로커들은 프로듀서가 보낸 데이터를 안전하게 분산 저장하고 복제하는 역할을 수행한다. 브로커 데이터 저장, 전송 프로듀서로부터 데이터를 전달받으면 카프카 브로커는 프로듀서가 요청한 토픽의 파티션에 데이터를 저장하고 컨슈머가 데이터를 요청하면 파티션에 저장된 데이터를 전달한다. 프로듀서로부터..
-
[LeetCode Medium] 1341. Movie RatingSQL 문제 풀이 2024. 1. 12. 12:32
테이블 정보 문제 Write a solution to: Find the name of the user who has rated the greatest number of movies. In case of a tie, return the lexicographically smaller user name. Find the movie name with the highest average rating in February 2020. In case of a tie, return the lexicographically smaller movie name. 결과 예시 정답 코드 (MySQL) (SELECT u.name AS results FROM Users u JOIN MovieRating mr ON u.user_id =..
-
[LeetCode Hard] 185. Department Top Three SalariesSQL 문제 풀이 2024. 1. 7. 11:39
테이블 정보 문제 A company's executives are interested in seeing who earns the most money in each of the company's departments. A high earner in a department is an employee who has a salary in the top three unique salaries for that department. Write a solution to find the employees who are high earners in each of the departments. Return the result table in any order. The result format is in the followi..
-
[LeetCode Medium] 550. Game Play Analysis IVSQL 문제 풀이 2024. 1. 5. 13:28
테이블 정보 문제 Write a solution to report the fraction of players that logged in again on the day after the day they first logged in, rounded to 2 decimal places. In other words, you need to count the number of players that logged in for at least two consecutive days starting from their first login date, then divide that number by the total number of players. 결과 예시 정답 코드 (MySQL) WITH check_login AS (..
-
git log에 최신 커밋이 안 보일 때 복원하기Git 2024. 1. 4. 21:20
Git 작업을 하다가 잘못된 명령어 조작으로 한참 뒤의 commit으로 돌아가 HEAD로 위치하게 되었고 git log로 살펴보니 돌아가버린 commit 시점으로부터 앞의 commit들(원래 HEAD가 위치했던)이 보이지 않아 당황했다... 돌아가고 싶은 commitID만 알면 되는데... 그 commit들이 git log를 통해 보이질 않으니 순간 블랙 아웃 그렇게 폭풍 구글링을 하다가 나를 구원해줄 블로그를 찾았다. https://www.letmecompile.com/git-restore-lost-commits/ 깃(Git) 에서 유실된 커밋(commit) 복원하기 깃(Git)을 이용하여 작업을 하다가 리베이스(rebase) 실수 또는 잘못된 명령어나 조작 실수 등 다양한 이유로 인해 자신의 피땀눈물..
-
[프로그래머스 Level 4] 입양 시각 구하기 (2)SQL 문제 풀이 2024. 1. 4. 00:32
테이블 정보 문제 보호소에서는 몇 시에 입양이 가장 활발하게 일어나는지 알아보려 합니다. 0시부터 23시까지, 각 시간대별로 입양이 몇 건이나 발생했는지 조회하는 SQL문을 작성해주세요. 이때 결과는 시간대 순으로 정렬해야 합니다. 결과 예시 문제 풀이 (MySQL) SET @HOUR = -1; SELECT (@HOUR := @HOUR + 1) AS HOUR, (SELECT COUNT(HOUR(B.DATETIME)) FROM ANIMAL_OUTS B WHERE @HOUR = HOUR(B.DATETIME) ) AS COUNT FROM ANIMAL_OUTS A LIMIT 24; 위에 예시를 보다시피 7시부터 데이터가 존재한다. 그러므로 단순히 HOUR(DATETIME)으로 GROUP BY를 통해 묶어준다면 ..