Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用docker启动起来了,只是无法接口报502 #42

Open
jikuanyu opened this issue Apr 12, 2023 · 13 comments
Open

使用docker启动起来了,只是无法接口报502 #42

jikuanyu opened this issue Apr 12, 2023 · 13 comments

Comments

@jikuanyu
Copy link

jikuanyu commented Apr 12, 2023

: 502 Bad Gateway
请求网址: http://192.168.144.16:9669/ncnb/project/recent?page=1&limit=6&order=updateTime
请求方法: GET
状态代码: 502 Bad Gateway
远程地址: 192.168.144.16:9669

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7740a720ad03 erdonline/erd-auth:latest "/bin/sh -c './xjar …" 49 minutes ago Up 31 seconds 9400/tcp erd-auth
4b8025242296 erdonline/erd-gateway:latest "/bin/sh -c './xjar …" 49 minutes ago Up 14 minutes 0.0.0.0:9502->9502/tcp, :::9502->9502/tcp, 9527/tcp erd-gateway
5a9162d36489 erdonline/erd-zerocode:latest "/bin/sh -c './xjar …" 49 minutes ago Up 8 seconds 9606/tcp erd-zerocode
9dc13190ae19 erdonline/erd-system:latest "/bin/sh -c './xjar …" 49 minutes ago Up 27 seconds 9404/tcp erd-system
03c252bf7734 erdonline/erd-nacos:latest "/docker-entrypoint.…" 49 minutes ago Up 14 minutes 0.0.0.0:8848->8848/tcp, :::8848->8848/tcp, 80/tcp, 0.0.0.0:9555->9555/tcp, :::9555->9555/tcp, 9669/tcp, 0.0.0.0:9848->9848/tcp, :::9848->9848/tcp erd-nacos
69fb6e75c1d4 erdonline/erd-mysql:latest "docker-entrypoint.s…" 50 minutes ago Up 14 minutes 0.0.0.0:3306->3306/tcp, :::3306->3306/tcp, 33060/tcp erd-mysql
d489fc331001 erdonline/erd-redis:latest "docker-entrypoint.s…" 50 minutes ago Up 14 minutes 0.0.0.0:6379->6379/tcp, :::6379->6379/tcp erd-redis
c9bf6fcadb60 erdonline/erd-ui:latest "/docker-entrypoint.…" 50 minutes ago Up 14 minutes 80/tcp, 0.0.0.0:9669->9669/tcp, :::9669->9669/tcp erd-ui
18ac09217a92 erdonline/erd-minio:latest "/usr/bin/docker-ent…" 50 minutes ago Up 14 minutes 0.0.0.0:9000-9001->9000-9001/tcp, :::9000-9001->9000-9001/tcp minio

@whaty
Copy link
Contributor

whaty commented Apr 13, 2023

使用下面命令,获取实时日志最后50行:
docker-compose logs -f -t --tail=50
再次刷新功能,看下日志有没有错误记录!
另外,可以参看这篇文章,https://www.zerocode.net.cn/thread/57

@jikuanyu
Copy link
Author

java.net.ConnectException: [NACOS HTTP-GET] The maximum number of tolerable server reconnection errors has been reached

erd-system | Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
erd-system |
erd-system | Reason: Failed to determine a suitable driver class
erd-system |
erd-system |
erd-system | Action:
erd-system |
erd-system | Consider the following:
erd-system | If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
erd-system | If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).
erd-system |
erd-system | panic: exit status 1

@whaty
Copy link
Contributor

whaty commented Apr 13, 2023

看起来像是服务没有连接到nacos,导致获取不到数据库配置

@whaty
Copy link
Contributor

whaty commented Apr 13, 2023

检查下mysql、nacos是否正常。http://192.168.144.16:8848/nacos,可以访问你本地的nacos。

@jikuanyu
Copy link
Author

进入docker容器后什么命令都不识别,如何查看? 刚接触docker

