master 节点安装 nginx(1.14.1) 配置后打不开 harbor
来源:6-3 Harbor高可用部署(下)
惜福7840346
2021-08-12
控制台输出
[root@rep-vware-harbor70 nginx]# vi nginx.conf
[root@rep-vware-harbor70 nginx]# sh nginx_restart.sh
harbornginx
harbornginx
2d863f573d90d3d82849df6bfc30908bb09ac034e3d57f16e2d1e6869a26a9df
[root@rep-vware-harbor70 nginx]# ps -ef | grep nginx
root 38767 38747 0 09:14 pts/0 00:00:00 nginx: master process nginx -g daemon off;
101 38782 38767 0 09:14 pts/0 00:00:00 nginx: worker process
root 38784 37676 0 09:14 pts/0 00:00:00 grep --color=auto nginx
[root@rep-vware-harbor70 nginx]# ping 172.16.11.71
PING 172.16.11.71 (172.16.11.71) 56(84) bytes of data.
64 bytes from 172.16.11.71: icmp_seq=1 ttl=64 time=13.0 ms
64 bytes from 172.16.11.71: icmp_seq=2 ttl=64 time=0.314 ms
64 bytes from 172.16.11.71: icmp_seq=3 ttl=64 time=0.238 ms
^C
--- 172.16.11.71 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2058ms
rtt min/avg/max/mdev = 0.238/4.527/13.030/6.012 ms
[root@rep-vware-harbor70 nginx]# ping 172.16.11.72
PING 172.16.11.72 (172.16.11.72) 56(84) bytes of data.
64 bytes from 172.16.11.72: icmp_seq=1 ttl=64 time=9.37 ms
64 bytes from 172.16.11.72: icmp_seq=2 ttl=64 time=0.327 ms
^C
--- 172.16.11.72 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1002ms
rtt min/avg/max/mdev = 0.327/4.846/9.365/4.519 ms
[root@rep-vware-harbor70 nginx]# vi nginx_restart.sh
[root@rep-vware-harbor70 nginx]# cat nginx_restart.sh
#!/bin/bash
#停掉容器
docker stop harbornginx
#删除容器
docker rm harbornginx
#启动容器(-v 挂着目录)
docker run -idt --net=host --name harbornginx -v /root/nginx/nginx.conf:/ect/nginx/nginx.conf nginx:1.14.1
[root@rep-vware-harbor70 nginx]# vi /root/nginx/nginx.conf
[root@rep-vware-harbor70 nginx]# docker logs cabe51ca9ede681c1
Error: No such container: cabe51ca9ede681c1
[root@rep-vware-harbor70 nginx]# docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
2d863f573d90 nginx:1.14.1 "nginx -g 'daemon of…" 4 minutes ago Up 4 minutes harbornginx
[root@rep-vware-harbor70 nginx]# docker logs 2d863
[root@rep-vware-harbor70 nginx]# vi nginx.conf
[root@rep-vware-harbor70 nginx]# sh nginx_restart.sh
harbornginx
harbornginx
bf106f5785b414ed497b6c1111c0a34990ee90cf256e736197be62b05debd8b2
[root@rep-vware-harbor70 nginx]# docker container ls
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
bf106f5785b4 nginx:1.14.1 "nginx -g 'daemon of…" 59 seconds ago Up 58 seconds harbornginx
[root@rep-vware-harbor70 nginx]# docker logs bf1
[root@rep-vware-harbor70 nginx]#
80端口OK
[root@rep-vware-harbor70 nginx]# netstat -tnlup|grep 80
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 38872/nginx: master
71,72 worker 节点能打开 harbor
70 访问不了
nginx.conf 配置
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
stream {
upstream hub {
server 172.16.11.71:80;
}
server {
listen 80;
proxy_pass hub;
proxy_timeout 300s;
proxy_connect_timeout 5s;
}
}
请问这个我需要怎么处理??
写回答
2回答
-
刘果国
2021-08-14
哦,harbor要配置成域名
012021-08-17 -
刘果国
2021-08-13
首先没太理解你的做法,为什么搞这么多habor的入口呢?还是部署了好几个harbor?另外个别节点有问题最好的办法是比对,有好的打样比较容易排查
012021-08-13
相似问题