liudonghua123 commented on issue #2094: URL: https://github.com/apache/hertzbeat/issues/2094#issuecomment-2176389430
Yeah, I found the links you mentioned above, but I am using docker compose, the hertzbeat service is in restart status and I couldn't go into the container. So maybe I need to build mine own image which from the official `apache/hertzbeat` and simple add this jar. I tried to add the latest mysql-connector-j-8.4.0.jar, but it's the same, maybe I need to downgrade to mysql-connector-java-8.0.30.jar or check whether the file permission is not correct. <details><summary>Details</summary> ``` [root@ha-master-1 hertzbeat-mysql-tdengine]# vim docker-compose.yaml [root@ha-master-1 hertzbeat-mysql-tdengine]# cat Dockerfile FROM apache/hertzbeat # add mysql driver to ext-lib, see also https://hertzbeat.apache.org/docs/start/mysql-change/#add-mysql-jdbc-driver-jar ADD mysql-connector-j-8.4.0.jar /opt/hertzbeat/ext-lib [root@ha-master-1 hertzbeat-mysql-tdengine]# git diff docker-compose.yaml diff --git a/script/docker-compose/hertzbeat-mysql-tdengine/docker-compose.yaml b/script/docker-compose/hertzbeat-mysql-tdengine/docker-compose.yaml index a5054f3856..db22bf3978 100644 --- a/script/docker-compose/hertzbeat-mysql-tdengine/docker-compose.yaml +++ b/script/docker-compose/hertzbeat-mysql-tdengine/docker-compose.yaml @@ -62,7 +62,8 @@ services: - hertzbeat hertzbeat: - image: apache/hertzbeat + # image: apache/hertzbeat + build: . container_name: compose-hertzbeat hostname: hertzbeat restart: always [root@ha-master-1 hertzbeat-mysql-tdengine]# docker compose down -v WARN[0000] /root/app/hertzbeat/script/docker-compose/hertzbeat-mysql-tdengine/docker-compose.yaml: `version` is obsolete [+] Running 4/4 ✔ Container compose-hertzbeat Removed 0.1s ✔ Container compose-mysql Removed 2.1s ✔ Container compose-tdengine Removed 0.9s ✔ Network hertzbeat-mysql-tdengine_hertzbeat Removed 0.4s [root@ha-master-1 hertzbeat-mysql-tdengine]# [root@ha-master-1 hertzbeat-mysql-tdengine]# docker compose up -d WARN[0000] /root/app/hertzbeat/script/docker-compose/hertzbeat-mysql-tdengine/docker-compose.yaml: `version` is obsolete [+] Building 1.2s (7/7) FINISHED docker:default => [hertzbeat internal] load build definition from Dockerfile 0.1s => => transferring dockerfile: 297B 0.0s => [hertzbeat internal] load metadata for docker.io/apache/hertzbeat:latest 0.0s => [hertzbeat internal] load .dockerignore 0.2s => => transferring context: 2B 0.0s => [hertzbeat internal] load build context 0.2s => => transferring context: 2.53MB 0.0s => [hertzbeat 1/2] FROM docker.io/apache/hertzbeat:latest 0.5s => [hertzbeat 2/2] ADD mysql-connector-j-8.4.0.jar /opt/hertzbeat/ext-lib 0.2s => [hertzbeat] exporting to image 0.2s => => exporting layers 0.1s => => writing image sha256:60bfb3a38809bdf61f81d218b4f3e17cafbcf4905ba2e41d9c697956ff62d4e1 0.0s => => naming to docker.io/library/hertzbeat-mysql-tdengine-hertzbeat 0.0s [+] Running 4/4 ✔ Network hertzbeat-mysql-tdengine_hertzbeat Created 0.3s ✔ Container compose-mysql Healthy 6.4s ✔ Container compose-tdengine Healthy 13.9s ✔ Container compose-hertzbeat Started 13.4s [root@ha-master-1 hertzbeat-mysql-tdengine]# docker compose logs -f ...... compose-hertzbeat | _ _ _ ____ _ compose-hertzbeat | | | | | ___ _ __| |_ ___| __ ) ___ __ _| |_ compose-hertzbeat | | |_| |/ _ \ '__| __|_ / _ \ / _ \/ _` | __| Profile: prod compose-hertzbeat | | _ | __/ | | |_ / /| |_) | __/ (_| | |_ Name: hertzbeat10 Port: 1157 Pid: 10 compose-hertzbeat | |_| |_|\___|_| \__/___|____/ \___|\__,_|\__| https://hertzbeat.apache.org/ compose-hertzbeat | compose-hertzbeat | java.lang.ClassNotFoundException: com.mysql.cj.jdbc.Driver compose-hertzbeat | at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) compose-hertzbeat | at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) compose-hertzbeat | at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520) ...... [root@ha-master-1 hertzbeat-mysql-tdengine]# docker run --rm -it --entrypoint bash docker.io/library/hertzbeat-mysql-tdengine-hertzbeat root@99b6b62328c7:/opt/hertzbeat# cd ext-lib/ root@99b6b62328c7:/opt/hertzbeat/ext-lib# ls mysql-connector-j-8.4.0.jar README root@99b6b62328c7:/opt/hertzbeat/ext-lib# cat README # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. Please move external libs to this folder like: ojdbc8-21.5.0.0.jar orai18n-21.5.0.0.jar mysql-connector-java-8.0.30.jar root@99b6b62328c7:/opt/hertzbeat/ext-lib# exit exit [root@ha-master-1 hertzbeat-mysql-tdengine]# ``` </details> -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
