인프런 Ai 가 아닌 강사님이 도움을 주시길 바라봅니다... 스프링부트3가 되면서 sleuth가 사용이 안 된다 하여, 강사님 깃허브에 배포된 프로젝트와 커뮤니티 게시판을 참조하여 디펜던시를 다 수정하고 테스트 하였으나 order-service와 user-service 같은 traceId가 출력이 되고, 혹시 다운받은 zipkin이 문제인가 하여 도커로 zipkin을 실행해봤으나 브라우저로 접속한 zipkin에서는 아무런 traceId가 검색이 되지 않고 어떠한 요청들도 기록이 되지 않습니다. 무엇이 문제일까요...? 스택오버플로우에 비슷한 사례들을 찾아봐서 amqp와 같이 쓰면 문제가 생긴다 이런 저런 디펜던시 추가해봐라 하는 것들을 다 따라봤으나 해결이 되지 않습니다. 삼일째 이 문제에서 벗어나지 못하고 있습니다... 간곡히 도움을 부탁드립니다... 어떠한 키워드라도 좋으니 혹시 이 글을 보시는 다른 수강생분들도 도움 좀 주세요...
선생님께서 Spring Cloud Gateway - Filter 적용에서 yml적용과 java 코드 적용시 두가지 방법이 있다고 알려주셨습니다. 둘다 방과 같은 기능이라는걸 알게되었지만 어떤경우나 환경에 yml 이나 java코드를 사용하는지 궁금합니다. 또한 두가지 방법중 실무에서는 어떤방법을 선택해서 사용하는지 질문드립니다
로그에 traceId, spanId 모두 잘 찍히는데 브라우저의 zipkin에서 traceId로 조회를 하면 no trace가 뜨네요. 스프링부트 3에 맞춰서 깃허브에 올려주신 자료 참조해서 디펜던시 맞게 설정하고 yml에도 올려주신 자료대로 수정했는데 이런 문제가 생기면 어떤 부분이 잘못된 걸까요?
D:\코딩\kafka_demo\kafka_2.13-3.7.0> .\bin\windows\zookeeper-server-start.bat .\config\zookeeper.properties The input line is too long. The syntax of the command is incorrect. D:\코딩\kafka_demo\kafka_2.13-3.7.0> 입력 명령어가 너무 길다고 계속 오류가 나는데 버전을 낮춰야할까요..?
강의 잘보고 있습니다. 다름이 아니라 MSA 환경에서는 한 서비스가 여러 인스턴스로 올라가있는 경우가 있는데, prometheus.yml에서 해당 인스턴스를 다 지정해주지 않아도 괜찮을까요? 또한 spring cloud gateway에서 lb://ORDER-SERVICE 형태로 로드밸런싱 처리가 되어있는데, 그렇다면 프로메테우스에서 actuator로 가져오는 데이터가 여러 인스턴스 각각 가져오는게 아닌 로드밸런싱되는데로 데이터를 가져오게 되지않나요? 호기심에 질문해봅니다.
안녕하세요 강의를 모두 수강후 , 강의를 통해 MSA관련 배운부분을 적용시키기 위해 프로젝트를 진행했습니다! Spring Cloud를 활용하고 서비스를 모두 개발완료 후 배포를 진행중입니다. 현재 마이크로 채팅 서비스가 ec2 a인스턴스에있고 gateway는 b인스턴스에 있고 모두 docker로 배포를 진행했습니다. eureka서버는 b인스턴스에 있고 gateway를 비롯해서 모든 마이크로서비스가 정상적으로 등록된 상태입니다. 그러던중에, 아래와 같은 에러가 gateway 로그에 찍혔습니다. ec2 보안그룹도 정상적으로 포트를 열어줬고, 외부에서 접근이 가능하게 docker로 포트 매핑도 진행했고 , 방화벽도 문제가없는데 원래 gateway에서 ==> 다른 인스턴스에 있는 마이크로서비스를 연결을 하지못하는걸까요? 구글링을 많이해봤지만, 비슷한 내용이 없고 해결하기가 어려워 질문 남깁니다ㅜㅜ +)추가로 라우팅도 정상적으로 되어 매칭이 됬다는 로그도 나오는 상태에서 finishConnect(..) failed: Connection refused 에러가 생깁니다.. a.w.r.e.AbstractErrorWebExceptionHandler : [1e416af9] 500 Server Error for HTTP GET "/plant-chat-service/chatroom/exist/seller?tradeBoardNo=2&memberNo=1" io.netty.channel.AbstractChannel$AnnotatedConnectException: finishConnect(..) failed: Connection refused: /172.18.0.5:46183 Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: Error has been observed at the following site(s): *__checkpoint ⇢ org.springframework.boot.actuate.web.trace.reactive.HttpTraceWebFilter [DefaultWebFilterChain] *__checkpoint ⇢ org.springframework.cloud.gateway.filter.WeightCalculatorWebFilter [DefaultWebFilterChain] *__checkpoint ⇢ org.springframework.boot.actuate.metrics.web.reactive.server.MetricsWebFilter [DefaultWebFilterChain] *__checkpoint ⇢ HTTP GET "/plant-chat-service/chatroom/exist/seller?tradeBoardNo=2&memberNo=1" [ExceptionHandlingWebHandler] Original Stack Trace: Caused by: java.net.ConnectException: finishConnect(..) failed: Connection refused at io.netty.channel.unix.Errors.newConnectException0(Errors.java:155) ~[netty-transport-native-unix-common-4.1.85.Final.jar!/:4.1.85.Final] at io.netty.channel.unix.Errors.handleConnectErrno(Errors.java:128) ~[netty-transport-native-unix-common-4.1.85.Final.jar!/:4.1.85.Final] at io.netty.channel.unix.Socket.finishConnect(Socket.java:359) ~[netty-transport-native-unix-common-4.1.85.Final.jar!/:4.1.85.Final] at io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.doFinishConnect(AbstractEpollChannel.java:710) ~[netty-transport-classes-epoll-4.1.85.Final.jar!/:4.1.85.Final] at io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.finishConnect(AbstractEpollChannel.java:687) ~[netty-transport-classes-epoll-4.1.85.Final.jar!/:4.1.85.Final] at io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.epollOutReady(AbstractEpollChannel.java:567) ~[netty-transport-classes-epoll-4.1.85.Final.jar!/:4.1.85.Final] at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:489) ~[netty-transport-classes-epoll-4.1.85.Final.jar!/:4.1.85.Final] at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:397) ~[netty-transport-classes-epoll-4.1.85.Final.jar!/:4.1.85.Final] at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) ~[netty-common-4.1.85.Final.jar!/:4.1.85.Final] at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[netty-common-4.1.85.Final.jar!/:4.1.85.Final] at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[netty-common-4.1.85.Final.jar!/:4.1.85.Final] at java.base/java.lang.Thread.run(Thread.java:831) ~[na:na]
return (exchange, chain) -> { ServerHttpRequest request = exchange.getRequest(); ServerHttpResponse response = exchange.getResponse(); log.info("Custom PRE filter: request id -> {}", request.getId() ); // Custom Post Filter return chain.filter(exchange).then(Mono.fromRunnable(() -> { log.info("Custom POST filter: response code -> {}", response.getStatusCode()); })); }; //return null; 강사님. 안녕하세요. 좋은 강의 잘 듣고 있어요. 이전에 devops 강의 너무 좋아서 이 강의도 듣게 되었습니다. 다름이 아니라 위의 람다코드는 getId 이후에 statusCode 부분을 비동기 방식으로 찍는 것 같은데 서버에서 Filter 적용시 비동기로 찍는 것은 아무래도 성능 때문인지 궁금하여 글 남깁니다. 감사합니다. !!!
일단 제 환경은 윈도우구요 apigateway-service 내의 application.yml 파일의 url를 일반 ip 어드레스가 아닌 loadbalancer 방식으로 변경하여 테스트하면 진행되지 않습니다; 트러블슈팅에 장시간이 걸렸는데 혹시나 해서 제 피씨 네임을 인식하지 못하나 해서 hosts 파일에 본인 pc 네임과 127.0.0.1을 추가해주면 됩니다. 만약 네 pc가 '뽀로로'인 경우 뽀로로 127.0.0.1을 'C:\Windows\System32\drivers\etc'의 파일에 추가해줍니다.
여러 서비스가 Kafka에 메시지를 전달해서 이를 단일 서버에서 저장하는 것은 이해가 갑니다! 그렇다면 조회할 때는 어떤 식으로 흐름이 발생하는건가요? 기존에 어플리케이션이 직접 DB와 커넥션이 되어있는 상태라면 조회문 날리면 그만인데 조회의 경우엔 조회 이벤트가 발생할 때마다 조회 이벤트를 보내면 DB가 카프카에 쿼리를 실행한 결과값을 저장하고, 어플리케이션에서는 또 컨슈머를 만들어서 그값을 가져오는 형태인가요?
Microservcie간 통신 강의를 보다가 궁금하게 있어서 질문드립니다. user-service에서 order-service를 요청할때 인증은 필요가 없는건가요? order-service를 요청할때 따로 헤더에 토큰을 담지 않고 요청을 하고 있어서요. order-service를 IP로 지정하지 않고 유레카에 서비스 이름으로 지정해서 요청할때도 gateway를 통해서 요청이 들어 가는것인가요?
찾아보니 비슷한 질문이 있었던 거 같은데 현재 실습환경과 100% 일치하지 않아 도움을 구합니다. 실행환경은 다음과 같습니다 인텔리제이 : Build #IU-241.14494.240, built on March 28, 2024 JDK : 17 스프링부트 : 3.2.4 아시다 시피 최신 인텔리제이에서는 실습환경으로 제시되는 2.X 버전의 스프링부트 지원이 되지 않습니다. POM.XML로 강제로 버전을 내리거나 JDK 버전을 내리는 경우 서비스 기동이 제대로 되지 않습니다. 아마 스프링부트 3 버전에서는 JDK 특정 버전 이상을 강제하는 느낌입니다. 현재 pom.xml 설정은 다음과 같습니다. <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>3.2.4</version> <relativePath/> <!-- lookup parent from repository --> </parent> <groupId>com.example</groupId> <artifactId>user-serivce</artifactId> <version>0.0.1-SNAPSHOT</version> <name>user-serivce</name> <description>user-serivce</description> <properties> <java.version>17</java.version> <spring-cloud.version>2023.0.1</spring-cloud.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <scope>runtime</scope> <optional>true</optional> </dependency> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <optional>true</optional> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> </dependencies> <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-dependencies</artifactId> <version>${spring-cloud.version}</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <excludes> <exclude> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> </exclude> </excludes> </configuration> </plugin> </plugins> </build> </project> 명렁어 실행 시 에러는 다음과 같이 발생합니다. [ERROR] Unknown lifecycle phase ".run.jvmArguments=-Dserver.port=9003". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-vers ion>]:<goal>. Available lifecycle phases are: pre-clean, clean, post-clean, validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sou rces, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-site, site, post-site, site-deploy. -> [Help 1] 동일한 명렁어를 윈도우즈 cmd에서 실행하면 다음과 같습니다. [WARNING] Error injecting: org.springframework.boot.maven.RunMojo java.lang.TypeNotPresentException: Type org.springframework.boot.maven.RunMojo not present at org.eclipse.sisu.space .URLClassSpace.loadClass ( URLClassSpace.java:147 ) (중략) Caused by: java.lang.UnsupportedClassVersionError: org/springframework/boot/maven/RunMojo has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0 본 문제 때문에 강의 진행이 안되고 있습니다. 꼭 해결해 주셨으면 합니다.
apigateway의 application.yml을 보면 get요청에는 authorizationHeaderFilter를 적용시키고 있습니다. authenticFilter는 그저 로그인 요청시 attempthAuthentication메소드와 successfulAthentication메소드를 통해 인증을 처리하고 response헤더에 토큰을 추가하는 역할입니다. 따라서 로그인 요청에만 적용하면 될 것 같은데, 깃허브의 최신코드 버전을 보면 거의 모든 요청에 authenticationFilter를 적용하고 있습니다. 왜 로그인요청이 아닌 다른 요청에다가 AthenticFilter를 적용할까요? apiGateway-service에서 GET요청만 AuthoriztionFilter를 적용하면 되지않나요?? http.authorizeHttpRequests((authz) -> authz .requestMatchers(new AntPathRequestMatcher("/actuator/**")).permitAll() .requestMatchers(new AntPathRequestMatcher("/h2-console/**")).permitAll() .requestMatchers(new AntPathRequestMatcher("/users", "POST")).permitAll() .requestMatchers(new AntPathRequestMatcher("/h2-console/**")).permitAll() // .requestMatchers(new AntPathRequestMatcher("/welcome/**")).permitAll() // .requestMatchers("/**").access(this::hasIpAddress) .requestMatchers("/**").access( new WebExpressionAuthorizationManager("hasIpAddress('127.0.0.1') or hasIpAddress('172.30.1.48')")) .anyRequest().authenticated() )
안녕하세요. 깃허브에서 spring boot 3.2 브랜치통해 코드를 작성했습니다. 그런데 회원가입, 로그인까지 해서 jwt토큰까지는 잘 받아오는데, 그 이후에 /welcome으로 헤더에 토큰으로 추가해서 요청을 보내도 403 forbidden에러가 뜹니다. 코드는 spring boot 3.2 브랜치와 동일합니다.