[root@k1 docker]# docker exec -it erd-nacos sh

ip addr

sh: 3: ip: not found

ps

sh: 4: ps: not found

yum

sh: 6: yum: not found

@whaty
Copy link
Contributor

whaty commented Apr 13, 2023

不用进docker排查,在外面用docker-compose命令基本上就可以排查出问题了

@jikuanyu
Copy link
Author

jikuanyu commented Apr 15, 2023

mysql远程都可以连接,不知道nacos容器在哪里,就是好多连接不上nacos异常。哎。
你这模块nacos镜像和nacos有什么关系吗?没有看出来。
[yujikuan@hadoop1 docker]$ docker history erdonline/erd-nacos
\IMAGE CREATED CREATED BY SIZE COMMENT
ad0e5bff0de0 2 weeks ago CMD ["/bin/bash" "-c" "/usr/share/nginx/html… 0B buildkit.dockerfile.v0
2 weeks ago EXPOSE map[9669/tcp:{}] 0B buildkit.dockerfile.v0
2 weeks ago RUN /bin/sh -c chmod +x env.sh # buildkit 794B buildkit.dockerfile.v0
2 weeks ago COPY .env . # buildkit 23B buildkit.dockerfile.v0
2 weeks ago COPY ./env.sh . # buildkit 794B buildkit.dockerfile.v0
2 weeks ago WORKDIR /usr/share/nginx/html 0B buildkit.dockerfile.v0
2 weeks ago ADD ./conf/nginx.conf /etc/nginx/nginx.conf … 4.35kB buildkit.dockerfile.v0
2 weeks ago ADD ./erd.tar.gz /usr/share/nginx/html # bui… 11.7MB buildkit.dockerfile.v0
9 months ago RUN /bin/sh -c ln -sf /usr/share/zoneinfo/As… 33B buildkit.dockerfile.v0
9 months ago MAINTAINER martin114@foxmail.com 0B buildkit.dockerfile.v0
11 months ago /bin/sh -c #(nop) CMD ["nginx" "-g" "daemon… 0B
11 months ago /bin/sh -c #(nop) STOPSIGNAL SIGQUIT 0B
11 months ago /bin/sh -c #(nop) EXPOSE 80 0B
11 months ago /bin/sh -c #(nop) ENTRYPOINT ["/docker-entr… 0B
11 months ago /bin/sh -c #(nop) COPY file:09a214a3e07c919a… 4.61kB
11 months ago /bin/sh -c #(nop) COPY file:0fd5fca330dcd6a7… 1.04kB
11 months ago /bin/sh -c #(nop) COPY file:0b866ff3fc1ef5b0… 1.96kB
11 months ago /bin/sh -c #(nop) COPY file:65504f71f5855ca0… 1.2kB
11 months ago /bin/sh -c set -x && addgroup --system -… 61.1MB
11 months ago /bin/sh -c #(nop) ENV PKG_RELEASE=1~bullseye 0B
11 months ago /bin/sh -c #(nop) ENV NJS_VERSION=0.7.3 0B
11 months ago /bin/sh -c #(nop) ENV NGINX_VERSION=1.20.2 0B
11 months ago /bin/sh -c #(nop) LABEL maintainer=NGINX Do… 0B
11 months ago /bin/sh -c #(nop) CMD ["bash"] 0B```

@jiadejun521
Copy link

搭了好几遍 ,都是这个问题 502 nacos 问题

@whaty
Copy link
Contributor

whaty commented Apr 20, 2023

搭了好几遍 ,都是这个问题 502 nacos 问题

需要更多的日志信息,才能帮助你排查问题

@whaty
Copy link
Contributor

whaty commented Apr 20, 2023

可以按照以下顺序,逐步定位:
1、只启动erd-mysql:docker-compose up erd-mysql
2、只启动erd-mysql、erd-nacos:docker-compose up erd-mysql erd-nacos
3、只启动erd-mysql、erd-nacos、erd-auth:docker-compose up erd-mysql erd-nacos erd-auth

@zengyufei
Copy link


erd-mysql  | 
erd-mysql  | 2023-04-22 10:29:26+08:00 [Note] [Entrypoint]: /usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/1schema.sql
erd-mysql  | 
erd-mysql  | 
erd-mysql  | 2023-04-22 10:29:26+08:00 [Note] [Entrypoint]: /usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/2erd.sql
erd-mysql  | 
erd-mysql  | 
erd-mysql  | 2023-04-22 10:29:27+08:00 [Note] [Entrypoint]: /usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/3martin.sql
erd-mysql  | 
erd-mysql  | 
erd-mysql  | 2023-04-22 10:29:28+08:00 [Note] [Entrypoint]: /usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/4nacos.sql
erd-mysql  | 
erd-mysql  | 
erd-mysql  | 2023-04-22 10:29:29+08:00 [Note] [Entrypoint]: /usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/5privileges.sql
erd-mysql  | 
erd-mysql  | 
erd-mysql  | 2023-04-22 10:29:29+08:00 [Note] [Entrypoint]: /usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/install_db.sh
erd-mysql  | /docker-entrypoint-initdb.d/install_db.sh: line 6: warning: here-document at line 1 delimited by end-of-file (wanted `EOF')
erd-mysql  | mysql: [Warning] Using a password on the command line interface can be insecure.
erd-mysql  | ERROR 1007 (HY000) at line 2 in file: '/usr/local/work/1schema.sql': Can't create database 'erd'; database exists
ERROR 1007 (HY000) at line 2 in file: '/usr/local/work/1schema.sql': Can't create database 'erd'; database exists

单独启动mysql报这个错误

@whaty
Copy link
Contributor

whaty commented Apr 23, 2023


erd-mysql  | 
erd-mysql  | 2023-04-22 10:29:26+08:00 [Note] [Entrypoint]: /usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/1schema.sql
erd-mysql  | 
erd-mysql  | 
erd-mysql  | 2023-04-22 10:29:26+08:00 [Note] [Entrypoint]: /usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/2erd.sql
erd-mysql  | 
erd-mysql  | 
erd-mysql  | 2023-04-22 10:29:27+08:00 [Note] [Entrypoint]: /usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/3martin.sql
erd-mysql  | 
erd-mysql  | 
erd-mysql  | 2023-04-22 10:29:28+08:00 [Note] [Entrypoint]: /usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/4nacos.sql
erd-mysql  | 
erd-mysql  | 
erd-mysql  | 2023-04-22 10:29:29+08:00 [Note] [Entrypoint]: /usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/5privileges.sql
erd-mysql  | 
erd-mysql  | 
erd-mysql  | 2023-04-22 10:29:29+08:00 [Note] [Entrypoint]: /usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/install_db.sh
erd-mysql  | /docker-entrypoint-initdb.d/install_db.sh: line 6: warning: here-document at line 1 delimited by end-of-file (wanted `EOF')
erd-mysql  | mysql: [Warning] Using a password on the command line interface can be insecure.
erd-mysql  | ERROR 1007 (HY000) at line 2 in file: '/usr/local/work/1schema.sql': Can't create database 'erd'; database exists
ERROR 1007 (HY000) at line 2 in file: '/usr/local/work/1schema.sql': Can't create database 'erd'; database exists

单独启动mysql报这个错误

1、应该是重复创建erd数据库了,解决办法如下,注意命令后面有个点:
docker cp 容器ID:/usr/local/work/1schema.sql .
2、修改1schema.sql ,删除新建erd的重复命令,下面命令应该有两行,删掉一行:
CREATE DATABASE test;
3、将文件重新放回容器:
docker cp 1schema.sql 容器ID:/usr/local/work/1schema.sql

@RickyGu777
Copy link

nacos数据库连接需要在URL中加上参数 &serverTimezone=UTC,否则nacos一直报No DataSource set

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants