Configuring a Monitoring node for Scaling and High Availability
原文:https://docs.gitlab.com/ee/administration/high_availability/monitoring_node.html
Configuring a Monitoring node for Scaling and High Availability
在 GitLab 12.0 中引入 .
您可以配置 Prometheus 节点以监视 GitLab.
Standalone Monitoring node using Omnibus GitLab
Omnibus GitLab 软件包可用于配置运行Prometheus和Grafana的独立 Monitoring 节点. 监视节点不是高度可用. 请参阅缩放和高可用性的 GitLab 扩展和高可用性选项的概述.
以下步骤是使用 Omnibus 配置运行 Prometheus 和 Grafana 的 Monitoring 节点的最低必需步骤:
- SSH 进入”监视”节点.
- 从 GitLab 下载页面使用步骤 1 和 2 下载/安装所需的 Omnibus GitLab 软件包.
- 不要完成下载页面上的任何其他步骤.
CONSUL_SERVER_NODES
,请确保收集CONSUL_SERVER_NODES
,它们是 Consul 服务器节点的 IP 地址或 DNS 记录. 请注意,它们显示为YYYY consul1.gitlab.example.com ZZZZ
编辑
/etc/gitlab/gitlab.rb
并添加内容:external_url 'http://gitlab.example.com'
# Enable Prometheus
prometheus['enable'] = true
prometheus['listen_address'] = '0.0.0.0:9090'
prometheus['monitor_kubernetes'] = false
# Enable Login form
grafana['disable_login_form'] = false
# Enable Grafana
grafana['enable'] = true
grafana['admin_password'] = 'toomanysecrets'
# Enable service discovery for Prometheus
consul['enable'] = true
consul['monitoring_service_discovery'] = true
# Replace placeholders
# Y.Y.Y.Y consul1.gitlab.example.com Z.Z.Z.Z
# with the addresses of the Consul server nodes
consul['configuration'] = {
retry_join: %w(Y.Y.Y.Y consul1.gitlab.example.com Z.Z.Z.Z),
}
# Disable all other services
gitlab_rails['auto_migrate'] = false
alertmanager['enable'] = false
gitaly['enable'] = false
gitlab_exporter['enable'] = false
gitlab_workhorse['enable'] = false
nginx['enable'] = true
postgres_exporter['enable'] = false
postgresql['enable'] = false
redis['enable'] = false
redis_exporter['enable'] = false
sidekiq['enable'] = false
puma['enable'] = false
node_exporter['enable'] = false
gitlab_exporter['enable'] = false
运行
sudo gitlab-ctl reconfigure
来编译配置.
下一步是告诉所有其他节点监视节点在哪里:
编辑
/etc/gitlab/gitlab.rb
,然后添加或查找并取消注释以下行:gitlab_rails['prometheus_address'] = '10.0.0.1:9090'
其中
10.0.0.1:9090
是 Prometheus 节点的 IP 地址和端口.保存文件并重新配置 GitLab,以使更改生效.
Migrating to Service Discovery
使用consul['monitoring_service_discovery'] = true
启用使用服务发现进行consul['monitoring_service_discovery'] = true
,请确保未在/etc/gitlab/gitlab.rb
设置prometheus['scrape_configs']
. 在/etc/gitlab/gitlab.rb
同时设置consul['monitoring_service_discovery'] = true
和prometheus['scrape_configs']
都会导致错误.