Closed sergey-morenets closed 2 years ago
Hi
Did you run your microservices by Docker Compose ?
Yes. docker-compose build and then docker-compose up -d
At this point I run them only by Docker Compose
So then you need to specify Graphite host in the microservice settings because by default it tries to connect to localhost.
Yes I'm sure of that but I couldn't find any information about how and where - how I can set that host (syntax) and how to connect to it in docker Compose. I only found info that i need to do that but without any example
Please, review the documentation: https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#actuator
@sergey-morenets I have some issues with this. Look simple to add it to project. But added all like You on lecture and after starting all microservices. All modules are working but those which supposed to connect to Graphite giving me warning (below) and whatever I find in Web and try don't help. FYI - graphite is working - can go to localhost:80 and see it. Grafana also working and can connet to graphite Please HELP!!
Warning: WARN [users,,] 1 --- [rter-1-thread-1] c.c.metrics.graphite.GraphiteReporter : Unable to report to Graphite
java.net.ConnectException: Connection refused at java.base/sun.nio.ch.Net.connect0(Native Method) ~[na:na] at java.base/sun.nio.ch.Net.connect(Net.java:579) ~[na:na] at java.base/sun.nio.ch.Net.connect(Net.java:568) ~[na:na] at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:585) ~[na:na] at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327) ~[na:na] at java.base/java.net.Socket.connect(Socket.java:633) ~[na:na] at java.base/java.net.Socket.connect(Socket.java:583) ~[na:na] at java.base/java.net.Socket.(Socket.java:507) ~[na:na]
at java.base/java.net.Socket.(Socket.java:319) ~[na:na]
at java.base/javax.net.DefaultSocketFactory.createSocket(SocketFactory.java:277) ~[na:na]
at com.codahale.metrics.graphite.PickledGraphite.connect(PickledGraphite.java:185) ~[metrics-graphite-4.2.10.jar!/:4.2.10]
at com.codahale.metrics.graphite.GraphiteReporter.report(GraphiteReporter.java:374) ~[metrics-graphite-4.2.10.jar!/:4.2.10]
at com.codahale.metrics.ScheduledReporter.report(ScheduledReporter.java:253) ~[metrics-core-4.2.10.jar!/:4.2.10]
at com.codahale.metrics.ScheduledReporter.lambda$start$0(ScheduledReporter.java:182) ~[metrics-core-4.2.10.jar!/:4.2.10]
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[na:na]
at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) ~[na:na]
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[na:na]
at java.base/java.lang.Thread.run(Thread.java:833) ~[na:na]
POM files
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
docker-compose ( https://github.com/ohanke/game_shop/blob/master/docker-compose.yml ):
version: '3.8' services:
graphite: image: graphiteapp/graphite-statsd container_name: graphite ports:
graphite:/graphite/storage
grafana: image: grafana/grafana ports:
GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
user: image: "users" container_name: users build: context: ./game_shop-users dockerfile: Dockerfile depends_on:
postgres
orders: image: "orders" container_name: orders build: context: ./game_shop-orders dockerfile: Dockerfile depends_on:
postgres
notifications: image: "notifications" container_name: notifications build: context: ./game_shop-notifications dockerfile: Dockerfile depends_on:
spring
eureka-server: image: "eureka-server" container_name: eureka-server build: context: ./eureka-server ports:
zipkin
config-server: image: "config-server" container_name: config-server build: context: ./config-server dockerfile: Dockerfile depends_on:
spring
zookeeper: image: confluentinc/cp-zookeeper:7.0.1 container_name: zookeeper environment: ZOOKEEPER_CLIENT_PORT: 2181 ZOOKEEPER_TICK_TIME: 2000 depends_on:
spring
broker: image: confluentinc/cp-kafka:7.0.1 container_name: broker ports:
zookeeper environment: KAFKA_BROKER_ID: 1 KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://broker:9092,PLAINTEXT_HOST://localhost:29092 KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1 KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1 restart: on-failure
akhq: image: tchiotludo/akhq environment: AKHQ_CONFIGURATION: | akhq: connections: docker-kafka-server: properties: bootstrap.servers: "broker:29092" ports:
"28081:28081"
zipkin: image: openzipkin/zipkin container_name: zipkin ports:
spring
postgres: container_name: postgres image: postgres environment: POSTGRES_USER: root POSTGRES_PASSWORD: root PGDATA: /data/postgres volumes:
postgres restart: unless-stopped
pgadmin: container_name: pageadmin image: dpage/pgadmin4 environment: PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL:-pgadmin4@pgadmin.org} PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD:-admin} PGADMIN_CONFIG_SERVER_MODE: 'False' volumes:
networks: postgres: driver: bridge spring: driver: bridge
volumes: postgres: pgadmin: graphite: