关于Gitlab中的prometheus无法启动的问题说明
在使用gitlab-ctl status查看各服务启动状态时发现prometheus为down
使用gitlab-ctl tail prometheus查看日志发现9090端口被占用
2023-08-02_17:32:26.01940 ts=2023-08-02T17:32:26.019Z caller=main.go:833 level=error msg="Unable to start web listener" err="listen tcp 127.0.0.1:9090: bind: address already in use
使用ls0f -i :9090查看该端口发现被websm服务给占用
websm是centos8中的cockpit 服务,而这台系统中是开启了cockpit服务的,其监听端口正是9090,只需要修改cockpit服务的监听端口就可以了
修改命令如下:
[root@centos8-3 ~]# cat /usr/lib/systemd/system/cockpit.socket [Unit] Description=Cockpit Web Service Socket Documentation=man:cockpit-ws(8) Wants=cockpit-motd.service [Socket] ListenStream=8090 ExecStartPost=-/usr/share/cockpit/motd/update-motd '' localhost ExecStartPost=-/bin/ln -snf active.motd /run/cockpit/motd ExecStopPost=-/bin/ln -snf inactive.motd /run/cockpit/motd [Install] WantedBy=sockets.target #防火墙开放8090端口 firewall-cmd --zone=public --add-port=8090/tcp --permanent systemctl restart firewalld #最后重启服务即可 systemctl daemon-reload systemctl restart cockpit.service
修改完后重启gitlab
[root@centos8-3 ~]# gitlab-ctl restart ok: run: alertmanager: (pid 19115) 0s ok: run: gitaly: (pid 19125) 0s ok: run: gitlab-exporter: (pid 19142) 1s ok: run: gitlab-kas: (pid 19153) 0s ok: run: gitlab-workhorse: (pid 19164) 0s ok: run: logrotate: (pid 19175) 0s ok: run: nginx: (pid 19181) 1s ok: run: node-exporter: (pid 19189) 0s ok: run: postgres-exporter: (pid 19195) 1s ok: run: postgresql: (pid 19205) 0s ok: run: prometheus: (pid 19214) 1s ok: run: puma: (pid 19229) 0s ok: run: redis: (pid 19234) 1s ok: run: redis-exporter: (pid 19241) 0s ok: run: sidekiq: (pid 19250) 0s
查看gitlab服务状态
[root@centos8-3 ~]# gitlab-ctl status run: alertmanager: (pid 19115) 45s; run: log: (pid 1736) 2993s run: gitaly: (pid 19125) 44s; run: log: (pid 1745) 2993s run: gitlab-exporter: (pid 19142) 44s; run: log: (pid 1751) 2993s run: gitlab-kas: (pid 19153) 33s; run: log: (pid 1749) 2993s run: gitlab-workhorse: (pid 19164) 33s; run: log: (pid 1743) 2993s run: logrotate: (pid 19175) 33s; run: log: (pid 1723) 2993s run: nginx: (pid 19181) 33s; run: log: (pid 1748) 2993s run: node-exporter: (pid 19189) 32s; run: log: (pid 1756) 2993s run: postgres-exporter: (pid 19195) 32s; run: log: (pid 1734) 2993s run: postgresql: (pid 19205) 31s; run: log: (pid 1729) 2993s run: prometheus: (pid 19214) 31s; run: log: (pid 1757) 2993s run: puma: (pid 19229) 30s; run: log: (pid 1754) 2993s run: redis: (pid 19234) 30s; run: log: (pid 1740) 2993s run: redis-exporter: (pid 19241) 29s; run: log: (pid 1760) 2993s run: sidekiq: (pid 19250) 27s; run: log: (pid 1755) 2993s
prometheus服务已正常启动
******************************我也想难过的时候到海边走走,可是我的城市没有海。******************************